summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-01-20 07:58:57 +0100
committerPřemysl Janouch <p.janouch@gmail.com>2015-01-20 07:58:57 +0100
commitfb6f89fb5cd61060762ccb989f8dab5edaa19c2b (patch)
treef3eb57528ef105e40a55f91ea7d0c3f2bba0b213
parente1225accf47ce3dcff0b811b8793d8898e78f9e9 (diff)
downloadlogdiag-fb6f89fb5cd61060762ccb989f8dab5edaa19c2b.tar.gz
logdiag-fb6f89fb5cd61060762ccb989f8dab5edaa19c2b.tar.xz
logdiag-fb6f89fb5cd61060762ccb989f8dab5edaa19c2b.zip
Fix a depreciation warning
With a ton of additional code.
-rw-r--r--liblogdiag/ld-lua.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/liblogdiag/ld-lua.c b/liblogdiag/ld-lua.c
index b8b0e48..dfb0f3a 100644
--- a/liblogdiag/ld-lua.c
+++ b/liblogdiag/ld-lua.c
@@ -827,7 +827,9 @@ LD_LUA_CAIRO_END (0)
LD_LUA_CAIRO_BEGIN (show_text)
const char *text;
- GtkStyle *style;
+ GtkStyleContext *style;
+ const PangoFontDescription *orig_font_desc;
+ PangoFontDescription *font_desc;
PangoLayout *layout;
int width, height;
double x, y;
@@ -838,9 +840,13 @@ LD_LUA_CAIRO_BEGIN (show_text)
layout = pango_cairo_create_layout (data->cr);
pango_layout_set_text (layout, text, -1);
- style = gtk_style_new ();
- pango_font_description_set_size (style->font_desc, 1 * PANGO_SCALE);
- pango_layout_set_font_description (layout, style->font_desc);
+ style = gtk_style_context_new ();
+ gtk_style_context_get (style, GTK_STATE_FLAG_NORMAL,
+ GTK_STYLE_PROPERTY_FONT, &orig_font_desc, NULL);
+ font_desc = pango_font_description_copy (orig_font_desc);
+ pango_font_description_set_size (font_desc, 1 * PANGO_SCALE);
+ pango_layout_set_font_description (layout, font_desc);
+ pango_font_description_free (font_desc);
g_object_unref (style);
pango_layout_get_size (layout, &width, &height);