[gnome-builder] editor-workspace: check popover parent when determining sidebar focus



commit be6e59e47b07c8c859a0cfee4ff5ef4c5995f571
Author: Christian Hergert <christian hergert me>
Date:   Mon Apr 13 20:29:45 2015 -0700

    editor-workspace: check popover parent when determining sidebar focus

 src/editor/gb-editor-workspace.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/src/editor/gb-editor-workspace.c b/src/editor/gb-editor-workspace.c
index c1b3965..7870570 100644
--- a/src/editor/gb-editor-workspace.c
+++ b/src/editor/gb-editor-workspace.c
@@ -160,13 +160,21 @@ gb_editor_workspace__toplevel_set_focus (GbEditorWorkspace *self,
   g_assert (GB_IS_WORKBENCH (workbench));
 
   style_context = gtk_widget_get_style_context (GTK_WIDGET (self->project_sidebar_header));
+  gtk_style_context_remove_class (style_context, "focused");
 
-  if ((focus != NULL) &&
-      (gtk_widget_is_ancestor (focus, GTK_WIDGET (self->project_sidebar)) ||
-       gtk_widget_is_ancestor (focus, GTK_WIDGET (self->project_popover))))
-    gtk_style_context_add_class (style_context, "focused");
-  else
-    gtk_style_context_remove_class (style_context, "focused");
+  while (focus != NULL)
+    {
+      if (focus == GTK_WIDGET (self->project_sidebar))
+        {
+          gtk_style_context_add_class (style_context, "focused");
+          break;
+        }
+
+      if (GTK_IS_POPOVER (focus))
+        focus = gtk_popover_get_relative_to (GTK_POPOVER (focus));
+      else
+        focus = gtk_widget_get_parent (focus);
+    }
 }
 
 static void


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