Initial action state can be incorrectly applied to GtkButton
In GNOME Text Editor, I have some code (about to push) to ensure our initial action state for a "zoom-to-1" action is disabled if at 100%. That is correctly disabled yet the button to activate it from a Popover remains sensitive even though the action is disabled.
I tracked this down to at least something in gtkactionhelper.c
.
This is obviously the wrong change but "fixes" the initial disabled state.
diff --git a/gtk/gtkactionhelper.c b/gtk/gtkactionhelper.c
index 722fb10fe9..e8e6576903 100644
--- a/gtk/gtkactionhelper.c
+++ b/gtk/gtkactionhelper.c
@@ -222,13 +222,17 @@ static void
gtk_action_helper_action_enabled_changed (GtkActionHelper *helper,
gboolean enabled)
{
- GTK_DEBUG (ACTIONS, "%s: action %s: enabled changed to %d", "actionhelper", helper->action_name, enabled);
+ GTK_DEBUG (ACTIONS, "%s: action %s: enabled changed to %d (can_activate=%d was_enabled=%d)", "actionhelper",
+ helper->action_name, enabled, helper->can_activate, helper->enabled);
if (!helper->can_activate)
return;
if (helper->enabled == enabled)
+ {
+ gtk_action_helper_report_change (helper, PROP_ENABLED);
return;
+ }
helper->enabled = enabled;
gtk_action_helper_report_change (helper, PROP_ENABLED);