diff options
author | Vincent Sanders <vince@kyllikki.org> | 2015-04-09 23:25:05 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2015-04-09 23:25:05 +0100 |
commit | 23ae8ccf110f94019c745ebc4959c06b842a626d (patch) | |
tree | d1f5dbacaeebca363808cc4e73f3ed640f1ef433 /gtk/compat.c | |
parent | d0b56d660f1018741f0aabd5f5e02dc69db2e479 (diff) | |
download | netsurf-23ae8ccf110f94019c745ebc4959c06b842a626d.tar.gz netsurf-23ae8ccf110f94019c745ebc4959c06b842a626d.tar.bz2 |
Extend gtk compatability to fix more items depricated in GTK 3.10
Diffstat (limited to 'gtk/compat.c')
-rw-r--r-- | gtk/compat.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/gtk/compat.c b/gtk/compat.c index fe57ba285..3248254fd 100644 --- a/gtk/compat.c +++ b/gtk/compat.c @@ -316,7 +316,7 @@ const PangoFontDescription* nsgtk_style_context_get_font(GtkStyleContext *style, GtkStateFlags state) { #if GTK_CHECK_VERSION(3,8,0) - const PangoFontDescription* fontdesc; + const PangoFontDescription* fontdesc = NULL; gtk_style_context_get(style, state, GTK_STYLE_PROPERTY_FONT, &fontdesc, NULL); return fontdesc; #else @@ -454,3 +454,32 @@ void nsgtk_widget_get_allocation(GtkWidget *widget, GtkAllocation *allocation) allocation->height = widget->allocation.height; #endif } + +/* exported interface documented in gtk/compat.h */ +GtkWidget *nsgtk_image_new_from_pixbuf_icon(GdkPixbuf *pixbuf, GtkIconSize size) +{ +#if GTK_CHECK_VERSION(3,10,0) + return gtk_image_new_from_pixbuf(pixbuf); +#else + GtkIconSet *icon_set; + GtkWidget *image; + + icon_set = gtk_icon_set_new_from_pixbuf(pixbuf); + + image = gtk_image_new_from_icon_set(icon_set, size); + + gtk_icon_set_unref(icon_set); + + return image; +#endif +} + +/* exported interface documented in gtk/compat.h */ +GtkWidget *nsgtk_button_new_from_stock(const gchar *stock_id) +{ +#if GTK_CHECK_VERSION(3,10,0) + return gtk_button_new_with_label(stock_id); +#else + return nsgtk_button_new_from_stock(stock_id); +#endif +} |