Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 30, 2018
1 parent b2ca8c4 commit d3757df
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pluma/pluma-view.c
Expand Up @@ -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;
Expand All @@ -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);

Expand All @@ -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",
Expand Down

0 comments on commit d3757df

Please sign in to comment.