summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2019-08-10 04:46:34 +0200
committermonsta <[email protected]>2020-02-13 14:16:35 +0300
commit42c09a576c00446f1cb2ea81d3da260146063e27 (patch)
tree0fafc8457a011253818018513d8bec715bb1f621
parentdbad9c1006e6e8ed78ce8d68d274d4177eb86dcb (diff)
downloadpluma-42c09a576c00446f1cb2ea81d3da260146063e27.tar.bz2
pluma-42c09a576c00446f1cb2ea81d3da260146063e27.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 1c14fc4b..c72d3c51 100644
--- a/pluma/pluma-view.c
+++ b/pluma/pluma-view.c
@@ -718,8 +718,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;
@@ -742,8 +741,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);
@@ -764,20 +776,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);