[vte/vte-next: 158/223] Move text-{inserted, deleted, modified} signals to VteBuffer



commit bebae113a6337408b3ff01606f0a1fbe780c8c04
Author: Christian Persch <chpe gnome org>
Date:   Sat Jun 11 22:13:22 2011 +0200

    Move text-{inserted,deleted,modified} signals to VteBuffer

 src/vte-private.h |    4 +-
 src/vte.c         |  140 +++++++++++++++++++++++++++-------------------------
 src/vte.h         |    3 -
 src/vteaccess.c   |    8 ++--
 src/vtebuffer.h   |    3 +
 src/vteseq.c      |    4 +-
 6 files changed, 84 insertions(+), 78 deletions(-)
---
diff --git a/src/vte-private.h b/src/vte-private.h
index 00d2393..0cade1f 100644
--- a/src/vte-private.h
+++ b/src/vte-private.h
@@ -434,8 +434,6 @@ void _vte_invalidate_cell(VteTerminal *terminal, glong col, glong row);
 void _vte_invalidate_cursor_once(VteTerminal *terminal, gboolean periodic);
 void _vte_terminal_adjust_adjustments(VteTerminal *terminal);
 void _vte_terminal_queue_contents_changed(VteTerminal *terminal);
-void _vte_terminal_emit_text_deleted(VteTerminal *terminal);
-void _vte_terminal_emit_text_inserted(VteTerminal *terminal);
 void _vte_terminal_scroll_region(VteTerminal *terminal,
 				 long row, glong count, glong delta);
 void _vte_terminal_audible_beep(VteTerminal *terminal);
@@ -491,6 +489,8 @@ void _vte_buffer_emit_restore_window(VteBuffer *buffer);
 void _vte_buffer_emit_maximize_window(VteBuffer *buffer);
 void _vte_buffer_emit_resize_window(VteBuffer *buffer, guint w, guint h);
 void _vte_buffer_emit_move_window(VteBuffer *buffer, guint x, guint y);
+void _vte_buffer_emit_text_deleted(VteBuffer *buffer);
+void _vte_buffer_emit_text_inserted(VteBuffer *buffer);
 
 /* private VteScreen methods */
 void _vte_screen_set_default_attributes(VteScreen *screen);
diff --git a/src/vte.c b/src/vte.c
index e95a1ad..5ff66da 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -181,6 +181,9 @@ enum {
         BUFFER_RESIZE_WINDOW,
         BUFFER_MOVE_WINDOW,
         BUFFER_CURSOR_MOVED,
+        BUFFER_TEXT_MODIFIED,
+        BUFFER_TEXT_INSERTED,
+        BUFFER_TEXT_DELETED,
         LAST_BUFFER_SIGNAL,
 };
 
@@ -993,38 +996,38 @@ vte_terminal_emit_decrease_font_size(VteTerminal *terminal)
 
 /* Emit a "text-inserted" signal. */
 void
