summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2019-08-10 04:46:34 +0200
committerRobert Antoni Buj Gelonch <[email protected]>2019-08-11 18:38:38 +0200
commit268e75f740b335dcba21828d78dc61469439b9b3 (patch)
treed5063873b289e61eb66732c29c5c05da642dc5d9
parentc7da4d723c6fc161d9876d1adc07eac4000f0155 (diff)
downloadpluma-268e75f740b335dcba21828d78dc61469439b9b3.tar.bz2
pluma-268e75f740b335dcba21828d78dc61469439b9b3.tar.xz
pluma-view: avoid static gboolean variable
in function 'pluma_override_font'
-rw-r--r--pluma/pluma-view.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/pluma/pluma-view.c b/pluma/pluma-view.c
index eb503d15..0bcbcf5a 100644
--- a/pluma/pluma-view.c
+++ b/pluma/pluma-view.c
@@ -797,8 +797,7 @@ pluma_override_font (const gchar *item,
GtkWidget *widget,
PangoFontDescription *font)
{
- static gboolean provider_added = FALSE;
- static GtkCssProvider *provider; /*We need to keep this as long as Pluma is running*/
+ static GtkCssProvider *provider = NULL; /*We need to keep this as long as Pluma is running*/
gchar *prov_str;
gchar *css;
gchar *family;
@@ -821,8 +820,21 @@ pluma_override_font (const gchar *item,
pango_font_description_get_size (font) / PANGO_SCALE,
pango_font_description_get_size_is_absolute (font) ? "px" : "pt");
- if (!provider_added)
+ if (provider == NULL)
+ {
+ static GSettings *settings; /*We need this for the life of the provider and program*/
+
provider = gtk_css_provider_new ();
+ settings = g_settings_new ("org.mate.interface");
+
+ g_signal_connect (settings,
+ "changed::" "font-name",
+ G_CALLBACK (system_font_changed_cb), NULL);
+
+ gtk_style_context_add_provider_for_screen (gtk_widget_get_screen (widget),
+ GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ }
prov_str = gtk_css_provider_to_string (provider);
@@ -843,20 +855,6 @@ pluma_override_font (const gchar *item,
gtk_css_provider_load_from_data (provider, css, -1, NULL);
- if (!provider_added)
- {
- 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",
- G_CALLBACK (system_font_changed_cb), NULL);
-
- gtk_style_context_add_provider_for_screen (gtk_widget_get_screen (widget),
- GTK_STYLE_PROVIDER (provider),
- GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
- provider_added = TRUE;
- }
-
g_free (css);
g_free (family);
g_free (weight);