action muxer: Add some convenience api

Instead of duplicating this code in multiple places,
add an api to look up an action group for a prefixed
name, and return the unprefixed name at the same time.
This commit is contained in:
Matthias Clasen 2019-06-14 13:41:45 -04:00
parent d2a794b411
commit db7f0189dd
2 changed files with 16 additions and 0 deletions

View File

@ -166,6 +166,18 @@ gtk_action_muxer_find_group (GtkActionMuxer *muxer,
return group;
}
GActionGroup *
gtk_action_muxer_find (GtkActionMuxer *muxer,
const char *action_name,
const char **unprefixed_name)
{
Group *group;
group = gtk_action_muxer_find_group (muxer, action_name, unprefixed_name);
return group->group;
}
static void
gtk_action_muxer_action_enabled_changed (GtkActionMuxer *muxer,
const gchar *action_name,
@ -959,3 +971,4 @@ gtk_normalise_detailed_action_name (const gchar *detailed_action_name)
return action_and_target;
}

View File

@ -44,6 +44,9 @@ void gtk_action_muxer_remove (GtkActi
const gchar ** gtk_action_muxer_list_prefixes (GtkActionMuxer *muxer);
GActionGroup * gtk_action_muxer_lookup (GtkActionMuxer *muxer,
const gchar *prefix);
GActionGroup * gtk_action_muxer_find (GtkActionMuxer *muxer,
const char *action_name,
const char **unprefixed_name);
GtkActionMuxer * gtk_action_muxer_get_parent (GtkActionMuxer *muxer);
void gtk_action_muxer_set_parent (GtkActionMuxer *muxer,