-_vte_terminal_emit_text_inserted(VteTerminal *terminal)
+_vte_buffer_emit_text_inserted(VteBuffer *buffer)
 {
-	if (!terminal->pvt->accessible_emit) {
+	if (!buffer->pvt->accessible_emit) {
 		return;
 	}
 	_vte_debug_print(VTE_DEBUG_SIGNALS,
 			"Emitting `text-inserted'.\n");
-	g_signal_emit_by_name(terminal, "text-inserted");
+	g_signal_emit(buffer, buffer_signals[BUFFER_TEXT_INSERTED], 0);
 }
 
 /* Emit a "text-deleted" signal. */
 void
-_vte_terminal_emit_text_deleted(VteTerminal *terminal)
+_vte_buffer_emit_text_deleted(VteBuffer *buffer)
 {
-	if (!terminal->pvt->accessible_emit) {
+	if (!buffer->pvt->accessible_emit) {
 		return;
 	}
 	_vte_debug_print(VTE_DEBUG_SIGNALS,
 			"Emitting `text-deleted'.\n");
-	g_signal_emit_by_name(terminal, "text-deleted");
+        g_signal_emit(buffer, buffer_signals[BUFFER_TEXT_DELETED], 0);
 }
 
 /* Emit a "text-modified" signal. */
 static void
-vte_terminal_emit_text_modified(VteTerminal *terminal)
+vte_buffer_emit_text_modified(VteBuffer *buffer)
 {
-	if (!terminal->pvt->accessible_emit) {
+	if (!buffer->pvt->accessible_emit) {
 		return;
 	}
 	_vte_debug_print(VTE_DEBUG_SIGNALS,
 			"Emitting `text-modified'.\n");
-	g_signal_emit_by_name(terminal, "text-modified");
+        g_signal_emit(buffer, buffer_signals[BUFFER_TEXT_MODIFIED], 0);
 }
 
 /* Emit a "text-scrolled" signal. */
@@ -3143,19 +3146,19 @@ vte_terminal_emit_pending_text_signals(VteTerminal *terminal, GQuark quark)
 	if (terminal->pvt->text_modified_flag) {
 		_vte_debug_print(VTE_DEBUG_SIGNALS,
 				"Emitting buffered `text-modified'.\n");
-		vte_terminal_emit_text_modified(terminal);
+		vte_buffer_emit_text_modified(terminal->term_pvt->buffer);
 		terminal->pvt->text_modified_flag = FALSE;
 	}
 	if (terminal->pvt->text_inserted_flag) {
 		_vte_debug_print(VTE_DEBUG_SIGNALS,
 				"Emitting buffered `text-inserted'\n");
-		_vte_terminal_emit_text_inserted(terminal);
+		_vte_buffer_emit_text_inserted(terminal->term_pvt->buffer);
 		terminal->pvt->text_inserted_flag = FALSE;
 	}
 	if (terminal->pvt->text_deleted_flag) {
 		_vte_debug_print(VTE_DEBUG_SIGNALS,
 				"Emitting buffered `text-deleted'\n");
-		_vte_terminal_emit_text_deleted(terminal);
+		_vte_buffer_emit_text_deleted(terminal->term_pvt->buffer);
 		terminal->pvt->text_deleted_flag = FALSE;
 	}
 }
@@ -7426,7 +7429,7 @@ vte_buffer_set_size(VteBuffer *buffer, glong columns, glong rows)
 		}
 		gtk_widget_queue_resize_no_redraw (&terminal->widget);
 		/* Our visible text changed. */
-		vte_terminal_emit_text_modified(terminal);
+		vte_buffer_emit_text_modified(buffer);
 	}
 }
 
@@ -10922,9 +10925,6 @@ vte_terminal_class_init(VteTerminalClass *klass)
 	klass->increase_font_size = NULL;
 	klass->decrease_font_size = NULL;
 
-	klass->text_modified = NULL;
-	klass->text_inserted = NULL;
-	klass->text_deleted = NULL;
 	klass->text_scrolled = NULL;
 
 	klass->copy_clipboard = vte_terminal_real_copy_clipboard;
