diff options
author | Matthias Clasen <matthiasc@src.gnome.org> | 2009-02-07 03:17:43 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2009-02-07 03:17:43 +0000 |
commit | 70b08f1e644612a81ff2f875502be92b596da8c0 (patch) | |
tree | ac9f4fd5a86e9b66b7f4248d79f248090a7ae337 /gtk | |
parent | 302cc82c71a1f5d17f9149cff3b90cf6113ac03c (diff) | |
download | gtk+-70b08f1e644612a81ff2f875502be92b596da8c0.tar.gz |
Make the new GtkAction code work with PolicyKit-gnome's use of actions.
* gtk/gtkaction.c (gtk_action_[un]block_activate_from): Block
the action.
* gtk/gtkcheckmenuitem.c (gtk_check_menu_item_activatable_reset):
* gtk/gtktogglebutton. (gtk_toggle_button_activatable_reset):
* gtk/gtktoggletoolbutton.c (gtk_toggle_tool_button_activatable_reset):
Work with non-toggle actions without complaining.
* gtk/gtktoolbutton.c (gtk_tool_button_activatable_update): Updating
the icon-name should not remove the label.
* gtk/gtkimagemenuitem.c (activatable_update_icon_name): Also
update the image when the icon name is set to NULL.
svn path=/trunk/; revision=22290
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkaction.c | 6 | ||||
-rw-r--r-- | gtk/gtkcheckmenuitem.c | 2 | ||||
-rw-r--r-- | gtk/gtkimagemenuitem.c | 2 | ||||
-rw-r--r-- | gtk/gtktogglebutton.c | 2 | ||||
-rw-r--r-- | gtk/gtktoggletoolbutton.c | 2 | ||||
-rw-r--r-- | gtk/gtktoolbutton.c | 28 |
6 files changed, 11 insertions, 31 deletions
diff --git a/gtk/gtkaction.c b/gtk/gtkaction.c index 37f6e92548..f1e2788e08 100644 --- a/gtk/gtkaction.c +++ b/gtk/gtkaction.c @@ -1509,8 +1509,6 @@ gtk_action_set_icon_name (GtkAction *action, g_return_if_fail (GTK_IS_ACTION (action)); - g_return_if_fail (GTK_IS_ACTION (action)); - tmp = action->private_data->icon_name; action->private_data->icon_name = g_strdup (icon_name); g_free (tmp); @@ -1604,6 +1602,8 @@ gtk_action_block_activate_from (GtkAction *action, g_signal_handlers_block_by_func (proxy, G_CALLBACK (gtk_action_activate), action); + + gtk_action_block_activate (action); } /** @@ -1630,6 +1630,8 @@ gtk_action_unblock_activate_from (GtkAction *action, g_signal_handlers_unblock_by_func (proxy, G_CALLBACK (gtk_action_activate), action); + + gtk_action_unblock_activate (action); } static void diff --git a/gtk/gtkcheckmenuitem.c b/gtk/gtkcheckmenuitem.c index e65370b0f1..1bfc26b769 100644 --- a/gtk/gtkcheckmenuitem.c +++ b/gtk/gtkcheckmenuitem.c @@ -188,7 +188,7 @@ gtk_check_menu_item_activatable_reset (GtkActivatable *activatable, parent_activatable_iface->reset (activatable, action); - if (!action) + if (!GTK_IS_TOGGLE_ACTION (action)) return; gtk_action_block_activate (action); diff --git a/gtk/gtkimagemenuitem.c b/gtk/gtkimagemenuitem.c index a7bc429987..04cc352ff8 100644 --- a/gtk/gtkimagemenuitem.c +++ b/gtk/gtkimagemenuitem.c @@ -601,7 +601,7 @@ activatable_update_icon_name (GtkImageMenuItem *image_menu_item, GtkAction *acti image = gtk_image_menu_item_get_image (image_menu_item); - if (GTK_IS_IMAGE (image) && icon_name && + if (GTK_IS_IMAGE (image) && (gtk_image_get_storage_type (GTK_IMAGE (image)) == GTK_IMAGE_EMPTY || gtk_image_get_storage_type (GTK_IMAGE (image)) == GTK_IMAGE_ICON_NAME)) { diff --git a/gtk/gtktogglebutton.c b/gtk/gtktogglebutton.c index de6bb053e2..6526f82fe2 100644 --- a/gtk/gtktogglebutton.c +++ b/gtk/gtktogglebutton.c @@ -188,7 +188,7 @@ gtk_toggle_button_activatable_reset (GtkActivatable *activatable, parent_activatable_iface->reset (activatable, action); - if (!action) + if (!GTK_IS_TOGGLE_ACTION (action)) return; button = GTK_TOGGLE_BUTTON (activatable); diff --git a/gtk/gtktoggletoolbutton.c b/gtk/gtktoggletoolbutton.c index 062a2d0820..4d1e2a9cfd 100644 --- a/gtk/gtktoggletoolbutton.c +++ b/gtk/gtktoggletoolbutton.c @@ -346,7 +346,7 @@ gtk_toggle_tool_button_activatable_reset (GtkActivatable *activatable, parent_activatable_iface->reset (activatable, action); - if (!action) + if (!GTK_IS_TOGGLE_ACTION (action)) return; button = GTK_TOGGLE_TOOL_BUTTON (activatable); diff --git a/gtk/gtktoolbutton.c b/gtk/gtktoolbutton.c index c99169a22e..2f7d8f1bf4 100644 --- a/gtk/gtktoolbutton.c +++ b/gtk/gtktoolbutton.c @@ -760,24 +760,9 @@ gtk_tool_button_activatable_update (GtkActivatable *activatable, button = GTK_TOOL_BUTTON (activatable); if (strcmp (property_name, "short-label") == 0) - { - if (!gtk_action_get_stock_id (action) && - !gtk_action_get_icon_name (action)) - { - gtk_tool_button_set_use_underline (button, TRUE); - gtk_tool_button_set_label (button, gtk_action_get_short_label (action)); - } - } + gtk_tool_button_set_label (button, gtk_action_get_short_label (action)); else if (strcmp (property_name, "stock-id") == 0) - { - if (gtk_action_get_stock_id (action)) - { - gtk_tool_button_set_label (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) { const gchar *stock_id = gtk_action_get_stock_id (action); @@ -800,14 +785,7 @@ gtk_tool_button_activatable_update (GtkActivatable *activatable, } else if (strcmp (property_name, "icon-name") == 0) - { - if (gtk_action_get_icon_name (action)) - { - gtk_tool_button_set_label (button, NULL); - gtk_tool_button_set_stock_id (button, NULL); - } - gtk_tool_button_set_icon_name (button, gtk_action_get_icon_name (action)); - } + gtk_tool_button_set_icon_name (button, gtk_action_get_icon_name (action)); } static void |