aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorFelix Riemann <friemann@svn.gnome.org>2007-06-24 20:00:15 +0800
committerFelix Riemann <friemann@src.gnome.org>2007-06-24 20:00:15 +0800
commitdb02570a8627588efe5ed3479573bdf48e20ba30 (patch)
tree2a9e98b83a63439888af618432f99140bd1b9c8f /lib
parentf8605d62e2f4540134f2fca9496f12dd00c97476 (diff)
downloadgsoc2013-epiphany-db02570a8627588efe5ed3479573bdf48e20ba30.tar.gz
gsoc2013-epiphany-db02570a8627588efe5ed3479573bdf48e20ba30.tar.zst
gsoc2013-epiphany-db02570a8627588efe5ed3479573bdf48e20ba30.zip
Add a workaround to take into account that Gtk{Radio,Toggle}Actions only
2007-06-24 Felix Riemann <friemann@svn.gnome.org> * 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
Diffstat (limited to 'lib')
-rw-r--r--lib/egg/egg-toolbar-editor.c15
1 files changed, 13 insertions, 2 deletions
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