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
This commit is contained in:
Matthias Clasen 2009-02-07 03:17:43 +00:00
parent 302cc82c71
commit 70b08f1e64
7 changed files with 29 additions and 31 deletions

View File

@ -1,3 +1,21 @@
2009-02-06 Matthias Clasen <mclasen@redhat.com>
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.
2009-02-06 Matthew Barnes <mbarnes@redhat.com>
* gtk/gtklabel.c (gtk_label_set_label): Accept a NULL string.

View File

@ -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

View File

@ -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);

View File

@ -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))
{

View File

@ -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);

View File

@ -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);

View File

@ -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