[gnome-builder] run-manager: adjust where handlers are executed
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] run-manager: adjust where handlers are executed
- Date: Sun, 27 Aug 2017 20:28:40 +0000 (UTC)
commit ecf93302eeb60b0ee59c7226329a2316d409f8aa
Author: Christian Hergert <chergert redhat com>
Date: Sat Aug 26 22:13:41 2017 -0700
run-manager: adjust where handlers are executed
We want to allow plugins like terminal to set the TTY before we access
things from our run handlers.
libide/runner/ide-run-manager.c | 48 +++++++++++++++++++++++++-------------
1 files changed, 31 insertions(+), 17 deletions(-)
---
diff --git a/libide/runner/ide-run-manager.c b/libide/runner/ide-run-manager.c
index 026b714..5c185f3 100644
--- a/libide/runner/ide-run-manager.c
+++ b/libide/runner/ide-run-manager.c
@@ -72,6 +72,21 @@ static GParamSpec *properties [N_PROPS];
static guint signals [N_SIGNALS];
static void
+ide_run_manager_real_run (IdeRunManager *self,
+ IdeRunner *runner)
+{
+ g_assert (IDE_IS_RUN_MANAGER (self));
+ g_assert (IDE_IS_RUNNER (runner));
+
+ /*
+ * If the current handler has a callback specified (our default "run" handler
+ * does not), then we need to allow that handler to prepare the runner.
+ */
+ if (self->handler != NULL && self->handler->handler != NULL)
+ self->handler->handler (self, runner, self->handler->handler_data);
+}
+
+static void
ide_run_handler_info_free (gpointer data)
{
IdeRunHandlerInfo *info = data;
@@ -264,18 +279,24 @@ ide_run_manager_class_init (IdeRunManagerClass *klass)
* This signal is emitted right before ide_runner_run_async() is called
* on an #IdeRunner. It can be used by plugins to tweak things right
* before the runner is executed.
+ *
+ * The current run handler (debugger, profiler, etc) is run as the default
+ * handler for this function. So connect with %G_SIGNAL_AFTER if you want
+ * to be nofied after the run handler has executed. It's unwise to change
+ * things that the run handler might expect. Generally if you want to
+ * change settings, do that before the run handler has exected.
*/
signals [RUN] =
- g_signal_new ("run",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL,
- NULL,
- NULL,
- G_TYPE_NONE,
- 1,
- IDE_TYPE_RUNNER);
+ g_signal_new_class_handler ("run",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ G_CALLBACK (ide_run_manager_real_run),
+ NULL,
+ NULL,
+ NULL,
+ G_TYPE_NONE,
+ 1,
+ IDE_TYPE_RUNNER);
/**
* IdeRunManager::stopped:
@@ -409,13 +430,6 @@ do_run_async (IdeRunManager *self,
}
}
- /*
- * If the current handler has a callback specified (our default "run" handler
- * does not), then we need to allow that handler to prepare the runner.
- */
- if (self->handler != NULL && self->handler->handler != NULL)
- self->handler->handler (self, runner, self->handler->handler_data);
-
g_signal_emit (self, signals [RUN], 0, runner);
if (ide_runner_get_failed (runner))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]