[gnome-builder] GbDocumentGrid: focus stack to left upon close



commit 669b471513c52343ee46a8f99ea6f895c321cefa
Author: Christian Hergert <christian hergert me>
Date:   Mon Dec 8 15:36:58 2014 -0800

    GbDocumentGrid: focus stack to left upon close
    
    If no stack is left of the stack being released, take it's first right
    neighbor.

 src/documents/gb-document-grid.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/src/documents/gb-document-grid.c b/src/documents/gb-document-grid.c
index 1b25730..49616a4 100644
--- a/src/documents/gb-document-grid.c
+++ b/src/documents/gb-document-grid.c
@@ -85,6 +85,7 @@ static void
 gb_document_grid_remove_stack (GbDocumentGrid  *grid,
                                GbDocumentStack *stack)
 {
+  GtkWidget *new_focus;
   GList *stacks;
   GList *iter;
 
@@ -97,6 +98,10 @@ gb_document_grid_remove_stack (GbDocumentGrid  *grid,
   if (g_list_length (stacks) == 1)
     return;
 
+  new_focus = gb_document_grid_get_stack_before (grid, stack);
+  if (!new_focus)
+    new_focus = gb_document_grid_get_stack_after (grid, stack);
+
   for (iter = stacks; iter; iter = iter->next)
     {
       GbDocumentStack *item = GB_DOCUMENT_STACK (iter->data);
@@ -164,6 +169,9 @@ gb_document_grid_remove_stack (GbDocumentGrid  *grid,
         }
     }
 
+  if (new_focus)
+    gtk_widget_grab_focus (new_focus);
+
   g_list_free (stacks);
 }
 


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