[gnome-builder] subprocess-supervisor: add IdeSubprocessSupervisor::spawned



commit 9a08bd9e759a39585a2341c30107684b8b4c2a62
Author: Christian Hergert <chergert redhat com>
Date:   Thu Oct 20 19:58:14 2016 -0700

    subprocess-supervisor: add IdeSubprocessSupervisor::spawned
    
    This new spawned signal is emitted when the process has been spawned. This
    is useful for code that wants to track the child process changes to track
    things like stdin/stdout.

 libide/subprocess/ide-subprocess-supervisor.c |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/libide/subprocess/ide-subprocess-supervisor.c b/libide/subprocess/ide-subprocess-supervisor.c
index 176f8b6..a4f3f40 100644
--- a/libide/subprocess/ide-subprocess-supervisor.c
+++ b/libide/subprocess/ide-subprocess-supervisor.c
@@ -31,6 +31,7 @@ typedef struct
 G_DEFINE_TYPE_WITH_PRIVATE (IdeSubprocessSupervisor, ide_subprocess_supervisor, G_TYPE_OBJECT)
 
 enum {
+  SPAWNED,
   SUPERVISE,
   UNSUPERVISE,
   N_SIGNALS
@@ -110,6 +111,13 @@ ide_subprocess_supervisor_class_init (IdeSubprocessSupervisorClass *klass)
 
   object_class->finalize = ide_subprocess_supervisor_finalize;
 
+  signals [SPAWNED] =
+    g_signal_new_class_handler ("spawned",
+                                G_TYPE_FROM_CLASS (klass),
+                                G_SIGNAL_RUN_LAST,
+                                NULL, NULL, NULL, NULL,
+                                G_TYPE_NONE, 1, G_TYPE_SUBPROCESS);
+
   signals [SUPERVISE] =
     g_signal_new_class_handler ("supervise",
                                 G_TYPE_FROM_CLASS (klass),
@@ -260,9 +268,13 @@ ide_subprocess_supervisor_set_subprocess (IdeSubprocessSupervisor *self,
 
   if (g_set_object (&priv->subprocess, subprocess))
     {
-      ide_subprocess_wait_async (priv->subprocess,
-                                 NULL,
-                                 ide_subprocess_supervisor_wait_cb,
-                                 g_object_ref (self));
+      if (subprocess != NULL)
+        {
+          g_signal_emit (self, signals [SPAWNED], 0, subprocess);
+          ide_subprocess_wait_async (priv->subprocess,
+                                     NULL,
+                                     ide_subprocess_supervisor_wait_cb,
+                                     g_object_ref (self));
+        }
     }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]