summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2014-01-14 19:00:58 +0000
committerjstebbins <[email protected]>2014-01-14 19:00:58 +0000
commit36b7f949d2257fa1e1262bd441f89f566b04c5d4 (patch)
treea1c157b533b41dd20b3d5e41f8bf7a66e9b8488c
parent7a89045498016168afa0de453118677bd32029e4 (diff)
LinGui: fix deprecated gtk_widget_get_style()
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5971 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--gtk/src/ghbcellrenderertext.c2
-rw-r--r--gtk/src/ghbcompat.h23
2 files changed, 24 insertions, 1 deletions
diff --git a/gtk/src/ghbcellrenderertext.c b/gtk/src/ghbcellrenderertext.c
index f65c111e0..133923f3a 100644
--- a/gtk/src/ghbcellrenderertext.c
+++ b/gtk/src/ghbcellrenderertext.c
@@ -1546,7 +1546,7 @@ get_size (GtkCellRenderer *cell,
PangoFontDescription *font_desc;
gint row_height;
- font_desc = pango_font_description_copy_static(gtk_widget_get_style(widget)->font_desc);
+ font_desc = pango_font_description_copy_static(ghb_widget_get_font(widget));
pango_font_description_merge_static(font_desc, celltext->font, TRUE);
if (celltext->scale_set)
diff --git a/gtk/src/ghbcompat.h b/gtk/src/ghbcompat.h
index b352b9d82..47d97fdd6 100644
--- a/gtk/src/ghbcompat.h
+++ b/gtk/src/ghbcompat.h
@@ -29,6 +29,29 @@ static inline gboolean gtk_widget_get_realized(GtkWidget *widget)
}
#endif
+static inline PangoFontDescription* ghb_widget_get_font(GtkWidget *widget)
+{
+ PangoFontDescription *font = NULL;
+
+#if GTK_CHECK_VERSION(3, 0, 0)
+ GtkStyleContext *style;
+
+ style = gtk_widget_get_style_context(widget);
+
+#if GTK_CHECK_VERSION(3, 8, 0)
+ gtk_style_context_get(style, GTK_STATE_FLAG_NORMAL,
+ "font", &font, NULL);
+#else
+ font = gtk_style_context_get_font(style, GTK_STATE_FLAG_NORMAL);
+#endif
+
+#else
+ font = gtk_widget_get_style(widget)->font_desc;
+#endif
+
+ return font;
+}
+
#if !GTK_CHECK_VERSION(3, 0, 0)
#define gtk_widget_override_font gtk_widget_modify_font
#endif