[vte] widget: Remove vte_terminal_get_child_exit_status
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte] widget: Remove vte_terminal_get_child_exit_status
- Date: Sun, 30 Mar 2014 19:27:38 +0000 (UTC)
commit 08c778bf4a23abe614bad294027b4e88f6b727f0
Author: Christian Persch <chpe gnome org>
Date: Sat May 14 17:45:23 2011 +0200
widget: Remove vte_terminal_get_child_exit_status
Add the child's exit status to the child-exited signal instead.
Conflicts:
src/vte.c
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 eb1d407..a873c88 100644
--- a/doc/reference/vte-sections.txt
+++ b/doc/reference/vte-sections.txt
@@ -11,7 +11,6 @@ vte_terminal_new
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 5e2e470..e5b4647 100644
--- a/src/vte-private.h
+++ b/src/vte-private.h
@@ -203,7 +203,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 227deef..775b675 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -832,11 +832,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. */
@@ -3201,8 +3202,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);
@@ -3326,9 +3326,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().
@@ -3364,7 +3363,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) {
@@ -8058,7 +8056,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;
@@ -10923,9 +10920,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),
@@ -10933,8 +10931,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:
@@ -13003,28 +13002,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 2c321aa..6081f06 100644
--- a/src/vte.h
+++ b/src/vte.h
@@ -69,7 +69,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 @@ const char *vte_terminal_get_icon_title(VteTerminal *terminal);
const char *vte_terminal_get_current_directory_uri(VteTerminal *terminal);
const char *vte_terminal_get_current_file_uri(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 8bc2a0b..55dcfbd 100644
--- a/src/vteapp.c
+++ b/src/vteapp.c
@@ -163,10 +163,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));
}
@@ -412,7 +411,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));
}
@@ -482,12 +481,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)
@@ -813,7 +806,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) {
@@ -947,14 +939,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]