diff options
author | lukefromdc <[email protected]> | 2018-07-24 16:17:16 -0400 |
---|---|---|
committer | raveit65 <[email protected]> | 2018-07-30 17:33:51 +0200 |
commit | d3757dfa7b822dba1dc1b686ae60fdf77a097cf2 (patch) | |
tree | 24c79348f2fb9b381f8ab998be49d0ab8a1526fb | |
parent | b2ca8c4cb34f8efae18d4849eb25369c6a6b935b (diff) | |
download | pluma-d3757dfa7b822dba1dc1b686ae60fdf77a097cf2.tar.bz2 pluma-d3757dfa7b822dba1dc1b686ae60fdf77a097cf2.tar.xz |
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()
-rw-r--r-- | pluma/pluma-view.c | 7 |
1 files 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", |