[gnome-builder/wip/libide-merge] update focus upon IdeBufferManager::notify::focus-buffer



commit 800b4bc01715e5f45f295279bab4b12b80b9db42
Author: Christian Hergert <christian hergert me>
Date:   Thu Mar 19 16:06:51 2015 -0700

    update focus upon IdeBufferManager::notify::focus-buffer

 src/editor/gb-editor-workspace.c |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/src/editor/gb-editor-workspace.c b/src/editor/gb-editor-workspace.c
index 0c82659..410de2a 100644
--- a/src/editor/gb-editor-workspace.c
+++ b/src/editor/gb-editor-workspace.c
@@ -50,6 +50,29 @@ gb_editor_workspace__load_buffer_cb (GbEditorWorkspace *self,
 }
 
 static void
+gb_editor_workspace__notify_focus_buffer_cb (GbEditorWorkspace *self,
+                                             GParamSpec        *pspec,
+                                             IdeBufferManager  *buffer_manager)
+{
+  IdeBuffer *buffer;
+
+  IDE_ENTRY;
+
+  g_assert (GB_IS_EDITOR_WORKSPACE (self));
+  g_assert (IDE_IS_BUFFER_MANAGER (buffer_manager));
+
+  buffer = ide_buffer_manager_get_focus_buffer (buffer_manager);
+
+  if (buffer != NULL)
+    {
+      IDE_TRACE_MSG ("Focusing %s.", ide_buffer_get_title (buffer));
+      gb_view_grid_focus_document (self->view_grid, GB_DOCUMENT (buffer));
+    }
+
+  IDE_EXIT;
+}
+
+static void
 gb_editor_workspace_context_changed (GtkWidget  *workspace,
                                      IdeContext *context)
 {
@@ -70,6 +93,11 @@ gb_editor_workspace_context_changed (GtkWidget  *workspace,
                                G_CALLBACK (gb_editor_workspace__load_buffer_cb),
                                self,
                                G_CONNECT_SWAPPED);
+      g_signal_connect_object (bufmgr,
+                               "notify::focus-buffer",
+                               G_CALLBACK (gb_editor_workspace__notify_focus_buffer_cb),
+                               self,
+                               G_CONNECT_SWAPPED);
 
       buffers = ide_buffer_manager_get_buffers (bufmgr);
 


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