[gtksourceview/wip/chergert/gsv-gtk4: 124/125] buffer: add GtkSourceBuffer::cursor-moved signal
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/chergert/gsv-gtk4: 124/125] buffer: add GtkSourceBuffer::cursor-moved signal
- Date: Wed, 15 Jan 2020 23:56:48 +0000 (UTC)
commit e6e051c62c8b871b70d05941b7bf82b4433fcb94
Author: Christian Hergert <chergert redhat com>
Date: Wed Jan 15 15:44:55 2020 -0800
buffer: add GtkSourceBuffer::cursor-moved signal
This is commonly implemented in subclasses, so it seems reasonable to add
it upstream within GtkSourceBuffer directly now that it will not collide
with subclasses.
gtksourceview/gtksourcebuffer.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
---
diff --git a/gtksourceview/gtksourcebuffer.c b/gtksourceview/gtksourcebuffer.c
index 1f62921f..43efbc2f 100644
--- a/gtksourceview/gtksourcebuffer.c
+++ b/gtksourceview/gtksourcebuffer.c
@@ -136,6 +136,7 @@
enum
{
+ CURSOR_MOVED,
HIGHLIGHT_UPDATED,
SOURCE_MARK_UPDATED,
UNDO,
@@ -370,6 +371,21 @@ gtk_source_buffer_class_init (GtkSourceBufferClass *klass)
g_object_class_install_properties (object_class, N_PROPERTIES, buffer_properties);
+ /**
+ * GtkSourceBuffer::cursor-moved:
+ * @buffer: a #GtkSourceBuffer
+ *
+ * The "cursor-moved" signal is emitted when then insertion mark has moved.
+ *
+ * Since: 5.0
+ */
+ buffer_signals[CURSOR_MOVED] =
+ g_signal_new_class_handler ("cursor-moved",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ NULL, NULL, NULL, NULL,
+ G_TYPE_NONE, 0);
+
/**
* GtkSourceBuffer::highlight-updated:
* @buffer: the buffer that received the signal
@@ -971,6 +987,8 @@ static void
cursor_moved (GtkSourceBuffer *buffer)
{
queue_bracket_highlighting_update (buffer);
+
+ g_signal_emit (buffer, buffer_signals[CURSOR_MOVED], 0);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]