[gnome-builder/wip/chergert/layout] layout: check view count if a grid is discovered



commit 309cde642f7ef96b07347c0fd8ab05cf81fd2e97
Author: Christian Hergert <chergert redhat com>
Date:   Mon Jul 17 02:41:33 2017 -0700

    layout: check view count if a grid is discovered
    
    This can help us if we land inside a grid and there are no more
    views to focus.

 libide/layout/ide-layout-transient-sidebar.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/libide/layout/ide-layout-transient-sidebar.c b/libide/layout/ide-layout-transient-sidebar.c
index 0646f57..e1b2da8 100644
--- a/libide/layout/ide-layout-transient-sidebar.c
+++ b/libide/layout/ide-layout-transient-sidebar.c
@@ -19,6 +19,7 @@
 #define G_LOG_DOMAIN "ide-layout-transient-sidebar"
 
 #include "layout/ide-layout-stack.h"
+#include "layout/ide-layout-grid.h"
 #include "layout/ide-layout-transient-sidebar.h"
 
 typedef struct
@@ -39,6 +40,7 @@ has_view_related_focus (IdeLayoutTransientSidebar *self)
   GtkWidget *focus_view;
   GtkWidget *toplevel;
   GtkWidget *focus;
+  GtkWidget *grid;
 
   g_assert (IDE_IS_LAYOUT_TRANSIENT_SIDEBAR (self));
 
@@ -72,6 +74,14 @@ has_view_related_focus (IdeLayoutTransientSidebar *self)
   if (focus_view && focus_view != GTK_WIDGET (view))
     return FALSE;
 
+  /* If we found ourselves a grid, and it has no views in it, we shall
+   * expect that there are no more views to apply.
+   */
+  grid = gtk_widget_get_ancestor (focus, IDE_TYPE_LAYOUT_GRID);
+  if (grid != NULL &&
+      ide_layout_grid_count_views (IDE_LAYOUT_GRID (grid)) == 0)
+    return FALSE;
+
   /* Focus hasn't landed anywhere that indicates to us that the
    * view definitely isn't visible anymore, so we can just keep
    * the panel visible for now.


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