From d3757dfa7b822dba1dc1b686ae60fdf77a097cf2 Mon Sep 17 00:00:00 2001 From: lukefromdc Date: Tue, 24 Jul 2018 16:17:16 -0400 Subject: pluma-view: use static variables for cssprovider and settings We need to create these once and keep them as long as Pluma is running. Also do not use newly deprecated(in GTk 3.23) gtk_css_provider_get_default() --- pluma/pluma-view.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pluma/pluma-view.c b/pluma/pluma-view.c index 7aec69e3..28b39fe4 100644 --- a/pluma/pluma-view.c +++ b/pluma/pluma-view.c @@ -686,7 +686,7 @@ pluma_override_font (const gchar *item, PangoFontDescription *font) { static gboolean provider_added = FALSE; - GtkCssProvider *provider; + static GtkCssProvider *provider; /*We need to keep this as long as Pluma is running*/ gchar *prov_str; gchar *css; gchar *family; @@ -709,7 +709,8 @@ pluma_override_font (const gchar *item, pango_font_description_get_size (font) / PANGO_SCALE, pango_font_description_get_size_is_absolute (font) ? "px" : "pt"); - provider = gtk_css_provider_get_default (); + if (!provider_added) + provider = gtk_css_provider_new (); prov_str = gtk_css_provider_to_string (provider); @@ -729,7 +730,7 @@ pluma_override_font (const gchar *item, if (!provider_added) { - GSettings *settings; + static GSettings *settings; /*We need this for the life of the provider and program*/ settings = g_settings_new ("org.mate.interface"); g_signal_connect (settings, "changed::" "font-name", -- cgit v1.2.1