From 4396bbdb3c040c1f5bfc8dd24b7b5092d4cf73b4 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 13 May 2014 20:27:58 -0400 Subject: [PATCH] GtkActionMuxer: Add getters Add a way to enumerate all prefixes, and to get the action group for a prefix. https://bugzilla.gnome.org/show_bug.cgi?id=730095 --- gtk/gtkactionmuxer.c | 21 +++++++++++++++++++++ gtk/gtkactionmuxer.h | 4 +++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/gtk/gtkactionmuxer.c b/gtk/gtkactionmuxer.c index 2e48d6c28b..09cb1b3741 100644 --- a/gtk/gtkactionmuxer.c +++ b/gtk/gtkactionmuxer.c @@ -730,6 +730,26 @@ gtk_action_muxer_remove (GtkActionMuxer *muxer, } } +gchar ** +gtk_action_muxer_list_prefixes (GtkActionMuxer *muxer) +{ + return (gchar **) g_hash_table_get_keys_as_array (muxer->groups, NULL); +} + +GActionGroup * +gtk_action_muxer_lookup (GtkActionMuxer *muxer, + const gchar *prefix) +{ + Group *group; + + group = g_hash_table_lookup (muxer->groups, prefix); + + if (group != NULL) + return group->group; + + return NULL; +} + /*< private > * gtk_action_muxer_new: * @@ -906,3 +926,4 @@ gtk_print_action_and_target (const gchar *action_namespace, return g_string_free (result, FALSE); } + diff --git a/gtk/gtkactionmuxer.h b/gtk/gtkactionmuxer.h index d71abf48dd..94b7491409 100644 --- a/gtk/gtkactionmuxer.h +++ b/gtk/gtkactionmuxer.h @@ -41,7 +41,9 @@ void gtk_action_muxer_insert (GtkActi void gtk_action_muxer_remove (GtkActionMuxer *muxer, const gchar *prefix); - +gchar ** gtk_action_muxer_list_prefixes (GtkActionMuxer *muxer); +GActionGroup * gtk_action_muxer_lookup (GtkActionMuxer *muxer, + const gchar *prefix); GtkActionMuxer * gtk_action_muxer_get_parent (GtkActionMuxer *muxer); void gtk_action_muxer_set_parent (GtkActionMuxer *muxer,