mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 02:40:11 +00:00
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.
This commit is contained in:
parent
95e5472ade
commit
ad4a81e9df
@ -174,6 +174,7 @@ gtk_action_muxer_find_group (GtkActionMuxer *muxer,
|
|||||||
{
|
{
|
||||||
const gchar *dot;
|
const gchar *dot;
|
||||||
gchar *prefix;
|
gchar *prefix;
|
||||||
|
const char *name;
|
||||||
Group *group;
|
Group *group;
|
||||||
|
|
||||||
dot = strchr (full_name, '.');
|
dot = strchr (full_name, '.');
|
||||||
@ -181,14 +182,20 @@ gtk_action_muxer_find_group (GtkActionMuxer *muxer,
|
|||||||
if (!dot)
|
if (!dot)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
name = dot + 1;
|
||||||
|
|
||||||
prefix = g_strndup (full_name, dot - full_name);
|
prefix = g_strndup (full_name, dot - full_name);
|
||||||
group = g_hash_table_lookup (muxer->groups, prefix);
|
group = g_hash_table_lookup (muxer->groups, prefix);
|
||||||
g_free (prefix);
|
g_free (prefix);
|
||||||
|
|
||||||
if (action_name)
|
if (action_name)
|
||||||
*action_name = dot + 1;
|
*action_name = name;
|
||||||
|
|
||||||
return group;
|
if (group &&
|
||||||
|
g_action_group_has_action (group->group, name))
|
||||||
|
return group;
|
||||||
|
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
GActionGroup *
|
GActionGroup *
|
||||||
@ -199,8 +206,10 @@ gtk_action_muxer_find (GtkActionMuxer *muxer,
|
|||||||
Group *group;
|
Group *group;
|
||||||
|
|
||||||
group = gtk_action_muxer_find_group (muxer, action_name, unprefixed_name);
|
group = gtk_action_muxer_find_group (muxer, action_name, unprefixed_name);
|
||||||
|
if (group)
|
||||||
|
return group->group;
|
||||||
|
|
||||||
return group->group;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user