From 5e6be16d3a44bdb8369f3e9e27a8e29298988398 Mon Sep 17 00:00:00 2001 From: Felix Riemann Date: Tue, 8 May 2007 15:16:20 +0000 Subject: Support using named icons in the toolbareditor and attach them to the 2007-05-08 Felix Riemann * 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 --- ChangeLog | 7 +++++++ lib/egg/egg-toolbar-editor.c | 18 ++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 220b0c0a1..59a6662bc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-05-08 Felix Riemann + + * 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) + 2007-05-04 Diego Escalante Urrelo * src/ephy-find-toolbar.c: 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); -- cgit v1.2.3