Fallback from stock ids to icon names like the old GtkAction code did
svn path=/trunk/; revision=22210
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
2009-01-24 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtktoolbutton.c (gtk_tool_button_activatable_reset):
|
||||||
|
Fall back from stock ids to icon names like the old code
|
||||||
|
did. Patch by Tristan van Berkom.
|
||||||
|
|
||||||
2009-01-24 Matthias Clasen <mclasen@redhat.com>
|
2009-01-24 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* tests/testactions.c: Add a testcase for toolitems using
|
* tests/testactions.c: Add a testcase for toolitems using
|
||||||
|
@ -772,6 +772,7 @@ gtk_tool_button_activatable_update (GtkActivatable *activatable,
|
|||||||
gtk_tool_button_set_label (button, NULL);
|
gtk_tool_button_set_label (button, NULL);
|
||||||
gtk_tool_button_set_icon_name (button, NULL);
|
gtk_tool_button_set_icon_name (button, NULL);
|
||||||
}
|
}
|
||||||
|
gtk_tool_button_set_icon_widget (button, NULL);
|
||||||
gtk_tool_button_set_stock_id (button, gtk_action_get_stock_id (action));
|
gtk_tool_button_set_stock_id (button, gtk_action_get_stock_id (action));
|
||||||
}
|
}
|
||||||
else if (strcmp (property_name, "gicon") == 0)
|
else if (strcmp (property_name, "gicon") == 0)
|
||||||
@ -812,6 +813,7 @@ gtk_tool_button_activatable_reset (GtkActivatable *activatable,
|
|||||||
{
|
{
|
||||||
GtkToolButton *button;
|
GtkToolButton *button;
|
||||||
GIcon *icon;
|
GIcon *icon;
|
||||||
|
const gchar *stock_id;
|
||||||
|
|
||||||
parent_activatable_iface->reset (activatable, action);
|
parent_activatable_iface->reset (activatable, action);
|
||||||
|
|
||||||
@ -822,14 +824,15 @@ gtk_tool_button_activatable_reset (GtkActivatable *activatable,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
button = GTK_TOOL_BUTTON (activatable);
|
button = GTK_TOOL_BUTTON (activatable);
|
||||||
|
stock_id = gtk_action_get_stock_id (action);
|
||||||
gtk_tool_button_set_label (button, NULL);
|
|
||||||
gtk_tool_button_set_stock_id (button, NULL);
|
gtk_tool_button_set_label (button, gtk_action_get_short_label (action));
|
||||||
gtk_tool_button_set_icon_name (button, NULL);
|
|
||||||
gtk_tool_button_set_use_underline (button, TRUE);
|
gtk_tool_button_set_use_underline (button, TRUE);
|
||||||
|
gtk_tool_button_set_stock_id (button, stock_id);
|
||||||
if (gtk_action_get_stock_id (action))
|
gtk_tool_button_set_icon_name (button, gtk_action_get_icon_name (action));
|
||||||
gtk_tool_button_set_stock_id (button, gtk_action_get_stock_id (action));
|
|
||||||
|
if (stock_id && gtk_icon_factory_lookup_default (stock_id))
|
||||||
|
gtk_tool_button_set_icon_widget (button, NULL);
|
||||||
else if ((icon = gtk_action_get_gicon (action)) != NULL)
|
else if ((icon = gtk_action_get_gicon (action)) != NULL)
|
||||||
{
|
{
|
||||||
GtkIconSize icon_size = gtk_tool_item_get_icon_size (GTK_TOOL_ITEM (button));
|
GtkIconSize icon_size = gtk_tool_item_get_icon_size (GTK_TOOL_ITEM (button));
|
||||||
|
Reference in New Issue
Block a user