[vte/vte-next] Remove vte_terminal_get_child_exit_status



commit aaa36dcb58b0179637c89e21c5bbae89de682fb7
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                      |    3 --
 src/vteapp.c                   |   30 +++++++++----------------
 5 files changed, 23 insertions(+), 59 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 91c3abf..c8d2b5b 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 a522580..b4bb58e 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. */
@@ -2934,8 +2935,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);
@@ -3062,9 +3062,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().
@@ -3100,7 +3099,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) {
@@ -7620,7 +7618,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;
@@ -10845,9 +10842,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),
@@ -10855,8 +10853,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:
@@ -12855,28 +12854,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 013437f..1679f56 100644
--- a/src/vte.h
+++ b/src/vte.h
@@ -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 aa92fc4..b054720 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));
 }
 
@@ -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)
@@ -823,7 +816,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) {
@@ -973,14 +965,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]