[Xfce4-commits] [apps/xfce4-dict] 16/43: Replace gtk_widget_modify_font by gtk_widget_override_font/GtkStyleContext

noreply at xfce.org noreply at xfce.org
Tue Nov 1 00:31:29 CET 2016


This is an automated email from the git hooks/post-receive script.

andre pushed a commit to branch master
in repository apps/xfce4-dict.

commit 72c62723f960e21dde4c2401bd09d02164fec4fc
Author: Andre Miranda <andre42m at gmail.com>
Date:   Wed Jul 20 23:05:35 2016 -0300

    Replace gtk_widget_modify_font by gtk_widget_override_font/GtkStyleContext
---
 lib/speedreader.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/lib/speedreader.c b/lib/speedreader.c
index 025845d..f9b5e27 100644
--- a/lib/speedreader.c
+++ b/lib/speedreader.c
@@ -354,7 +354,6 @@ static void sr_start(XfdSpeedReader *dialog)
 	gint wpm, grouping;
 	gint interval;
 	const gchar *fontname;
-	PangoFontDescription *pfd;
 	gchar *text, *cleaned_text;
 	GtkTextIter start, end;
 
@@ -380,9 +379,25 @@ static void sr_start(XfdSpeedReader *dialog)
 
 	/* set the font */
 	fontname = gtk_font_button_get_font_name(GTK_FONT_BUTTON(priv->button_font));
+
+#if GTK_CHECK_VERSION (3, 16, 0)
+	gchar *css;
+	GtkCssProvider *provider;
+
+	css = g_strdup_printf("* { font: %s; }", fontname);
+	provider = gtk_css_provider_new ();
+	gtk_css_provider_load_from_data (provider, css, -1, NULL);
+	gtk_style_context_add_provider (
+			GTK_STYLE_CONTEXT (gtk_widget_get_style_context (GTK_WIDGET (priv->display_label))),
+			GTK_STYLE_PROVIDER(provider),
+			GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+	g_free(css);
+#else
+	PangoFontDescription *pfd;
 	pfd = pango_font_description_from_string(fontname);
-	gtk_widget_modify_font(priv->display_label, pfd);
+	gtk_widget_override_font(datetime->time_label, pfd);
 	pango_font_description_free(pfd);
+#endif
 
 	/* word grouping */
 	grouping = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(priv->spin_grouping));

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list