[gnome-builder] util: check GtkPopover:relative-to when walking action hierarchy



commit e1014ef6c4876556cb119aaabe3da7d37401242b
Author: Christian Hergert <chergert redhat com>
Date:   Tue Jul 5 20:42:29 2016 -0700

    util: check GtkPopover:relative-to when walking action hierarchy
    
    In our helper to activate an action, we might care more about walking the
    hierarchy via the relative-to property than our direct parent (the
    GtkWindow).

 libide/util/ide-gtk.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/libide/util/ide-gtk.c b/libide/util/ide-gtk.c
index eb79211..732fdaa 100644
--- a/libide/util/ide-gtk.c
+++ b/libide/util/ide-gtk.c
@@ -44,7 +44,22 @@ ide_widget_action (GtkWidget   *widget,
   while ((group == NULL) && (widget != NULL))
     {
       group = gtk_widget_get_action_group (widget, prefix);
-      widget = gtk_widget_get_parent (widget);
+
+      if G_UNLIKELY (GTK_IS_POPOVER (widget))
+        {
+          GtkWidget *relative_to;
+
+          relative_to = gtk_popover_get_relative_to (GTK_POPOVER (widget));
+
+          if (relative_to != NULL)
+            widget = relative_to;
+          else
+            widget = gtk_widget_get_parent (widget);
+        }
+      else
+        {
+          widget = gtk_widget_get_parent (widget);
+        }
     }
 
   if (!group && g_str_equal (prefix, "win") && G_IS_ACTION_GROUP (toplevel))


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