[gnome-builder] egg-widget-action-group: fix signal discovery



commit 4da74cbf99c6fd2d4015395742dbcb317253c482
Author: Christian Hergert <chergert redhat com>
Date:   Tue Nov 22 15:34:13 2016 -0800

    egg-widget-action-group: fix signal discovery
    
    First off, we were looking up the wrong object (the action group, not the
    actual widget) and second, we need to walk the parent hierarchy as the
    list_ids only gives us the signals at that specific TypeNode in GObject.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=771232

 contrib/egg/egg-widget-action-group.c |   27 ++++++++++++++++-----------
 1 files changed, 16 insertions(+), 11 deletions(-)
---
diff --git a/contrib/egg/egg-widget-action-group.c b/contrib/egg/egg-widget-action-group.c
index 0e16850..33e4d1f 100644
--- a/contrib/egg/egg-widget-action-group.c
+++ b/contrib/egg/egg-widget-action-group.c
@@ -430,22 +430,27 @@ egg_widget_action_group_list_actions (GActionGroup *group)
 
   ar = g_ptr_array_new ();
 
-  if (GTK_IS_WIDGET (self->widget))
+  if (self->widget != NULL)
     {
-      g_autofree guint *signal_ids = NULL;
-      guint n_ids = 0;
-      guint i;
+      for (GType type = G_OBJECT_TYPE (self->widget);
+           type != G_TYPE_INVALID;
+           type = g_type_parent (type))
+        {
+          g_autofree guint *signal_ids = NULL;
+          guint n_ids = 0;
+          guint i;
 
-      signal_ids = g_signal_list_ids (G_OBJECT_TYPE (group), &n_ids);
+          signal_ids = g_signal_list_ids (type, &n_ids);
 
-      for (i = 0; i < n_ids; i++)
-        {
-          GSignalQuery query;
+          for (i = 0; i < n_ids; i++)
+            {
+              GSignalQuery query;
 
-          g_signal_query (signal_ids[i], &query);
+              g_signal_query (signal_ids[i], &query);
 
-          if ((query.signal_flags & G_SIGNAL_ACTION) != 0)
-            g_ptr_array_add (ar, g_strdup (query.signal_name));
+              if ((query.signal_flags & G_SIGNAL_ACTION) != 0)
+                g_ptr_array_add (ar, g_strdup (query.signal_name));
+            }
         }
     }
 


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