@@ -11020,57 +11020,6 @@ vte_terminal_class_init(VteTerminalClass *klass)
 			     G_TYPE_NONE, 0);
 
         /**
-         * VteTerminal::text-modified:
-         * @vteterminal: the object which received the signal
-         *
-         * An internal signal used for communication between the terminal and
-         * its accessibility peer. May not be emitted under certain
-         * circumstances.
-         */
-                g_signal_new(I_("text-modified"),
-			     G_OBJECT_CLASS_TYPE(klass),
-			     G_SIGNAL_RUN_LAST,
-			     G_STRUCT_OFFSET(VteTerminalClass, text_modified),
-			     NULL,
-			     NULL,
-                             g_cclosure_marshal_VOID__VOID,
-			     G_TYPE_NONE, 0);
-
-        /**
-         * VteTerminal::text-inserted:
-         * @vteterminal: the object which received the signal
-         *
-         * An internal signal used for communication between the terminal and
-         * its accessibility peer. May not be emitted under certain
-         * circumstances.
-         */
-                g_signal_new(I_("text-inserted"),
-			     G_OBJECT_CLASS_TYPE(klass),
-			     G_SIGNAL_RUN_LAST,
-			     G_STRUCT_OFFSET(VteTerminalClass, text_inserted),
-			     NULL,
-			     NULL,
-                             g_cclosure_marshal_VOID__VOID,
-			     G_TYPE_NONE, 0);
-
-        /**
-         * VteTerminal::text-deleted:
-         * @vteterminal: the object which received the signal
-         *
-         * An internal signal used for communication between the terminal and
-         * its accessibility peer. May not be emitted under certain
-         * circumstances.
-         */
-                g_signal_new(I_("text-deleted"),
-			     G_OBJECT_CLASS_TYPE(klass),
-			     G_SIGNAL_RUN_LAST,
-			     G_STRUCT_OFFSET(VteTerminalClass, text_deleted),
-			     NULL,
-			     NULL,
-                             g_cclosure_marshal_VOID__VOID,
-			     G_TYPE_NONE, 0);
-
-        /**
          * VteTerminal::text-scrolled:
          * @vteterminal: the object which received the signal
          * @delta: the number of lines scrolled
@@ -13512,6 +13461,9 @@ vte_buffer_class_init(VteBufferClass *klass)
         klass->resize_window = NULL;
         klass->move_window = NULL;
         klass->cursor_moved = NULL;
+        klass->text_modified = NULL;
+        klass->text_inserted = NULL;
+        klass->text_deleted = NULL;
 
         /**
          * VteBuffer::child-exited:
@@ -13820,6 +13772,60 @@ vte_buffer_class_init(VteBufferClass *klass)
                              _vte_marshal_VOID__UINT_UINT,
                              G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT);
 
+        /**
+         * VteBuffer::text-modified:
+         * @vtebuffer: the object which received the signal
+         *
+         * An internal signal used for communication between the buffer and
+         * its accessibility peer. May not be emitted under certain
+         * circumstances.
+         */
+        buffer_signals[BUFFER_TEXT_MODIFIED] =
+                g_signal_new(I_("text-modified"),
+                             G_OBJECT_CLASS_TYPE(klass),
+                             G_SIGNAL_RUN_LAST,
+                             G_STRUCT_OFFSET(VteBufferClass, text_modified),
+                             NULL,
+                             NULL,
+                             g_cclosure_marshal_VOID__VOID,
+                             G_TYPE_NONE, 0);
+
+        /**
+         * VteBuffer::text-inserted:
+         * @vtebuffer: the object which received the signal
+         *
+         * An internal signal used for communication between the buffer and
+         * its accessibility peer. May not be emitted under certain
+         * circumstances.
+         */
+        buffer_signals[BUFFER_TEXT_INSERTED] =
+                g_signal_new(I_("text-inserted"),
+                             G_OBJECT_CLASS_TYPE(klass),
+                             G_SIGNAL_RUN_LAST,
+                             G_STRUCT_OFFSET(VteBufferClass, text_inserted),
+                             NULL,
+                             NULL,
+                             g_cclosure_marshal_VOID__VOID,
+                             G_TYPE_NONE, 0);
+
+        /**
+         * VteBuffer::text-deleted:
+         * @vtebuffer: the object which received the signal
+         *
+         * An internal signal used for communication between the buffer and
+         * its accessibility peer. May not be emitted under certain
+         * circumstances.
+         */
+        buffer_signals[BUFFER_TEXT_DELETED] =
+                g_signal_new(I_("text-deleted"),
+                             G_OBJECT_CLASS_TYPE(klass),
+                             G_SIGNAL_RUN_LAST,
+                             G_STRUCT_OFFSET(VteBufferClass, text_deleted),
+                             NULL,
+                             NULL,
+                             g_cclosure_marshal_VOID__VOID,
+                             G_TYPE_NONE, 0);
+
         /* Properties */
 
         /**
diff --git a/src/vte.h b/src/vte.h
index 7cd5f89..1807bed 100644
--- a/src/vte.h
+++ b/src/vte.h
@@ -84,9 +84,6 @@ struct _VteTerminalClass {
 	void (*increase_font_size)(VteTerminal* terminal);
 	void (*decrease_font_size)(VteTerminal* terminal);
 
-	void (*text_modified)(VteTerminal* terminal);
-	void (*text_inserted)(VteTerminal* terminal);
-	void (*text_deleted)(VteTerminal* terminal);
 	void (*text_scrolled)(VteTerminal* terminal, gint delta);
 	void (*copy_clipboard)(VteTerminal* terminal);
 	void (*paste_clipboard)(VteTerminal* terminal);
diff --git a/src/vteaccess.c b/src/vteaccess.c
index a3ffc45..5846728 100644
--- a/src/vteaccess.c
+++ b/src/vteaccess.c
@@ -426,7 +426,7 @@ vte_terminal_accessible_update_private_data_if_needed(AtkObject *text,
 
 /* A signal handler to catch "text-inserted/deleted/modified" signals. */
 static void
