aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorFelix Riemann <friemann@svn.gnome.org>2007-05-08 23:16:20 +0800
committerFelix Riemann <friemann@src.gnome.org>2007-05-08 23:16:20 +0800
commit5e6be16d3a44bdb8369f3e9e27a8e29298988398 (patch)
tree1e52f32cd395200a02436cb4561a183c7194e307 /lib
parentadd2d2104b2ef494290bbb33072f8f65f7ee8f5f (diff)
downloadgsoc2013-epiphany-5e6be16d3a44bdb8369f3e9e27a8e29298988398.tar
gsoc2013-epiphany-5e6be16d3a44bdb8369f3e9e27a8e29298988398.tar.gz
gsoc2013-epiphany-5e6be16d3a44bdb8369f3e9e27a8e29298988398.tar.bz2
gsoc2013-epiphany-5e6be16d3a44bdb8369f3e9e27a8e29298988398.tar.lz
gsoc2013-epiphany-5e6be16d3a44bdb8369f3e9e27a8e29298988398.tar.xz
gsoc2013-epiphany-5e6be16d3a44bdb8369f3e9e27a8e29298988398.tar.zst
gsoc2013-epiphany-5e6be16d3a44bdb8369f3e9e27a8e29298988398.zip
Support using named icons in the toolbareditor and attach them to the
2007-05-08 Felix Riemann <friemann@svn.gnome.org> * lib/egg/egg-toolbar-editor.c: (event_box_realize_cb), (editor_create_item_from_name): Support using named icons in the toolbareditor and attach them to the mouse pointer while dragging them to the toolbar. (bug #436684) svn path=/trunk/; revision=7024
Diffstat (limited to 'lib')
-rw-r--r--lib/egg/egg-toolbar-editor.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/egg/egg-toolbar-editor.c b/lib/egg/egg-toolbar-editor.c
index 568dfed18..746810707 100644
--- a/lib/egg/egg-toolbar-editor.c
+++ b/lib/egg/egg-toolbar-editor.c
@@ -368,6 +368,13 @@ event_box_realize_cb (GtkWidget *widget, GtkImage *icon)
gtk_drag_source_set_icon_pixbuf (widget, pixbuf);
g_object_unref (pixbuf);
}
+ else if (type == GTK_IMAGE_ICON_NAME)
+ {
+ const gchar *icon_name;
+
+ gtk_image_get_icon_name (icon, &icon_name, NULL);
+ gtk_drag_source_set_icon_name (widget, icon_name);
+ }
else if (type == GTK_IMAGE_PIXBUF)
{
GdkPixbuf *pixbuf = gtk_image_get_pixbuf (icon);
@@ -454,8 +461,15 @@ editor_create_item_from_name (EggToolbarEditor *editor,
g_value_init (&value, G_TYPE_STRING);
g_object_get_property (G_OBJECT (action), "stock_id", &value);
stock_id = g_value_get_string (&value);
- icon = gtk_image_new_from_stock (stock_id ? stock_id : GTK_STOCK_DND,
- GTK_ICON_SIZE_LARGE_TOOLBAR);
+
+ /* This is a workaround to catch named icons. */
+ if (stock_id && gtk_icon_theme_has_icon (gtk_icon_theme_get_default(), stock_id))
+ icon = gtk_image_new_from_icon_name (stock_id,
+ GTK_ICON_SIZE_LARGE_TOOLBAR);
+ else
+ icon = gtk_image_new_from_stock (stock_id ? stock_id : GTK_STOCK_DND,
+ GTK_ICON_SIZE_LARGE_TOOLBAR);
+
g_value_unset (&value);
g_value_init (&value, G_TYPE_STRING);