[gnome-builder] pipeline: add IdeBuildPipeline:pty property



commit 35120ca326e831d71284ec9c8b11d8ce377afedd
Author: Christian Hergert <chergert redhat com>
Date:   Thu Jan 18 18:49:31 2018 -0800

    pipeline: add IdeBuildPipeline:pty property
    
    This is useful so that we can track when it changes and update the binding
    in various UI components.

 src/libide/buildsystem/ide-build-pipeline.c | 37 ++++++++++++++++++++++++++++-
 src/libide/buildsystem/ide-build-pipeline.h |  3 +++
 2 files changed, 39 insertions(+), 1 deletion(-)
---
diff --git a/src/libide/buildsystem/ide-build-pipeline.c b/src/libide/buildsystem/ide-build-pipeline.c
index 9e081f7eb..f8a9823f1 100644
--- a/src/libide/buildsystem/ide-build-pipeline.c
+++ b/src/libide/buildsystem/ide-build-pipeline.c
@@ -299,6 +299,7 @@ enum {
   PROP_CONFIGURATION,
   PROP_MESSAGE,
   PROP_PHASE,
+  PROP_PTY,
   N_PROPS
 };
 
@@ -1066,6 +1067,8 @@ ide_build_pipeline_initable_init (GInitable     *initable,
 
   ide_build_pipeline_notify_ready (self, NULL, self->configuration);
 
+  g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_PTY]);
+
   IDE_RETURN (TRUE);
 }
 
@@ -1127,6 +1130,10 @@ ide_build_pipeline_get_property (GObject    *object,
       g_value_set_flags (value, ide_build_pipeline_get_phase (self));
       break;
 
+    case PROP_PTY:
+      g_value_set_object (value, ide_build_pipeline_get_pty (self));
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
     }
@@ -1206,6 +1213,21 @@ ide_build_pipeline_class_init (IdeBuildPipelineClass *klass)
                         IDE_BUILD_PHASE_NONE,
                         (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
 
+  /**
+   * IdeBuildPipeline:pty:
+   *
+   * The "pty" property is the #VtePty that is used by build stages that
+   * execute subprocesses with a pseudo terminal.
+   *
+   * Since: 3.28
+   */
+  properties [PROP_PTY] =
+    g_param_spec_object ("pty",
+                         "PTY",
+                         "The PTY used by the pipeline",
+                         VTE_TYPE_PTY,
+                         (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
   g_object_class_install_properties (object_class, N_PROPS, properties);
 
   /**
@@ -2395,8 +2417,21 @@ ide_build_pipeline_attach_pty (IdeBuildPipeline      *self,
   ide_subprocess_launcher_take_stderr_fd (launcher, dup (self->pty_slave));
 }
 
+/**
+ * ide_build_pipeline_get_pty:
+ * @self: a #IdeBuildPipeline
+ *
+ * Gets the #VtePty for the pipeline, if set.
+ *
+ * This will not be set until the pipeline has been initialized. That is not
+ * guaranteed to happen at object creation time.
+ *
+ * Returns: (transfer none) (nullable): a #VtePty or %NULL
+ *
+ * Since: 3.28
+ */
 VtePty *
-_ide_build_pipeline_get_pty (IdeBuildPipeline *self)
+ide_build_pipeline_get_pty (IdeBuildPipeline *self)
 {
   g_return_val_if_fail (IDE_IS_BUILD_PIPELINE (self), NULL);
 
diff --git a/src/libide/buildsystem/ide-build-pipeline.h b/src/libide/buildsystem/ide-build-pipeline.h
index abd7da2d3..35b36086b 100644
--- a/src/libide/buildsystem/ide-build-pipeline.h
+++ b/src/libide/buildsystem/ide-build-pipeline.h
@@ -19,6 +19,7 @@
 #pragma once
 
 #include <gio/gio.h>
+#include <vte/vte.h>
 
 #include "ide-version-macros.h"
 
@@ -72,6 +73,8 @@ IDE_AVAILABLE_IN_ALL
 IdeBuildPhase          ide_build_pipeline_get_phase           (IdeBuildPipeline       *self);
 IDE_AVAILABLE_IN_ALL
 gboolean               ide_build_pipeline_get_can_export      (IdeBuildPipeline       *self);
+IDE_AVAILABLE_IN_3_28
+VtePty                *ide_build_pipeline_get_pty             (IdeBuildPipeline       *self);
 IDE_AVAILABLE_IN_ALL
 IdeSubprocessLauncher *ide_build_pipeline_create_launcher     (IdeBuildPipeline       *self,
                                                                GError                **error);


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