summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-02-04 12:45:07 +0100
committerMatthias Clasen <mclasen@redhat.com>2020-02-04 12:45:07 +0100
commit8d8005d892a50d2d9d005ee776f860214dca1b0e (patch)
tree92bcbb9556615422cfa46ecbc5283fa896663f94
parentb8ffe5b2452f829c45271c64743af89d38f78230 (diff)
downloadgtk+-fix-action-muxer-signals.tar.gz
actionmuxer: Don't emit signals for irrelevant changesfix-action-muxer-signals
If the action muxer has an action, there is no need to react to parent changes for that same action. Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/2398
-rw-r--r--gtk/gtkactionmuxer.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/gtk/gtkactionmuxer.c b/gtk/gtkactionmuxer.c
index 521f77e6f0..c44bbf7426 100644
--- a/gtk/gtkactionmuxer.c
+++ b/gtk/gtkactionmuxer.c
@@ -357,7 +357,8 @@ gtk_action_muxer_action_added_to_parent (GActionGroup *action_group,
{
GtkActionMuxer *muxer = user_data;
- gtk_action_muxer_action_added (muxer, action_name, action_group, action_name);
+ if (!gtk_action_muxer_find_group (muxer, action_name, NULL))
+ gtk_action_muxer_action_added (muxer, action_name, action_group, action_name);
}
static void
@@ -394,7 +395,8 @@ gtk_action_muxer_action_removed_from_parent (GActionGroup *action_group,
{
GtkActionMuxer *muxer = user_data;
- gtk_action_muxer_action_removed (muxer, action_name);
+ if (!gtk_action_muxer_find_group (muxer, action_name, NULL))
+ gtk_action_muxer_action_removed (muxer, action_name);
}
static void
@@ -1132,7 +1134,10 @@ gtk_action_muxer_set_parent (GtkActionMuxer *muxer,
actions = g_action_group_list_actions (G_ACTION_GROUP (muxer->parent));
for (it = actions; *it; it++)
- gtk_action_muxer_action_removed (muxer, *it);
+ {
+ if (!gtk_action_muxer_find (muxer, *it, NULL))
+ gtk_action_muxer_action_removed (muxer, *it);
+ }
g_strfreev (actions);
emit_changed_accels (muxer, muxer->parent);
@@ -1157,7 +1162,10 @@ gtk_action_muxer_set_parent (GtkActionMuxer *muxer,
actions = g_action_group_list_actions (G_ACTION_GROUP (muxer->parent));
for (it = actions; *it; it++)
- gtk_action_muxer_action_added (muxer, *it, G_ACTION_GROUP (muxer->parent), *it);
+ {
+ if (!gtk_action_muxer_find (muxer, *it, NULL))
+ gtk_action_muxer_action_added (muxer, *it, G_ACTION_GROUP (muxer->parent), *it);
+ }
g_strfreev (actions);
emit_changed_accels (muxer, muxer->parent);