diff options
author | Felix Riemann <friemann@svn.gnome.org> | 2007-06-25 03:10:17 +0800 |
---|---|---|
committer | Felix Riemann <friemann@src.gnome.org> | 2007-06-25 03:10:17 +0800 |
commit | 03fd7c00cad8b25195c1ffd9f5026aa219811c08 (patch) | |
tree | 5bbd319ea289b0dc2160d51c71965984c25407f4 /lib | |
parent | db02570a8627588efe5ed3479573bdf48e20ba30 (diff) | |
download | gsoc2013-epiphany-03fd7c00cad8b25195c1ffd9f5026aa219811c08.tar.gz gsoc2013-epiphany-03fd7c00cad8b25195c1ffd9f5026aa219811c08.tar.zst gsoc2013-epiphany-03fd7c00cad8b25195c1ffd9f5026aa219811c08.zip |
Cleanups to my last commit. Fixes bug 450590 (Felix Riemann, Jaap Haitsma)
2007-06-24 Felix Riemann <friemann@svn.gnome.org>
* lib/egg/egg-toolbar-editor.c: (editor_create_item_from_name):
Cleanups to my last commit.
Fixes bug 450590 (Felix Riemann, Jaap Haitsma)
svn path=/trunk/; revision=7094
Diffstat (limited to 'lib')
-rw-r--r-- | lib/egg/egg-toolbar-editor.c | 43 |
1 files changed, 15 insertions, 28 deletions
diff --git a/lib/egg/egg-toolbar-editor.c b/lib/egg/egg-toolbar-editor.c index a74cbf94a..b08a97b26 100644 --- a/lib/egg/egg-toolbar-editor.c +++ b/lib/egg/egg-toolbar-editor.c @@ -434,8 +434,7 @@ editor_create_item_from_name (EggToolbarEditor *editor, { GtkWidget *item; const char *item_name; - const char *stock_id; - const char *short_label; + char *short_label; const char *collate_key; if (strcmp (name, "_separator") == 0) @@ -444,54 +443,42 @@ editor_create_item_from_name (EggToolbarEditor *editor, icon = _egg_editable_toolbar_new_separator_image (); short_label = _("Separator"); - item_name = strdup (name); + item_name = g_strdup (name); collate_key = g_utf8_collate_key (short_label, -1); item = editor_create_item (editor, GTK_IMAGE (icon), short_label, drag_action); } else { - GValue value = { 0, }; GtkAction *action; GtkWidget *icon; - gboolean is_named = FALSE; + char *stock_id, *icon_name = NULL; 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), "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; - } + g_object_get (action, + "icon-name", &icon_name, + "stock-id", &stock_id, + "short-label", &short_label, + NULL); /* This is a workaround to catch named icons. */ - if (is_named) - icon = gtk_image_new_from_icon_name (stock_id, + if (icon_name) + icon = gtk_image_new_from_icon_name (icon_name, 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); - g_object_get_property (G_OBJECT (action), "short_label", &value); - short_label = g_value_get_string (&value); - - item_name = strdup (name); + item_name = g_strdup (name); collate_key = g_utf8_collate_key (short_label, -1); item = editor_create_item (editor, GTK_IMAGE (icon), short_label, drag_action); - g_value_unset (&value); + + g_free (short_label); + g_free (stock_id); + g_free (icon_name); } g_object_set_data_full (G_OBJECT (item), "egg-collate-key", |