[gnome-builder] buffer: track buffer changes with sequence counter
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] buffer: track buffer changes with sequence counter
- Date: Tue, 29 Sep 2015 20:24:01 +0000 (UTC)
commit 08de97ac555d9ea0a9b397c12bfbdea382302188
Author: Christian Hergert <christian hergert me>
Date: Tue Sep 29 13:23:42 2015 -0700
buffer: track buffer changes with sequence counter
ide_buffer_get_change_count() can be used to determine if the buffer has
been changed since the last time you looked at it. All changes, including
undo, will increment this counter.
libide/ide-buffer.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/libide/ide-buffer.c b/libide/ide-buffer.c
index c3ab1ba..d52f0f4 100644
--- a/libide/ide-buffer.c
+++ b/libide/ide-buffer.c
@@ -84,6 +84,8 @@ typedef struct
gint hold_count;
guint reclamation_handler;
+ gsize change_count;
+
guint changed_on_volume : 1;
guint diagnostics_dirty : 1;
guint highlight_diagnostics : 1;
@@ -646,6 +648,7 @@ ide_buffer_changed (GtkTextBuffer *buffer)
GTK_TEXT_BUFFER_CLASS (ide_buffer_parent_class)->changed (buffer);
+ priv->change_count++;
priv->diagnostics_dirty = TRUE;
g_clear_pointer (&priv->content, g_bytes_unref);
@@ -2193,3 +2196,13 @@ ide_buffer_get_word_at_iter (IdeBuffer *self,
return gtk_text_iter_get_slice (&begin, &end);
}
+
+gsize
+ide_buffer_get_change_count (IdeBuffer *self)
+{
+ IdeBufferPrivate *priv = ide_buffer_get_instance_private (self);
+
+ g_return_val_if_fail (IDE_IS_BUFFER (self), 0);
+
+ return priv->change_count;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]