-vte_terminal_accessible_text_modified(VteTerminal *terminal, gpointer data)
+vte_terminal_accessible_text_modified(VteBuffer *buffer, gpointer data)
 {
 	VteTerminalAccessiblePrivate *priv;
 	char *old, *current;
@@ -791,13 +791,13 @@ vte_terminal_initialize (AtkObject *obj, gpointer data)
 			  VTE_TERMINAL_ACCESSIBLE_PRIVATE_DATA,
 			  vte_terminal_accessible_new_private_data());
 
-	g_signal_connect(terminal, "text-inserted",
+	g_signal_connect(buffer, "text-inserted",
 			 G_CALLBACK(vte_terminal_accessible_text_modified),
 			 obj);
-	g_signal_connect(terminal, "text-deleted",
+	g_signal_connect(buffer, "text-deleted",
 			 G_CALLBACK(vte_terminal_accessible_text_modified),
 			 obj);
-	g_signal_connect(terminal, "text-modified",
+	g_signal_connect(buffer, "text-modified",
 			 G_CALLBACK(vte_terminal_accessible_text_modified),
 			 obj);
 	g_signal_connect(terminal, "text-scrolled",
diff --git a/src/vtebuffer.h b/src/vtebuffer.h
index 13083ef..5d510fe 100644
--- a/src/vtebuffer.h
+++ b/src/vtebuffer.h
@@ -69,6 +69,9 @@ struct _VteBufferClass {
                                 guint x,
                                 guint y);
   void (*cursor_moved)         (VteBuffer* buffer);
+  void (*text_modified)        (VteBuffer* buffer);
+  void (*text_inserted)        (VteBuffer* buffer);
+  void (*text_deleted)         (VteBuffer* buffer);
 
   /*< private >*/
   VteBufferClassPrivate *priv;
diff --git a/src/vteseq.c b/src/vteseq.c
index 893402b..b5f4dd6 100644
--- a/src/vteseq.c
+++ b/src/vteseq.c
@@ -2944,13 +2944,13 @@ vte_sequence_handler_screen_alignment_test (VteTerminal *terminal, GValueArray *
 		/* Clear this row. */
 		_vte_row_data_shrink (rowdata, 0);
 
-		_vte_terminal_emit_text_deleted(terminal);
+		_vte_buffer_emit_text_deleted(terminal->term_pvt->buffer);
 		/* Fill this row. */
 		cell.c = 'E';
 		cell.attr = basic_cell.cell.attr;
 		cell.attr.columns = 1;
 		_vte_row_data_fill (rowdata, &cell, terminal->pvt->column_count);
-		_vte_terminal_emit_text_inserted(terminal);
+		_vte_buffer_emit_text_inserted(terminal->term_pvt->buffer);
 	}
 	_vte_invalidate_all(terminal);
 



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