[gnome-builder] build-stage: track active state for base build stages
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] build-stage: track active state for base build stages
- Date: Tue, 19 Dec 2017 04:04:35 +0000 (UTC)
commit fddc1f85c68792c213c948654a916f6012e0a223
Author: Christian Hergert <chergert redhat com>
Date: Mon Dec 18 20:01:23 2017 -0800
build-stage: track active state for base build stages
This plumbs the activate state tracking into the base stages so that
consumers of these do not need to implement it themselves.
src/libide/buildsystem/ide-build-stage-launcher.c | 19 +++++++++++++++++++
src/libide/buildsystem/ide-build-stage-mkdirs.c | 8 ++++++++
src/libide/buildsystem/ide-build-stage-transfer.c | 19 +++++++++++++++++++
3 files changed, 46 insertions(+), 0 deletions(-)
---
diff --git a/src/libide/buildsystem/ide-build-stage-launcher.c
b/src/libide/buildsystem/ide-build-stage-launcher.c
index bf15d69..17e6c70 100644
--- a/src/libide/buildsystem/ide-build-stage-launcher.c
+++ b/src/libide/buildsystem/ide-build-stage-launcher.c
@@ -107,6 +107,17 @@ ignore_exit_failures:
}
static void
+ide_build_stage_launcher_notify_completed_cb (GTask *task,
+ GParamSpec *pspec,
+ IdeBuildStageLauncher *launcher)
+{
+ g_assert (G_IS_TASK (task));
+ g_assert (IDE_IS_BUILD_STAGE_LAUNCHER (launcher));
+
+ ide_build_stage_set_active (IDE_BUILD_STAGE (launcher), FALSE);
+}
+
+static void
ide_build_stage_launcher_run (IdeBuildStage *stage,
IdeSubprocessLauncher *launcher,
IdeBuildPipeline *pipeline,
@@ -130,6 +141,14 @@ ide_build_stage_launcher_run (IdeBuildStage *stage,
task = g_task_new (self, cancellable, callback, user_data);
g_task_set_source_tag (task, ide_build_stage_launcher_run);
+ g_task_set_priority (task, G_PRIORITY_LOW);
+
+ g_signal_connect (task,
+ "notify::completed",
+ G_CALLBACK (ide_build_stage_launcher_notify_completed_cb),
+ self);
+
+ ide_build_stage_set_active (IDE_BUILD_STAGE (self), TRUE);
if (launcher == NULL)
{
diff --git a/src/libide/buildsystem/ide-build-stage-mkdirs.c b/src/libide/buildsystem/ide-build-stage-mkdirs.c
index ff36288..9f8c986 100644
--- a/src/libide/buildsystem/ide-build-stage-mkdirs.c
+++ b/src/libide/buildsystem/ide-build-stage-mkdirs.c
@@ -97,6 +97,8 @@ ide_build_stage_mkdirs_execute (IdeBuildStage *stage,
g_assert (IDE_IS_BUILD_STAGE_MKDIRS (self));
g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
+ ide_build_stage_set_active (stage, TRUE);
+
for (guint i = 0; i < priv->paths->len; i++)
{
const Path *path = &g_array_index (priv->paths, Path, i);
@@ -124,6 +126,8 @@ ide_build_stage_mkdirs_execute (IdeBuildStage *stage,
}
}
+ ide_build_stage_set_active (stage, FALSE);
+
IDE_RETURN (TRUE);
}
@@ -137,6 +141,8 @@ ide_build_stage_mkdirs_reap (IdeBuildStage *stage,
g_assert (IDE_IS_BUILD_STAGE_MKDIRS (self));
g_assert (DZL_IS_DIRECTORY_REAPER (reaper));
+ ide_build_stage_set_active (stage, TRUE);
+
for (guint i = 0; i < priv->paths->len; i++)
{
const Path *path = &g_array_index (priv->paths, Path, i);
@@ -147,6 +153,8 @@ ide_build_stage_mkdirs_reap (IdeBuildStage *stage,
dzl_directory_reaper_add_directory (reaper, file, 0);
}
}
+
+ ide_build_stage_set_active (stage, FALSE);
}
static void
diff --git a/src/libide/buildsystem/ide-build-stage-transfer.c
b/src/libide/buildsystem/ide-build-stage-transfer.c
index 0b800c7..c032eb4 100644
--- a/src/libide/buildsystem/ide-build-stage-transfer.c
+++ b/src/libide/buildsystem/ide-build-stage-transfer.c
@@ -67,6 +67,17 @@ ide_build_stage_transfer_execute_cb (GObject *object,
}
static void
+ide_build_stage_transfer_notify_completed_cb (GTask *task,
+ GParamSpec *pspec,
+ IdeBuildStageTransfer *transfer)
+{
+ g_assert (G_IS_TASK (task));
+ g_assert (IDE_IS_BUILD_STAGE_TRANSFER (transfer));
+
+ ide_build_stage_set_active (IDE_BUILD_STAGE (transfer), FALSE);
+}
+
+static void
ide_build_stage_transfer_execute_async (IdeBuildStage *stage,
IdeBuildPipeline *pipeline,
GCancellable *cancellable,
@@ -85,6 +96,14 @@ ide_build_stage_transfer_execute_async (IdeBuildStage *stage,
task = g_task_new (self, cancellable, callback, user_data);
g_task_set_source_tag (task, ide_build_stage_transfer_execute_async);
+ g_task_set_priority (task, TRUE);
+
+ g_signal_connect (task,
+ "notify::completed",
+ G_CALLBACK (ide_build_stage_transfer_notify_completed_cb),
+ self);
+
+ ide_build_stage_set_active (stage, TRUE);
if (ide_transfer_get_completed (self->transfer))
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]