[gnome-builder] build-stage: add IdeBuildStage:active



commit 8ebdddcbf34baaeec97f1fd1554026d6498552b8
Author: Christian Hergert <chergert redhat com>
Date:   Mon Dec 18 19:59:07 2017 -0800

    build-stage: add IdeBuildStage:active
    
    This property should be set by build stages when they are actively
    performing work.

 src/libide/buildsystem/ide-build-stage.c |   63 ++++++++++++++++++++++++++++++
 src/libide/buildsystem/ide-build-stage.h |    5 ++
 2 files changed, 68 insertions(+), 0 deletions(-)
---
diff --git a/src/libide/buildsystem/ide-build-stage.c b/src/libide/buildsystem/ide-build-stage.c
index 22185aa..ec47569 100644
--- a/src/libide/buildsystem/ide-build-stage.c
+++ b/src/libide/buildsystem/ide-build-stage.c
@@ -40,12 +40,14 @@ typedef struct
   guint                disabled : 1;
   guint                transient : 1;
   guint                check_stdout : 1;
+  guint                active : 1;
 } IdeBuildStagePrivate;
 
 G_DEFINE_TYPE_WITH_PRIVATE (IdeBuildStage, ide_build_stage, IDE_TYPE_OBJECT)
 
 enum {
   PROP_0,
+  PROP_ACTIVE,
   PROP_CHECK_STDOUT,
   PROP_COMPLETED,
   PROP_DISABLED,
@@ -269,6 +271,10 @@ ide_build_stage_get_property (GObject    *object,
 
   switch (prop_id)
     {
+    case PROP_ACTIVE:
+      g_value_set_boolean (value, ide_build_stage_get_active (self));
+      break;
+
     case PROP_CHECK_STDOUT:
       g_value_set_boolean (value, ide_build_stage_get_check_stdout (self));
       break;
@@ -304,6 +310,10 @@ ide_build_stage_set_property (GObject      *object,
 
   switch (prop_id)
     {
+    case PROP_ACTIVE:
+      ide_build_stage_set_active (self, g_value_get_boolean (value));
+      break;
+
     case PROP_CHECK_STDOUT:
       ide_build_stage_set_check_stdout (self, g_value_get_boolean (value));
       break;
@@ -346,6 +356,21 @@ ide_build_stage_class_init (IdeBuildStageClass *klass)
   klass->chain = ide_build_stage_real_chain;
 
   /**
+   * IdeBuildStage:active:
+   *
+   * This property is set to %TRUE when the build stage is actively
+   * running or cleaning.
+   *
+   * Since: 3.28
+   */
+  properties [PROP_ACTIVE] =
+    g_param_spec_boolean ("active",
+                          "Active",
+                          "If the stage is actively running",
+                          FALSE,
+                          G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
+
+  /**
    * IdeBuildStage:check-stdout:
    *
    * Most build systems will preserve stderr for the processes they call, such
@@ -1055,3 +1080,41 @@ ide_build_stage_set_check_stdout (IdeBuildStage *self,
       g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_CHECK_STDOUT]);
     }
 }
+
+/**
+ * ide_build_stage_get_active:
+ * @self: a #IdeBuildStage
+ *
+ * Gets the "active" property, which is set to %TRUE when the
+ * build stage is actively executing or cleaning.
+ *
+ * Returns: %TRUE if the stage is actively executing or cleaning.
+ *
+ * Since: 3.28
+ */
+gboolean
+ide_build_stage_get_active (IdeBuildStage *self)
+{
+  IdeBuildStagePrivate *priv = ide_build_stage_get_instance_private (self);
+
+  g_return_val_if_fail (IDE_IS_BUILD_STAGE (self), FALSE);
+
+  return priv->active;
+}
+
+void
+ide_build_stage_set_active (IdeBuildStage *self,
+                            gboolean       active)
+{
+  IdeBuildStagePrivate *priv = ide_build_stage_get_instance_private (self);
+
+  g_return_if_fail (IDE_IS_BUILD_STAGE (self));
+
+  active = !!active;
+
+  if (priv->active != active)
+    {
+      priv->active = active;
+      ide_object_notify_in_main (IDE_OBJECT (self), properties [PROP_ACTIVE]);
+    }
+}
diff --git a/src/libide/buildsystem/ide-build-stage.h b/src/libide/buildsystem/ide-build-stage.h
index 3b4b05e..734ffcf 100644
--- a/src/libide/buildsystem/ide-build-stage.h
+++ b/src/libide/buildsystem/ide-build-stage.h
@@ -172,6 +172,11 @@ struct _IdeBuildStageClass
   gpointer _reserved12;
 };
 
+IDE_AVAILABLE_IN_3_28
+gboolean       ide_build_stage_get_active       (IdeBuildStage        *self);
+IDE_AVAILABLE_IN_3_28
+void           ide_build_stage_set_active       (IdeBuildStage        *self,
+                                                 gboolean              active);
 IDE_AVAILABLE_IN_ALL
 const gchar   *ide_build_stage_get_name         (IdeBuildStage        *self);
 IDE_AVAILABLE_IN_ALL


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