Skip to content
Permalink
Browse files

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()
  • Loading branch information...
lukefromdc authored and raveit65 committed Jul 24, 2018
1 parent b2ca8c4 commit d3757dfa7b822dba1dc1b686ae60fdf77a097cf2
Showing with 4 additions and 3 deletions.
  1. +4 −3 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",

0 comments on commit d3757df

Please sign in to comment.
You can’t perform that action at this time.