diff options
author | Matthias Clasen <mclasen@redhat.com> | 2006-03-13 05:11:23 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2006-03-13 05:11:23 +0000 |
commit | fe7a5ebb7b656dbd64f91682aecd4a86abc41d75 (patch) | |
tree | 905c5249839a9473d87ee55db088dd156f8dde80 /gtk/gtkactiongroup.c | |
parent | a83b61586373281f4c1ce3013848b0ee28a92c21 (diff) | |
download | gtk+-fe7a5ebb7b656dbd64f91682aecd4a86abc41d75.tar.gz |
Make actions work with named icons. (#323484, Jorn Baayen)
2006-03-13 Matthias Clasen <mclasen@redhat.com>
Make actions work with named icons. (#323484, Jorn Baayen)
* gtk/gtkactiongroup.c: If the stock-id field of a GtkActionEntry
does not contain a registered stock id, interpret it as an
icon name.
* gtk/gtkaction.c: Add an icon-name property to actions and
use it for icons if a stock-id is not specified.
Diffstat (limited to 'gtk/gtkactiongroup.c')
-rw-r--r-- | gtk/gtkactiongroup.c | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/gtk/gtkactiongroup.c b/gtk/gtkactiongroup.c index a1985809e2..a6a40446c7 100644 --- a/gtk/gtkactiongroup.c +++ b/gtk/gtkactiongroup.c @@ -777,8 +777,18 @@ gtk_action_group_add_actions_full (GtkActionGroup *action_group, action = gtk_action_new (entries[i].name, label, tooltip, - entries[i].stock_id); + NULL); + if (entries[i].stock_id) + { + GtkStockItem item; + + if (gtk_stock_lookup (entries[i].stock_id, &item)) + g_object_set (action, "stock-id", entries[i].stock_id, NULL); + else + g_object_set (action, "icon-name", entries[i].stock_id, NULL); + } + if (entries[i].callback) { GClosure *closure; @@ -873,7 +883,17 @@ gtk_action_group_add_toggle_actions_full (GtkActionGroup *action_gro action = gtk_toggle_action_new (entries[i].name, label, tooltip, - entries[i].stock_id); + NULL); + + if (entries[i].stock_id) + { + GtkStockItem item; + + if (gtk_stock_lookup (entries[i].stock_id, &item)) + g_object_set (action, "stock-id", entries[i].stock_id, NULL); + else + g_object_set (action, "icon-name", entries[i].stock_id, NULL); + } gtk_toggle_action_set_active (action, entries[i].is_active); @@ -977,9 +997,19 @@ gtk_action_group_add_radio_actions_full (GtkActionGroup *action_group action = gtk_radio_action_new (entries[i].name, label, tooltip, - entries[i].stock_id, + NULL, entries[i].value); + if (entries[i].stock_id) + { + GtkStockItem item; + + if (gtk_stock_lookup (entries[i].stock_id, &item)) + g_object_set (action, "stock-id", entries[i].stock_id, NULL); + else + g_object_set (action, "icon-name", entries[i].stock_id, NULL); + } + if (i == 0) first_action = action; |