[gtk/matthiasc/for-master: 3/4] actionmuxer: Make it possible to enumerate local actions




commit 4bd2595421d8629dad2ed66d4656c3a62156bb29
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Oct 15 16:18:36 2020 -0400

    actionmuxer: Make it possible to enumerate local actions
    
    This will be useful for exposing actions via the
    AT-SPI Actions interface.
    
    Update all callers.

 gtk/gtkactionmuxer.c        | 6 +++++-
 gtk/gtkactionmuxerprivate.h | 3 ++-
 gtk/inspector/actions.c     | 2 +-
 3 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkactionmuxer.c b/gtk/gtkactionmuxer.c
index d10b813a0f..ed9ee26b85 100644
--- a/gtk/gtkactionmuxer.c
+++ b/gtk/gtkactionmuxer.c
@@ -224,7 +224,8 @@ gtk_action_muxer_append_group_actions (const char *prefix,
 }
 
 char **
-gtk_action_muxer_list_actions (GtkActionMuxer *muxer)
+gtk_action_muxer_list_actions (GtkActionMuxer *muxer,
+                               gboolean        local_only)
 {
   GHashTable *actions;
   char **keys;
@@ -253,6 +254,9 @@ gtk_action_muxer_list_actions (GtkActionMuxer *muxer)
           while (g_hash_table_iter_next (&iter, (gpointer *)&prefix, (gpointer *)&group))
             gtk_action_muxer_append_group_actions (prefix, group, actions);
         }
+
+      if (local_only)
+        break;
     }
 
   keys = (char **)g_hash_table_get_keys_as_array (actions, NULL);
diff --git a/gtk/gtkactionmuxerprivate.h b/gtk/gtkactionmuxerprivate.h
index cd1786b2c3..63a8f51c6c 100644
--- a/gtk/gtkactionmuxerprivate.h
+++ b/gtk/gtkactionmuxerprivate.h
@@ -81,7 +81,8 @@ void                    gtk_action_muxer_change_action_state            (GtkActi
                                                                          GVariant            *state);
 gboolean                gtk_action_muxer_has_action                     (GtkActionMuxer      *muxer,
                                                                          const char          *action_name);
-char **                 gtk_action_muxer_list_actions                   (GtkActionMuxer      *muxer);
+char **                 gtk_action_muxer_list_actions                   (GtkActionMuxer      *muxer,
+                                                                         gboolean             local_only);
 
 /* api for class actions */
 void                    gtk_action_muxer_action_enabled_changed         (GtkActionMuxer      *muxer,
diff --git a/gtk/inspector/actions.c b/gtk/inspector/actions.c
index d3797a0b2d..9c01e7475b 100644
--- a/gtk/inspector/actions.c
+++ b/gtk/inspector/actions.c
@@ -275,7 +275,7 @@ add_muxer (GtkInspectorActions *sl,
   int i;
   char **names;
 
-  names = gtk_action_muxer_list_actions (muxer);
+  names = gtk_action_muxer_list_actions (muxer, FALSE);
   for (i = 0; names[i]; i++)
     action_added (G_OBJECT (muxer), names[i], sl);
   g_strfreev (names);


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