Commit 35120ca3 authored by Christian Hergert's avatar Christian Hergert
Browse files

pipeline: add IdeBuildPipeline:pty property

This is useful so that we can track when it changes and update the binding
in various UI components.
parent 40e73689
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment