summaryrefslogtreecommitdiff
path: root/gtk/compat.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2011-12-30 23:22:18 +0000
committerVincent Sanders <vince@netsurf-browser.org>2011-12-30 23:22:18 +0000
commitbe20f89884da134b09a96f459bd47e4badb0af39 (patch)
tree162092aeb36163d0d7a89324af914ac799a51d9c /gtk/compat.c
parentfafdf2c33738206da8b26c62fe5d100da4f42b16 (diff)
downloadnetsurf-be20f89884da134b09a96f459bd47e4badb0af39.tar.gz
netsurf-be20f89884da134b09a96f459bd47e4badb0af39.tar.bz2
only use libsexy entry widget prior to gtk 2.16
svn path=/trunk/netsurf/; revision=13356
Diffstat (limited to 'gtk/compat.c')
-rw-r--r--gtk/compat.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/gtk/compat.c b/gtk/compat.c
index 86b87d4cb..8d8ac698b 100644
--- a/gtk/compat.c
+++ b/gtk/compat.c
@@ -124,3 +124,48 @@ gchar *nsgtk_combo_box_text_get_active_text(GtkWidget *combo_box)
return gtk_combo_box_get_active_text(GTK_COMBO_BOX(combo_box));
#endif
}
+
+GtkWidget *nsgtk_entry_new(void)
+{
+#if GTK_CHECK_VERSION(2,16,0)
+ return gtk_entry_new();
+#else
+ return GTK_WIDGET(sexy_icon_entry_new());
+#endif
+}
+
+void nsgtk_entry_set_icon_from_pixbuf(GtkWidget *entry, GtkEntryIconPosition icon_pos, GdkPixbuf *pixbuf)
+{
+#if GTK_CHECK_VERSION(2,16,0)
+ gtk_entry_set_icon_from_pixbuf(GTK_ENTRY(entry), icon_pos, pixbuf);
+#else
+ GtkImage *image = GTK_IMAGE(gtk_image_new_from_pixbuf(pixbuf));
+
+ if (image != NULL) {
+ sexy_icon_entry_set_icon(SEXY_ICON_ENTRY(entry),
+ (SexyIconEntryPosition)icon_pos,
+ image);
+
+ g_object_unref(image);
+ }
+
+#endif
+}
+
+void nsgtk_entry_set_icon_from_stock(GtkWidget *entry, GtkEntryIconPosition icon_pos, const gchar *stock_id)
+{
+#if GTK_CHECK_VERSION(2,16,0)
+ gtk_entry_set_icon_from_stock(GTK_ENTRY(entry), icon_pos, stock_id);
+#else
+ GtkImage *image = GTK_IMAGE(gtk_image_new_from_stock(stock_id,
+ GTK_ICON_SIZE_LARGE_TOOLBAR));
+
+ if (image != NULL) {
+ sexy_icon_entry_set_icon(SEXY_ICON_ENTRY(entry),
+ (SexyIconEntryPosition)icon_pos,
+ image);
+ g_object_unref(image);
+ }
+
+#endif
+}