[gnome-builder] view-grid: return first stack if no stack has been focused



commit 5dbda51c60b7603876cc7ba2ce45f0fd7be23c39
Author: Christian Hergert <christian hergert me>
Date:   Thu Jun 18 13:58:29 2015 -0700

    view-grid: return first stack if no stack has been focused
    
    If we haven't yet focused a stack, or we lost our last focused stack,
    return the first stack child.
    
    Fixes ctrl+shift+t for terminal with project-tree focused and no view.

 src/views/gb-view-grid.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/src/views/gb-view-grid.c b/src/views/gb-view-grid.c
index ee434ff..8189f33 100644
--- a/src/views/gb-view-grid.c
+++ b/src/views/gb-view-grid.c
@@ -898,7 +898,17 @@ gb_view_grid_find_document_typed (GbViewGrid *self,
 GtkWidget *
 gb_view_grid_get_last_focus (GbViewGrid *self)
 {
+  GtkWidget *ret = NULL;
+  GList *list;
+
   g_return_val_if_fail (GB_IS_VIEW_GRID (self), NULL);
 
-  return GTK_WIDGET (self->last_focus);
+  if (self->last_focus != NULL)
+    return GTK_WIDGET (self->last_focus);
+
+  list = gb_view_grid_get_stacks (self);
+  ret = list ? list->data : NULL;
+  g_list_free (list);
+
+  return ret;
 }


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