summaryrefslogtreecommitdiff
path: root/src/ui/theme-viewer.c
diff options
context:
space:
mode:
authorraveit65 <[email protected]>2017-02-07 21:37:34 +0100
committerraveit65 <[email protected]>2017-02-07 21:37:34 +0100
commit34599278fd3f77a37ef565494b3a7f3c407e17ce (patch)
tree17da3f943e22d856a536cda5c000ee32553601b9 /src/ui/theme-viewer.c
parentf145d407235388b1ea8f866b44ee2bdd1eff58af (diff)
downloadmarco-34599278fd3f77a37ef565494b3a7f3c407e17ce.tar.bz2
marco-34599278fd3f77a37ef565494b3a7f3c407e17ce.tar.xz
theme-viewer: don't use deprecated gtk_widget_override_font
taken from: https://git.gnome.org/browse/metacity/commit/?id=02fa1e1
Diffstat (limited to 'src/ui/theme-viewer.c')
-rw-r--r--src/ui/theme-viewer.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/ui/theme-viewer.c b/src/ui/theme-viewer.c
index cc64ee5c..297ecab1 100644
--- a/src/ui/theme-viewer.c
+++ b/src/ui/theme-viewer.c
@@ -480,6 +480,25 @@ get_window_flags (MetaFrameType type)
return flags;
}
+static void
+override_font (GtkWidget *widget,
+ const gchar *font)
+{
+ gchar *css;
+ GtkCssProvider *provider;
+
+ provider = gtk_css_provider_new ();
+
+ css = g_strdup_printf ("* { font: %s; }", font);
+ gtk_css_provider_load_from_data (provider, css, -1, NULL);
+ g_free (css);
+
+ gtk_style_context_add_provider (gtk_widget_get_style_context (widget),
+ GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ g_object_unref (provider);
+}
+
static GtkWidget*
preview_collection (int font_size,
const PangoFontDescription *base_desc)
@@ -528,6 +547,7 @@ preview_collection (int font_size,
GtkWidget *eventbox2;
GtkWidget *preview;
PangoFontDescription *font_desc;
+ gchar *font_string;
double scale;
eventbox2 = gtk_event_box_new ();
@@ -584,7 +604,9 @@ preview_collection (int font_size,
pango_font_description_set_size (font_desc,
MAX (pango_font_description_get_size (base_desc) * scale, 1));
- gtk_widget_override_font (preview, font_desc);
+ font_string = pango_font_description_to_string (font_desc);
+ override_font (preview, font_string);
+ g_free (font_string);
pango_font_description_free (font_desc);
}