From 8a763ca49d386e4c808b040d8138783916872964 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 20 Jun 2006 18:01:23 +0000 Subject: [PATCH] Fix handling of stock items without icons in action-based ui. (#342458, 2006-06-20 Matthias Clasen Fix handling of stock items without icons in action-based ui. (#342458, Callum McKenzie) * gtk/gtkactiongroup.c (gtk_action_group_add_actions_full): Set the stock id even if there is no icon for it. * gtk/gtkaction.c (connect_proxy): * gtk/gtktoolbutton.c (gtk_tool_button_construct_contents): Only construct a stock icon if the stock item has an icon. --- ChangeLog | 12 ++++++++++++ ChangeLog.pre-2-10 | 12 ++++++++++++ gtk/gtkaction.c | 4 +++- gtk/gtkactiongroup.c | 6 +++--- gtk/gtktoolbutton.c | 3 ++- 5 files changed, 32 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3cb6e41e79..d2dfab3777 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2006-06-20 Matthias Clasen + + Fix handling of stock items without icons in action-based + ui. (#342458, Callum McKenzie) + + * gtk/gtkactiongroup.c (gtk_action_group_add_actions_full): Set + the stock id even if there is no icon for it. + + * gtk/gtkaction.c (connect_proxy): + * gtk/gtktoolbutton.c (gtk_tool_button_construct_contents): Only + construct a stock icon if the stock item has an icon. + 2006-06-20 Matthias Clasen * gtk/gtktreeview.c (gtk_tree_view_set_column_drag_info): Better diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 3cb6e41e79..d2dfab3777 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,15 @@ +2006-06-20 Matthias Clasen + + Fix handling of stock items without icons in action-based + ui. (#342458, Callum McKenzie) + + * gtk/gtkactiongroup.c (gtk_action_group_add_actions_full): Set + the stock id even if there is no icon for it. + + * gtk/gtkaction.c (connect_proxy): + * gtk/gtktoolbutton.c (gtk_tool_button_construct_contents): Only + construct a stock icon if the stock item has an icon. + 2006-06-20 Matthias Clasen * gtk/gtktreeview.c (gtk_tree_view_set_column_drag_info): Better diff --git a/gtk/gtkaction.c b/gtk/gtkaction.c index afc80780ae..6822e5f5cf 100644 --- a/gtk/gtkaction.c +++ b/gtk/gtkaction.c @@ -712,7 +712,9 @@ connect_proxy (GtkAction *action, image); gtk_widget_show (image); } - if (action->private_data->stock_id) + + if (action->private_data->stock_id && + gtk_icon_factory_lookup_default (action->private_data->stock_id)) gtk_image_set_from_stock (GTK_IMAGE (image), action->private_data->stock_id, GTK_ICON_SIZE_MENU); else if (action->private_data->icon_name) diff --git a/gtk/gtkactiongroup.c b/gtk/gtkactiongroup.c index dfa48f7461..7b7bd6b7f6 100644 --- a/gtk/gtkactiongroup.c +++ b/gtk/gtkactiongroup.c @@ -782,9 +782,9 @@ gtk_action_group_add_actions_full (GtkActionGroup *action_group, if (entries[i].stock_id) { - if (gtk_icon_factory_lookup_default (entries[i].stock_id)) - g_object_set (action, "stock-id", entries[i].stock_id, NULL); - else + g_object_set (action, "stock-id", entries[i].stock_id, NULL); + if (gtk_icon_theme_has_icon (gtk_icon_theme_get_default (), + entries[i].stock_id)) g_object_set (action, "icon-name", entries[i].stock_id, NULL); } diff --git a/gtk/gtktoolbutton.c b/gtk/gtktoolbutton.c index ae9c7ad550..5c7ff4daf1 100644 --- a/gtk/gtktoolbutton.c +++ b/gtk/gtktoolbutton.c @@ -405,7 +405,8 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item) NULL); } } - else if (button->priv->stock_id) + else if (button->priv->stock_id && + gtk_icon_factory_lookup_default (button->priv->stock_id)) { icon = gtk_image_new_from_stock (button->priv->stock_id, icon_size); gtk_widget_show (icon);