[gnome-builder] configuration: add IdeConfiguration:append-path
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] configuration: add IdeConfiguration:append-path
- Date: Tue, 16 Jan 2018 08:50:13 +0000 (UTC)
commit 00fb568e5c2937de0525c63f5938045071941320
Author: Christian Hergert <chergert redhat com>
Date: Mon Jan 15 20:45:40 2018 -0800
configuration: add IdeConfiguration:append-path
This is useful so that we can plumb support for modifying
$PATH when executing commands.
src/libide/buildsystem/ide-configuration.c | 43 ++++++++++++++++++++++++++++++
src/libide/buildsystem/ide-configuration.h | 5 ++++
2 files changed, 48 insertions(+)
---
diff --git a/src/libide/buildsystem/ide-configuration.c b/src/libide/buildsystem/ide-configuration.c
index 4723e1dfe..8dcb29e89 100644
--- a/src/libide/buildsystem/ide-configuration.c
+++ b/src/libide/buildsystem/ide-configuration.c
@@ -43,6 +43,7 @@ typedef struct
gchar *prefix;
gchar *run_opts;
gchar *runtime_id;
+ gchar *append_path;
IdeEnvironment *environment;
@@ -68,6 +69,7 @@ G_DEFINE_TYPE_WITH_PRIVATE (IdeConfiguration, ide_configuration, IDE_TYPE_OBJECT
enum {
PROP_0,
+ PROP_APPEND_PATH,
PROP_BUILD_COMMANDS,
PROP_CONFIG_OPTS,
PROP_DEBUG,
@@ -426,6 +428,10 @@ ide_configuration_get_property (GObject *object,
g_value_set_string (value, ide_configuration_get_app_id (self));
break;
+ case PROP_APPEND_PATH:
+ g_value_set_string (value, ide_configuration_get_append_path (self));
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -501,6 +507,10 @@ ide_configuration_set_property (GObject *object,
ide_configuration_set_app_id (self, g_value_get_string (value));
break;
+ case PROP_APPEND_PATH:
+ ide_configuration_set_append_path (self, g_value_get_string (value));
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -521,6 +531,13 @@ ide_configuration_class_init (IdeConfigurationClass *klass)
klass->get_runtime = ide_configuration_real_get_runtime;
klass->set_runtime = ide_configuration_real_set_runtime;
+ properties [PROP_APPEND_PATH] =
+ g_param_spec_string ("append-path",
+ "Append Path",
+ "Append to PATH environment variable",
+ NULL,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
properties [PROP_BUILD_COMMANDS] =
g_param_spec_boxed ("build-commands",
"Build commands",
@@ -1671,3 +1688,29 @@ ide_configuration_set_run_opts (IdeConfiguration *self,
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_RUN_OPTS]);
}
}
+
+const gchar *
+ide_configuration_get_append_path (IdeConfiguration *self)
+{
+ IdeConfigurationPrivate *priv = ide_configuration_get_instance_private (self);
+
+ g_return_val_if_fail (IDE_IS_CONFIGURATION (self), NULL);
+
+ return priv->append_path;
+}
+
+void
+ide_configuration_set_append_path (IdeConfiguration *self,
+ const gchar *append_path)
+{
+ IdeConfigurationPrivate *priv = ide_configuration_get_instance_private (self);
+
+ g_return_if_fail (IDE_IS_CONFIGURATION (self));
+
+ if (priv->append_path != append_path)
+ {
+ g_free (priv->append_path);
+ priv->append_path = g_strdup (append_path);
+ g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_APPEND_PATH]);
+ }
+}
diff --git a/src/libide/buildsystem/ide-configuration.h b/src/libide/buildsystem/ide-configuration.h
index 25a10ee91..9b56327be 100644
--- a/src/libide/buildsystem/ide-configuration.h
+++ b/src/libide/buildsystem/ide-configuration.h
@@ -72,6 +72,11 @@ IdeConfiguration *ide_configuration_new (IdeContext
const gchar *id,
const gchar *device_id,
const gchar *runtime_id);
+IDE_AVAILABLE_IN_3_28
+const gchar *ide_configuration_get_append_path (IdeConfiguration *self);
+IDE_AVAILABLE_IN_3_28
+void ide_configuration_set_append_path (IdeConfiguration *self,
+ const gchar *append_path);
IDE_AVAILABLE_IN_ALL
const gchar *ide_configuration_get_id (IdeConfiguration *self);
IDE_AVAILABLE_IN_ALL
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]