Skip to content

Commit d3757df

Browse files
lukefromdcraveit65
authored and
raveit65
committed
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()
1 parent b2ca8c4 commit d3757df

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pluma/pluma-view.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ pluma_override_font (const gchar *item,
686686
PangoFontDescription *font)
687687
{
688688
static gboolean provider_added = FALSE;
689-
GtkCssProvider *provider;
689+
static GtkCssProvider *provider; /*We need to keep this as long as Pluma is running*/
690690
gchar *prov_str;
691691
gchar *css;
692692
gchar *family;
@@ -709,7 +709,8 @@ pluma_override_font (const gchar *item,
709709
pango_font_description_get_size (font) / PANGO_SCALE,
710710
pango_font_description_get_size_is_absolute (font) ? "px" : "pt");
711711

712-
provider = gtk_css_provider_get_default ();
712+
if (!provider_added)
713+
provider = gtk_css_provider_new ();
713714

714715
prov_str = gtk_css_provider_to_string (provider);
715716

@@ -729,7 +730,7 @@ pluma_override_font (const gchar *item,
729730

730731
if (!provider_added)
731732
{
732-
GSettings *settings;
733+
static GSettings *settings; /*We need this for the life of the provider and program*/
733734
settings = g_settings_new ("org.mate.interface");
734735
g_signal_connect (settings,
735736
"changed::" "font-name",

0 commit comments

Comments
 (0)