[vte/vte-next: 150/223] Move child-exited signal to VteBuffer
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/vte-next: 150/223] Move child-exited signal to VteBuffer
- Date: Wed, 22 Jun 2011 21:01:12 +0000 (UTC)
commit d0e3c64f4c48ccf83e4731a61c925ce6e55baea3
Author: Christian Persch <chpe gnome org>
Date: Sat Jun 11 16:42:29 2011 +0200
Move child-exited signal to VteBuffer
src/reflect.c | 2 +-
src/vte.c | 48 +++++++++++++++++++++++++-----------------------
src/vte.h | 1 -
src/vteapp.c | 8 ++++----
src/vtebuffer.h | 2 ++
5 files changed, 32 insertions(+), 29 deletions(-)
---
diff --git a/src/reflect.c b/src/reflect.c
index a593642..2664d07 100644
--- a/src/reflect.c
+++ b/src/reflect.c
@@ -64,7 +64,7 @@ terminal_init_vte(GtkWidget **terminal)
buffer = vte_terminal_get_buffer(VTE_TERMINAL(*terminal));
g_signal_connect(buffer, "eof",
G_CALLBACK(gtk_main_quit), NULL);
- g_signal_connect(G_OBJECT(*terminal), "child-exited",
+ g_signal_connect(buffer, "child-exited",
G_CALLBACK(gtk_main_quit), NULL);
}
static void
diff --git a/src/vte.c b/src/vte.c
index e8427ef..575df7d 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -170,6 +170,7 @@ enum {
BUFFER_ICON_TITLE_CHANGED,
BUFFER_STATUS_LINE_CHANGED,
BUFFER_EOF,
+ BUFFER_CHILD_EXITED,
LAST_BUFFER_SIGNAL,
};
@@ -862,12 +863,12 @@ vte_buffer_emit_encoding_changed(VteBuffer *buffer)
/* Emit a "child-exited" signal. */
static void
-vte_terminal_emit_child_exited(VteTerminal *terminal,
- int status)
+vte_buffer_emit_child_exited(VteBuffer *buffer,
+ int status)
{
_vte_debug_print(VTE_DEBUG_SIGNALS,
"Emitting `child-exited'.\n");
- g_signal_emit_by_name(terminal, "child-exited", status);
+ g_signal_emit(buffer, buffer_signals[BUFFER_CHILD_EXITED], 0, status);
}
/* Emit a "contents_changed" signal. */
@@ -2700,7 +2701,7 @@ vte_terminal_child_watch_cb(GPid pid,
vte_terminal_set_pty(terminal, NULL);
/* Tell observers what's happened. */
- vte_terminal_emit_child_exited(terminal, status);
+ vte_buffer_emit_child_exited(terminal->term_pvt->buffer, status);
g_object_thaw_notify(object);
g_object_unref(object);
@@ -10837,7 +10838,6 @@ vte_terminal_class_init(VteTerminalClass *klass)
widget_class->screen_changed = vte_terminal_screen_changed;
/* Initialize default handlers. */
- klass->child_exited = NULL;
klass->char_size_changed = NULL;
klass->selection_changed = NULL;
klass->contents_changed = NULL;
@@ -10875,24 +10875,6 @@ vte_terminal_class_init(VteTerminalClass *klass)
/* Register some signals of our own. */
/**
- * VteTerminal::child-exited:
- * @vteterminal: the object which received the signal
- * @status: the child's exit status
- *
- * This signal is emitted when the terminal detects that a child
- * watched using vte_terminal_watch_child() has exited.
- */
- g_signal_new(I_("child-exited"),
- G_OBJECT_CLASS_TYPE(klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(VteTerminalClass, child_exited),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__INT,
- G_TYPE_NONE,
- 1, G_TYPE_INT);
-
- /**
* VteTerminal::char-size-changed:
* @vteterminal: the object which received the signal
* @width: the new character cell width
@@ -13611,6 +13593,7 @@ vte_buffer_class_init(VteBufferClass *klass)
gobject_class->get_property = vte_buffer_get_property;
gobject_class->set_property = vte_buffer_set_property;
+ klass->child_exited = NULL;
klass->commit = NULL;
klass->emulation_changed = NULL;
klass->encoding_changed = NULL;
@@ -13620,6 +13603,25 @@ vte_buffer_class_init(VteBufferClass *klass)
klass->status_line_changed = NULL;
/**
+ * VteBuffer::child-exited:
+ * @buffer: the object which received the signal
+ * @status: the child's exit status
+ *
+ * This signal is emitted when the buffer detects that a child
+ * watched using vte_buffer_watch_child() has exited.
+ */
+ buffer_signals[BUFFER_CHILD_EXITED] =
+ g_signal_new(I_("child-exited"),
+ G_OBJECT_CLASS_TYPE(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(VteBufferClass, child_exited),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__INT,
+ G_TYPE_NONE,
+ 1, G_TYPE_INT);
+
+ /**
* VteBuffer::commit:
* @buffer: the object which received the signal
* @text: a string of text
diff --git a/src/vte.h b/src/vte.h
index db1d95f..e098f30 100644
--- a/src/vte.h
+++ b/src/vte.h
@@ -74,7 +74,6 @@ struct _VteTerminalClass {
GtkWidgetClass parent_class;
/*< protected > */
- void (*child_exited)(VteTerminal* terminal, int status);
void (*char_size_changed)(VteTerminal* terminal, guint char_width, guint char_height);
void (*selection_changed)(VteTerminal* terminal);
void (*contents_changed)(VteTerminal* terminal);
diff --git a/src/vteapp.c b/src/vteapp.c
index 68bdaf4..618f755 100644
--- a/src/vteapp.c
+++ b/src/vteapp.c
@@ -162,10 +162,10 @@ delete_event(GtkWidget *window, GdkEvent *event, gpointer terminal)
destroy_and_quit(VTE_TERMINAL (terminal), window);
}
static void
-child_exited(GtkWidget *terminal, int status, gpointer window)
+child_exited(VteBuffer *buffer, int status, gpointer terminal)
{
_vte_debug_print(VTE_DEBUG_MISC, "Child exited with status %x\n", status);
- destroy_and_quit(VTE_TERMINAL (terminal), GTK_WIDGET (window));
+ destroy_and_quit(VTE_TERMINAL (terminal), gtk_widget_get_toplevel(terminal));
}
static void
@@ -1052,7 +1052,7 @@ main(int argc, char **argv)
"eof",
G_CALLBACK(disconnect_watch),
GINT_TO_POINTER(watch));
- g_signal_connect_swapped(widget,
+ g_signal_connect_swapped(buffer,
"child-exited",
G_CALLBACK(disconnect_watch),
GINT_TO_POINTER(watch));
@@ -1170,7 +1170,7 @@ main(int argc, char **argv)
g_object_set_data (G_OBJECT (widget), "output_file", (gpointer) output_file);
/* Go for it! */
- g_signal_connect(widget, "child-exited", G_CALLBACK(child_exited), window);
+ g_signal_connect(buffer, "child-exited", G_CALLBACK(child_exited), terminal);
g_signal_connect(window, "delete-event", G_CALLBACK(delete_event), widget);
add_weak_pointer(G_OBJECT(widget), &widget);
diff --git a/src/vtebuffer.h b/src/vtebuffer.h
index a496374..b72f7f8 100644
--- a/src/vtebuffer.h
+++ b/src/vtebuffer.h
@@ -53,6 +53,8 @@ struct _VteBufferClass {
void (*window_title_changed) (VteBuffer* buffer);
void (*status_line_changed) (VteBuffer* buffer);
void (*eof) (VteBuffer* buffer);
+ void (*child_exited) (VteBuffer *buffer,
+ gint status);
/*< private >*/
VteBufferClassPrivate *priv;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]