[gnome-builder/wip/chergert/sysprof: 11/18] runner: add IdeRunner::spawned signal
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/chergert/sysprof: 11/18] runner: add IdeRunner::spawned signal
- Date: Tue, 23 Aug 2016 01:49:01 +0000 (UTC)
commit a717bf3dba99d4667914059ca36156962946e514
Author: Christian Hergert <chergert redhat com>
Date: Mon Aug 22 18:37:25 2016 -0700
runner: add IdeRunner::spawned signal
This is useful for plugins that want to know when a process has actually
been spawned by the runner.
libide/runner/ide-runner.c | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/libide/runner/ide-runner.c b/libide/runner/ide-runner.c
index 8b4f1e0..eb26208 100644
--- a/libide/runner/ide-runner.c
+++ b/libide/runner/ide-runner.c
@@ -47,6 +47,11 @@ enum {
N_PROPS
};
+enum {
+ SPAWNED,
+ N_SIGNALS
+};
+
static void ide_runner_tick_posthook (GTask *task);
static void ide_runner_tick_prehook (GTask *task);
static void ide_runner_tick_run (GTask *task);
@@ -54,6 +59,7 @@ static void ide_runner_tick_run (GTask *task);
G_DEFINE_TYPE_WITH_PRIVATE (IdeRunner, ide_runner, IDE_TYPE_OBJECT)
static GParamSpec *properties [N_PROPS];
+static guint signals [N_SIGNALS];
static IdeRunnerAddin *
pop_runner_addin (GSList **list)
@@ -135,6 +141,7 @@ ide_runner_real_run_async (IdeRunner *self,
g_autoptr(GTask) task = NULL;
g_autoptr(IdeSubprocessLauncher) launcher = NULL;
g_autoptr(GSubprocess) subprocess = NULL;
+ const gchar *identifier;
GError *error = NULL;
IDE_ENTRY;
@@ -162,6 +169,10 @@ ide_runner_real_run_async (IdeRunner *self,
IDE_GOTO (failure);
}
+ identifier = g_subprocess_get_identifier (subprocess);
+
+ g_signal_emit (self, signals [SPAWNED], 0, identifier);
+
g_subprocess_wait_async (subprocess,
cancellable,
ide_runner_run_wait_cb,
@@ -316,6 +327,18 @@ ide_runner_class_init (IdeRunnerClass *klass)
(G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
g_object_class_install_properties (object_class, N_PROPS, properties);
+
+ signals [SPAWNED] =
+ g_signal_new ("spawned",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL,
+ NULL,
+ NULL,
+ G_TYPE_NONE,
+ 1,
+ G_TYPE_STRING);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]