[gnome-builder/wip/libide-merge] libide: update buffer focus when loading a file



commit cbc3d7a452750de706b97c1280b10e683b179647
Author: Christian Hergert <christian hergert me>
Date:   Thu Mar 19 16:06:01 2015 -0700

    libide: update buffer focus when loading a file

 libide/ide-buffer-manager.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/libide/ide-buffer-manager.c b/libide/ide-buffer-manager.c
index 39bdbcf..e652f4b 100644
--- a/libide/ide-buffer-manager.c
+++ b/libide/ide-buffer-manager.c
@@ -277,6 +277,8 @@ ide_buffer_manager_set_focus_buffer (IdeBufferManager *self,
       /* notify of the new buffer, but check for reentrancy */
       if (buffer && (buffer == self->focus_buffer))
         g_signal_emit (self, gSignals [BUFFER_FOCUS_ENTER], 0, buffer);
+
+      g_object_notify_by_pspec (G_OBJECT (self), gParamSpecs [PROP_FOCUS_BUFFER]);
     }
 }
 
@@ -487,6 +489,7 @@ ide_buffer_manager_load_file__load_cb (GObject      *object,
 emit_signal:
   _ide_buffer_set_loading (state->buffer, FALSE);
 
+  ide_buffer_manager_set_focus_buffer (self, state->buffer);
   g_signal_emit (self, gSignals [BUFFER_LOADED], 0, state->buffer);
 
   g_task_return_pointer (task, g_object_ref (state->buffer), g_object_unref);
@@ -653,6 +656,7 @@ ide_buffer_manager_load_file_async (IdeBufferManager     *self,
                                   "fraction", 1.0,
                                   NULL);
       g_task_return_pointer (task, g_object_ref (buffer), g_object_unref);
+      ide_buffer_manager_set_focus_buffer (self, buffer);
       IDE_EXIT;
     }
 
@@ -1000,6 +1004,10 @@ ide_buffer_manager_get_property (GObject    *object,
       g_value_set_uint (value, ide_buffer_manager_get_auto_save_timeout (self));
       break;
 
+    case PROP_FOCUS_BUFFER:
+      g_value_set_object (value, ide_buffer_manager_get_focus_buffer (self));
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
     }
@@ -1023,6 +1031,10 @@ ide_buffer_manager_set_property (GObject      *object,
       ide_buffer_manager_set_auto_save_timeout (self, g_value_get_uint (value));
       break;
 
+    case PROP_FOCUS_BUFFER:
+      ide_buffer_manager_set_focus_buffer (self, g_value_get_object (value));
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
     }
@@ -1058,6 +1070,15 @@ ide_buffer_manager_class_init (IdeBufferManagerClass *klass)
   g_object_class_install_property (object_class, PROP_AUTO_SAVE_TIMEOUT,
                                    gParamSpecs [PROP_AUTO_SAVE_TIMEOUT]);
 
+  gParamSpecs [PROP_FOCUS_BUFFER] =
+    g_param_spec_object ("focus-buffer",
+                         _("Focus Buffer"),
+                         _("The currently focused buffer."),
+                         IDE_TYPE_BUFFER,
+                         (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (object_class, PROP_FOCUS_BUFFER,
+                                   gParamSpecs [PROP_FOCUS_BUFFER]);
+
   /**
    * IdeBufferManager::create-buffer:
    * @self: An #IdeBufferManager


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