[vte/vte-next: 136/223] Move "commit" signal to VteBuffer
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/vte-next: 136/223] Move "commit" signal to VteBuffer
- Date: Wed, 22 Jun 2011 21:00:02 +0000 (UTC)
commit 48647dd57bedf80e079c0b6e04e5fd18a519269d
Author: Christian Persch <chpe gnome org>
Date: Thu Jun 9 23:02:32 2011 +0200
Move "commit" signal to VteBuffer
src/vte.c | 61 +++++++++++++++++++++++++++++++++---------------------
src/vte.h | 1 -
src/vtebuffer.h | 4 +++
3 files changed, 41 insertions(+), 25 deletions(-)
---
diff --git a/src/vte.c b/src/vte.c
index 25ee394..d0b6973 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -158,6 +158,13 @@ enum {
PROP_FONT_SCALE
};
+enum {
+ BUFFER_COMMIT,
+ LAST_BUFFER_SIGNAL,
+};
+
+static guint buffer_signals[LAST_BUFFER_SIGNAL];
+
/* these static variables are guarded by the GDK mutex */
static guint process_timeout_tag = 0;
static gboolean in_process_timeout;
@@ -799,7 +806,7 @@ vte_terminal_emit_selection_changed(VteTerminal *terminal)
/* Emit a "commit" signal. */
static void
-vte_terminal_emit_commit(VteTerminal *terminal, const gchar *text, guint length)
+vte_buffer_emit_commit(VteBuffer *buffer, const gchar *text, guint length)
{
const char *result = NULL;
char *wrapped = NULL;
@@ -816,7 +823,8 @@ vte_terminal_emit_commit(VteTerminal *terminal, const gchar *text, guint length)
wrapped[length] = '\0';
}
- g_signal_emit_by_name(terminal, "commit", result, length);
+ g_signal_emit(buffer, buffer_signals[BUFFER_COMMIT], 0,
+ result, length);
if(wrapped)
g_slice_free1(length+1, wrapped);
@@ -3777,7 +3785,7 @@ vte_terminal_send(VteTerminal *terminal, const char *encoding,
}
/* Tell observers that we're sending this to the child. */
if (cooked_length > 0) {
- vte_terminal_emit_commit(terminal,
+ vte_buffer_emit_commit(terminal->term_pvt->buffer,
cooked, cooked_length);
}
/* Echo the text if we've been asked to do so. */
@@ -3868,7 +3876,7 @@ vte_terminal_feed_child_binary(VteTerminal *terminal, const char *data, glong le
/* Tell observers that we're sending this to the child. */
if (length > 0) {
- vte_terminal_emit_commit(terminal,
+ vte_buffer_emit_commit(terminal->term_pvt->buffer,
data, length);
/* If there's a place for it to go, add the data to the
@@ -10835,7 +10843,6 @@ vte_terminal_class_init(VteTerminalClass *klass)
klass->contents_changed = NULL;
klass->cursor_moved = NULL;
klass->status_line_changed = NULL;
- klass->commit = NULL;
klass->deiconify_window = NULL;
klass->iconify_window = NULL;
@@ -10951,25 +10958,6 @@ vte_terminal_class_init(VteTerminalClass *klass)
G_TYPE_NONE, 0);
/**
- * VteTerminal::commit:
- * @vteterminal: the object which received the signal
- * @text: a string of text
- * @size: the length of that string of text
- *
- * Emitted whenever the terminal receives input from the user and
- * prepares to send it to the child process. The signal is emitted even
- * when there is no child process.
- */
- g_signal_new(I_("commit"),
- G_OBJECT_CLASS_TYPE(klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(VteTerminalClass, commit),
- NULL,
- NULL,
- _vte_marshal_VOID__STRING_UINT,
- G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_UINT);
-
- /**
* VteTerminal::emulation-changed:
* @vteterminal: the object which received the signal
*
@@ -13784,6 +13772,31 @@ vte_buffer_class_init(VteBufferClass *klass)
gobject_class->finalize = vte_buffer_finalize;
gobject_class->get_property = vte_buffer_get_property;
gobject_class->set_property = vte_buffer_set_property;
+
+ klass->commit = NULL;
+
+ /**
+ * VteBuffer::commit:
+ * @buffer: the object which received the signal
+ * @text: a string of text
+ * @size: the length of that string of text
+ *
+ * Emitted whenever the terminal receives input from the user and
+ * prepares to send it to the child process. The signal is emitted even
+ * when there is no child process.
+ */
+ buffer_signals[BUFFER_COMMIT] =
+ g_signal_new(I_("commit"),
+ G_OBJECT_CLASS_TYPE(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(VteBufferClass, commit),
+ NULL,
+ NULL,
+ _vte_marshal_VOID__STRING_UINT,
+ G_TYPE_NONE,
+ 2, G_TYPE_STRING, G_TYPE_UINT);
+
+
}
/**
diff --git a/src/vte.h b/src/vte.h
index 0a857b1..7a4e4eb 100644
--- a/src/vte.h
+++ b/src/vte.h
@@ -85,7 +85,6 @@ struct _VteTerminalClass {
void (*contents_changed)(VteTerminal* terminal);
void (*cursor_moved)(VteTerminal* terminal);
void (*status_line_changed)(VteTerminal* terminal);
- void (*commit)(VteTerminal* terminal, const gchar *text, guint size);
void (*deiconify_window)(VteTerminal* terminal);
void (*iconify_window)(VteTerminal* terminal);
diff --git a/src/vtebuffer.h b/src/vtebuffer.h
index 09903fa..d4554ef 100644
--- a/src/vtebuffer.h
+++ b/src/vtebuffer.h
@@ -44,6 +44,10 @@ typedef struct _VteBufferClassPrivate VteBufferClassPrivate;
struct _VteBufferClass {
GObjectClass object_class;
+ void (*commit) (VteBuffer *buffer,
+ const gchar *text,
+ guint size);
+
/*< private >*/
VteBufferClassPrivate *priv;
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]