[vte/vte-next: 69/223] Remove vte_terminal_get_child_exit_status
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/vte-next: 69/223] Remove vte_terminal_get_child_exit_status
- Date: Wed, 22 Jun 2011 20:54:24 +0000 (UTC)
commit 5aad7eee5a2ab110d51b2a4b15dfbb140ebad09c
Author: Christian Persch <chpe gnome org>
Date: Sat May 14 17:45:23 2011 +0200
Remove vte_terminal_get_child_exit_status
Add the child's exit status to the child-exited signal instead.
doc/reference/vte-sections.txt | 1 -
src/vte-private.h | 1 -
src/vte.c | 47 ++++++++++-----------------------------
src/vte.h | 5 +---
src/vteapp.c | 30 +++++++++----------------
5 files changed, 24 insertions(+), 60 deletions(-)
---
diff --git a/doc/reference/vte-sections.txt b/doc/reference/vte-sections.txt
index 6644d02..183deae 100644
--- a/doc/reference/vte-sections.txt
+++ b/doc/reference/vte-sections.txt
@@ -12,7 +12,6 @@ vte_terminal_im_append_menuitems
vte_terminal_feed
vte_terminal_feed_child
vte_terminal_feed_child_binary
-vte_terminal_get_child_exit_status
vte_terminal_select_all
vte_terminal_select_none
vte_terminal_copy_clipboard
diff --git a/src/vte-private.h b/src/vte-private.h
index 77cecf5..fc4a00b 100644
--- a/src/vte-private.h
+++ b/src/vte-private.h
@@ -174,7 +174,6 @@ struct _VteTerminalPrivate {
gboolean pty_input_active;
GPid pty_pid; /* pid of child using pty slave */
guint child_watch_source;
- int child_exit_status;
/* Input data queues. */
const char *encoding; /* the pty's encoding */
diff --git a/src/vte.c b/src/vte.c
index 6e2dd46..7796f99 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -816,11 +816,12 @@ vte_terminal_emit_encoding_changed(VteTerminal *terminal)
/* Emit a "child-exited" signal. */
static void
-vte_terminal_emit_child_exited(VteTerminal *terminal)
+vte_terminal_emit_child_exited(VteTerminal *terminal,
+ int status)
{
_vte_debug_print(VTE_DEBUG_SIGNALS,
"Emitting `child-exited'.\n");
- g_signal_emit_by_name(terminal, "child-exited");
+ g_signal_emit_by_name(terminal, "child-exited", status);
}
/* Emit a "contents_changed" signal. */
@@ -2932,8 +2933,7 @@ vte_terminal_child_watch_cb(GPid pid,
vte_terminal_set_pty_object(terminal, NULL);
/* Tell observers what's happened. */
- terminal->pvt->child_exit_status = status;
- vte_terminal_emit_child_exited(terminal);
+ vte_terminal_emit_child_exited(terminal, status);
g_object_thaw_notify(object);
g_object_unref(object);
@@ -3060,9 +3060,8 @@ vte_terminal_pty_new(VteTerminal *terminal,
* @terminal: a #VteTerminal
* @child_pid: a #GPid
*
- * Watches @child_pid. When the process exists, the #VteReaper::child-exited
- * signal will be called. Use vte_terminal_get_child_exit_status() to
- * retrieve the child's exit status.
+ * Watches @child_pid. When the process exists, the #VteTerminal::child-exited
+ * signal will be called with the child's exit status.
*
* Prior to calling this function, a #VtePty must have been set in @terminal
* using vte_terminal_set_pty_object().
@@ -3098,7 +3097,6 @@ vte_terminal_watch_child (VteTerminal *terminal,
/* Set this as the child's pid. */
pvt->pty_pid = child_pid;
- pvt->child_exit_status = 0;
/* Catch a child-exited signal from the child pid. */
if (terminal->pvt->child_watch_source != 0) {
@@ -7618,7 +7616,6 @@ vte_terminal_init(VteTerminal *terminal)
pvt->pty_input_source = 0;
pvt->pty_output_source = 0;
pvt->pty_pid = -1;
- pvt->child_exit_status = 0;
/* Scrolling options. */
pvt->scroll_on_keystroke = TRUE;
@@ -10843,9 +10840,10 @@ vte_terminal_class_init(VteTerminalClass *klass)
/**
* 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 started
- * using vte_terminal_fork_command() has exited.
+ * 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),
@@ -10853,8 +10851,9 @@ vte_terminal_class_init(VteTerminalClass *klass)
G_STRUCT_OFFSET(VteTerminalClass, child_exited),
NULL,
NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ g_cclosure_marshal_VOID__INT,
+ G_TYPE_NONE,
+ 1, G_TYPE_INT);
/**
* VteTerminal::window-title-changed:
@@ -12853,28 +12852,6 @@ vte_terminal_get_pty_object(VteTerminal *terminal)
return terminal->pvt->pty;
}
-/**
- * vte_terminal_get_child_exit_status:
- * @terminal: a #VteTerminal
- *
- * Gets the exit status of the command started by vte_terminal_fork_command().
- * See your C library's documentation for more details on how to interpret the
- * exit status.
- *
- * Note that this function may only be called from the signal handler of
- * the #VteTerminal::child-exited signal.
- *
- * Returns: the child's exit status
- *
- * Since: 0.20
- */
-int
-vte_terminal_get_child_exit_status(VteTerminal *terminal)
-{
- g_return_val_if_fail(VTE_IS_TERMINAL(terminal), -1);
- return terminal->pvt->child_exit_status;
-}
-
/* We need this bit of glue to ensure that accessible objects will always
* get signals. */
void
diff --git a/src/vte.h b/src/vte.h
index d3816ef..944bf14 100644
--- a/src/vte.h
+++ b/src/vte.h
@@ -68,7 +68,7 @@ struct _VteTerminalClass {
/*< protected > */
/* Default signal handlers. */
void (*eof)(VteTerminal* terminal);
- void (*child_exited)(VteTerminal* terminal);
+ void (*child_exited)(VteTerminal* terminal, int status);
void (*emulation_changed)(VteTerminal* terminal);
void (*encoding_changed)(VteTerminal* terminal);
void (*char_size_changed)(VteTerminal* terminal, guint char_width, guint char_height);
@@ -383,9 +383,6 @@ glong vte_terminal_get_column_count(VteTerminal *terminal);
const char *vte_terminal_get_window_title(VteTerminal *terminal);
const char *vte_terminal_get_icon_title(VteTerminal *terminal);
-int vte_terminal_get_child_exit_status(VteTerminal *terminal);
-
-
/* Writing contents out */
/**
diff --git a/src/vteapp.c b/src/vteapp.c
index e6a9175..26182c7 100644
--- a/src/vteapp.c
+++ b/src/vteapp.c
@@ -168,10 +168,9 @@ delete_event(GtkWidget *window, GdkEvent *event, gpointer terminal)
destroy_and_quit(VTE_TERMINAL (terminal), window);
}
static void
-child_exited(GtkWidget *terminal, gpointer window)
+child_exited(GtkWidget *terminal, int status, gpointer window)
{
- _vte_debug_print(VTE_DEBUG_MISC, "Child exited with status %x\n",
- vte_terminal_get_child_exit_status (VTE_TERMINAL (terminal)));
+ _vte_debug_print(VTE_DEBUG_MISC, "Child exited with status %x\n", status);
destroy_and_quit(VTE_TERMINAL (terminal), GTK_WIDGET (window));
}
@@ -417,7 +416,7 @@ read_and_feed(GIOChannel *source, GIOCondition condition, gpointer data)
}
static void
-disconnect_watch(GtkWidget *widget, gpointer data)
+disconnect_watch(gpointer data)
{
g_source_remove(GPOINTER_TO_INT(data));
}
@@ -487,12 +486,6 @@ terminal_notify_cb(GObject *object,
g_value_unset(&value);
}
-static void
-child_exit_cb(VteTerminal *terminal,
- gpointer user_data)
-{
-}
-
static int
parse_enum(GType type,
const char *string)
@@ -828,7 +821,6 @@ main(int argc, char **argv)
if (!dbuffer) {
gtk_widget_set_double_buffered(widget, dbuffer);
}
- g_signal_connect(terminal, "child-exited", G_CALLBACK(child_exit_cb), NULL);
if (show_object_notifications)
g_signal_connect(terminal, "notify", G_CALLBACK(terminal_notify_cb), NULL);
if (use_scrolled_window) {
@@ -978,14 +970,14 @@ main(int argc, char **argv)
G_IO_IN,
read_and_feed,
widget);
- g_signal_connect(widget,
- "eof",
- G_CALLBACK(disconnect_watch),
- GINT_TO_POINTER(watch));
- g_signal_connect(widget,
- "child-exited",
- G_CALLBACK(disconnect_watch),
- GINT_TO_POINTER(watch));
+ g_signal_connect_swapped(widget,
+ "eof",
+ G_CALLBACK(disconnect_watch),
+ GINT_TO_POINTER(watch));
+ g_signal_connect_swapped(widget,
+ "child-exited",
+ G_CALLBACK(disconnect_watch),
+ GINT_TO_POINTER(watch));
g_signal_connect(widget,
"realize",
G_CALLBACK(take_xconsole_ownership),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]