From db02570a8627588efe5ed3479573bdf48e20ba30 Mon Sep 17 00:00:00 2001 From: Felix Riemann Date: Sun, 24 Jun 2007 12:00:15 +0000 Subject: Add a workaround to take into account that Gtk{Radio,Toggle}Actions only 2007-06-24 Felix Riemann * lib/egg/egg-toolbar-editor.c: (editor_create_item_from_name): Add a workaround to take into account that Gtk{Radio,Toggle}Actions only set either the stock-id or the icon-name property depending on the image type. This makes it possible to display the icon of such actions in the toolbar editor. (bug #450590) svn path=/trunk/; revision=7093 --- ChangeLog | 8 ++++++++ lib/egg/egg-toolbar-editor.c | 15 +++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 78379feb5..f635ade9c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-06-24 Felix Riemann + + * lib/egg/egg-toolbar-editor.c: (editor_create_item_from_name): + Add a workaround to take into account that Gtk{Radio,Toggle}Actions + only set either the stock-id or the icon-name property depending on + the image type. This makes it possible to display the icon of such + actions in the toolbar editor. (bug #450590) + 2007-06-22 Gabor Kelemen * src/ephy-main.c: Use g_option_group_set_translation_domain to diff --git a/lib/egg/egg-toolbar-editor.c b/lib/egg/egg-toolbar-editor.c index 746810707..a74cbf94a 100644 --- a/lib/egg/egg-toolbar-editor.c +++ b/lib/egg/egg-toolbar-editor.c @@ -454,16 +454,27 @@ editor_create_item_from_name (EggToolbarEditor *editor, GValue value = { 0, }; GtkAction *action; GtkWidget *icon; + gboolean is_named = FALSE; action = find_action (editor, name); g_return_val_if_fail (action != NULL, NULL); g_value_init (&value, G_TYPE_STRING); - g_object_get_property (G_OBJECT (action), "stock_id", &value); + g_object_get_property (G_OBJECT (action), "icon-name", &value); stock_id = g_value_get_string (&value); + if (!stock_id) { + /* Gtk{Radio,Toggle}Actions only set either of the properties */ + g_value_reset (&value); + g_object_get_property (G_OBJECT (action), "stock-id", &value); + stock_id = g_value_get_string (&value); + is_named = FALSE; + } else { + is_named = TRUE; + } + /* This is a workaround to catch named icons. */ - if (stock_id && gtk_icon_theme_has_icon (gtk_icon_theme_get_default(), stock_id)) + if (is_named) icon = gtk_image_new_from_icon_name (stock_id, GTK_ICON_SIZE_LARGE_TOOLBAR); else -- cgit v1.2.3