Block the previous action when calling reset() to prevent accidental

* gtk/gtkactivatable.c (gtk_activatable_do_set_related_action):
        Block the previous action when calling reset() to prevent
        accidental activation of the previous action.

        * gtk/gtkaction.c (gtk_action_activate): Don't compare booleans.

        * gtk/gtktoggleaction.c (gtk_toggle_action_set_active): Remove
        extraneous braces.


svn path=/trunk/; revision=22225
This commit is contained in:
Matthias Clasen 2009-01-27 00:25:21 +00:00
parent b7d09a2750
commit 95caf23ddd
4 changed files with 28 additions and 7 deletions

View File

@ -1,3 +1,14 @@
2009-01-26 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkactivatable.c (gtk_activatable_do_set_related_action):
Block the previous action when calling reset() to prevent
accidental activation of the previous action.
* gtk/gtkaction.c (gtk_action_activate): Don't compare booleans.
* gtk/gtktoggleaction.c (gtk_toggle_action_set_active): Remove
extraneous braces.
2009-01-26 Bastien Nocera <hadess@hadess.net>
Bug 569240 - Crasher when using markers

View File

@ -750,8 +750,10 @@ gtk_action_activate (GtkAction *action)
{
g_return_if_fail (GTK_IS_ACTION (action));
if (action->private_data->activate_blocked == FALSE &&
gtk_action_is_sensitive (action))
if (action->private_data->activate_blocked)
return;
if (gtk_action_is_sensitive (action))
_gtk_action_emit_activate (action);
}

View File

@ -443,12 +443,16 @@ gtk_activatable_do_set_related_action (GtkActivatable *activatable,
_gtk_action_remove_from_proxy_list (prev_action, GTK_WIDGET (activatable));
g_object_unref (prev_action);
/* Some apps are using the object data directly...
* so continue to set it for a bit longer
*/
g_object_set_data (activatable, "gtk-action", NULL);
/*
* We don't want prev_action to be activated
* during the reset() call when syncing "active".
*/
gtk_action_block_activate (prev_action);
}
/* Some applications rely on their proxy UI to be set up
@ -457,6 +461,12 @@ gtk_activatable_do_set_related_action (GtkActivatable *activatable,
*/
gtk_activatable_reset (activatable, action);
if (prev_action)
{
gtk_action_unblock_activate (prev_action);
g_object_unref (prev_action);
}
if (action)
{
g_object_ref (action);

View File

@ -267,9 +267,7 @@ gtk_toggle_action_set_active (GtkToggleAction *action,
is_active = is_active != FALSE;
if (action->private_data->active != is_active)
{
_gtk_action_emit_activate (GTK_ACTION (action));
}
_gtk_action_emit_activate (GTK_ACTION (action));
}
/**