[gnome-builder] buffer: add IdeBuffer::destroy



commit bef2e498866474abd6fb330bf544078937e5c64a
Author: Christian Hergert <chergert redhat com>
Date:   Fri May 13 15:39:35 2016 +0300

    buffer: add IdeBuffer::destroy
    
    This signal can be used to opportunistically release resources associated
    with buffer, as it is being released by the buffer manager.
    
    For example, this would be a good time to evict the cache.

 libide/ide-buffer-manager.c |    1 +
 libide/ide-buffer.c         |   13 +++++++++++++
 2 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/libide/ide-buffer-manager.c b/libide/ide-buffer-manager.c
index 6a52ea8..0b1f690 100644
--- a/libide/ide-buffer-manager.c
+++ b/libide/ide-buffer-manager.c
@@ -411,6 +411,7 @@ ide_buffer_manager_remove_buffer (IdeBufferManager *self,
    *
    * https://bugzilla.gnome.org/show_bug.cgi?id=766322
    */
+  g_signal_emit_by_name (buffer, "destroy");
   g_object_run_dispose (G_OBJECT (buffer));
 
   g_object_unref (buffer);
diff --git a/libide/ide-buffer.c b/libide/ide-buffer.c
index ca90f06..10a52b1 100644
--- a/libide/ide-buffer.c
+++ b/libide/ide-buffer.c
@@ -118,6 +118,7 @@ enum {
 
 enum {
   CURSOR_MOVED,
+  DESTROY,
   LINE_FLAGS_CHANGED,
   LOADED,
   SAVED,
@@ -1434,6 +1435,18 @@ ide_buffer_class_init (IdeBufferClass *klass)
                   0);
 
   /**
+   * IdeBuffer::destroy:
+   *
+   * This signal is emitted when the buffer should be destroyed, as the
+   * #IdeBufferManager has reclaimed the buffer.
+   */
+  signals [DESTROY] =
+    g_signal_new ("destroy",
+                  G_TYPE_FROM_CLASS (klass),
+                  G_SIGNAL_RUN_LAST,
+                  0, NULL, NULL, NULL, G_TYPE_NONE, 0);
+
+  /**
    * IdeBuffer::saved:
    *
    * This signal is emitted when the buffer manager has completed saving the file.


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