diff options
author | Matthias Clasen <mclasen@redhat.com> | 2019-06-22 22:51:23 +0000 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2019-06-22 22:51:23 +0000 |
commit | ad4a81e9dfbe5caa444561372767dc90f3fb279e (patch) | |
tree | b91674e84ed014ec373e02fb41fed03000151973 | |
parent | 95e5472ade765eae852f2fc6106fd22f30e3bf11 (diff) | |
download | gtk+-ad4a81e9dfbe5caa444561372767dc90f3fb279e.tar.gz |
action muxer: Change inheritance
Previously, we would not look any further for
an action once we found a match for the prefix,
defining inheritance by groups. Change this to
inheritance for individual actions, since we
are moving towards individual actions as the
main ingredient in GTKs action support.
-rw-r--r-- | gtk/gtkactionmuxer.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/gtk/gtkactionmuxer.c b/gtk/gtkactionmuxer.c index 8810ffb921..b752ea08e7 100644 --- a/gtk/gtkactionmuxer.c +++ b/gtk/gtkactionmuxer.c @@ -174,6 +174,7 @@ gtk_action_muxer_find_group (GtkActionMuxer *muxer, { const gchar *dot; gchar *prefix; + const char *name; Group *group; dot = strchr (full_name, '.'); @@ -181,14 +182,20 @@ gtk_action_muxer_find_group (GtkActionMuxer *muxer, if (!dot) return NULL; + name = dot + 1; + prefix = g_strndup (full_name, dot - full_name); group = g_hash_table_lookup (muxer->groups, prefix); g_free (prefix); if (action_name) - *action_name = dot + 1; + *action_name = name; + + if (group && + g_action_group_has_action (group->group, name)) + return group; - return group; + return NULL; } GActionGroup * @@ -199,8 +206,10 @@ gtk_action_muxer_find (GtkActionMuxer *muxer, Group *group; group = gtk_action_muxer_find_group (muxer, action_name, unprefixed_name); + if (group) + return group->group; - return group->group; + return NULL; } void |