[gtk/wip/chergert/gdk-macos-for-master: 10/11] muxer: add helper to get group by name




commit b68e0bb3fb6148dfa7a4f7cbc827c4392b08116a
Author: Christian Hergert <chergert redhat com>
Date:   Wed Dec 2 19:41:16 2020 -0800

    muxer: add helper to get group by name
    
    This is useful when you need to read a group back out of the muxer.

 gtk/gtkactionmuxer.c        | 13 +++++++++++++
 gtk/gtkactionmuxerprivate.h |  2 ++
 2 files changed, 15 insertions(+)
---
diff --git a/gtk/gtkactionmuxer.c b/gtk/gtkactionmuxer.c
index ed9ee26b85..fad926ceaf 100644
--- a/gtk/gtkactionmuxer.c
+++ b/gtk/gtkactionmuxer.c
@@ -315,6 +315,19 @@ gtk_action_muxer_find (GtkActionMuxer  *muxer,
   return NULL;
 }
 
+GActionGroup *
+gtk_action_muxer_get_group (GtkActionMuxer *muxer,
+                            const char     *group_name)
+{
+  Group *group;
+
+  group = g_hash_table_lookup (muxer->groups, group_name);
+  if (group)
+    return group->group;
+
+  return NULL;
+}
+
 static inline Action *
 find_observers (GtkActionMuxer *muxer,
                 const char     *action_name)
diff --git a/gtk/gtkactionmuxerprivate.h b/gtk/gtkactionmuxerprivate.h
index 63a8f51c6c..db69cabc9d 100644
--- a/gtk/gtkactionmuxerprivate.h
+++ b/gtk/gtkactionmuxerprivate.h
@@ -60,6 +60,8 @@ void                    gtk_action_muxer_remove                         (GtkActi
 GActionGroup *          gtk_action_muxer_find                           (GtkActionMuxer *muxer,
                                                                          const char     *action_name,
                                                                          const char    **unprefixed_name);
+GActionGroup *          gtk_action_muxer_get_group                      (GtkActionMuxer *muxer,
+                                                                         const char     *group_name);
 GtkActionMuxer *        gtk_action_muxer_get_parent                     (GtkActionMuxer *muxer);
 
 void                    gtk_action_muxer_set_parent                     (GtkActionMuxer *muxer,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]