[gnome-builder] configuration: allow specifying directory for build-commands
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] configuration: allow specifying directory for build-commands
- Date: Mon, 9 Apr 2018 02:16:29 +0000 (UTC)
commit 8778d3c56189b5b321e4bc4e284954bc6db79d70
Author: Christian Hergert <chergert redhat com>
Date: Sun Apr 8 19:15:14 2018 -0700
configuration: allow specifying directory for build-commands
src/libide/config/ide-configuration.c | 48 +++++++++++++++++++++++++++++++++++
src/libide/config/ide-configuration.h | 5 ++++
2 files changed, 53 insertions(+)
---
diff --git a/src/libide/config/ide-configuration.c b/src/libide/config/ide-configuration.c
index bee977d8e..23dd4d1e7 100644
--- a/src/libide/config/ide-configuration.c
+++ b/src/libide/config/ide-configuration.c
@@ -46,6 +46,8 @@ typedef struct
gchar *runtime_id;
gchar *append_path;
+ GFile *build_commands_dir;
+
IdeEnvironment *environment;
GHashTable *internal;
@@ -73,6 +75,7 @@ enum {
PROP_APPEND_PATH,
PROP_APP_ID,
PROP_BUILD_COMMANDS,
+ PROP_BUILD_COMMANDS_DIR,
PROP_CONFIG_OPTS,
PROP_DEBUG,
PROP_DIRTY,
@@ -260,6 +263,7 @@ ide_configuration_finalize (GObject *object)
IdeConfiguration *self = (IdeConfiguration *)object;
IdeConfigurationPrivate *priv = ide_configuration_get_instance_private (self);
+ g_clear_object (&priv->build_commands_dir);
g_clear_object (&priv->environment);
g_clear_pointer (&priv->build_commands, g_strfreev);
@@ -293,6 +297,10 @@ ide_configuration_get_property (GObject *object,
g_value_set_boxed (value, ide_configuration_get_build_commands (self));
break;
+ case PROP_BUILD_COMMANDS_DIR:
+ g_value_set_object (value, ide_configuration_get_build_commands_dir (self));
+ break;
+
case PROP_DEBUG:
g_value_set_boolean (value, ide_configuration_get_debug (self));
break;
@@ -376,6 +384,10 @@ ide_configuration_set_property (GObject *object,
ide_configuration_set_build_commands (self, g_value_get_boxed (value));
break;
+ case PROP_BUILD_COMMANDS_DIR:
+ ide_configuration_set_build_commands_dir (self, g_value_get_object (value));
+ break;
+
case PROP_DEBUG:
ide_configuration_set_debug (self, g_value_get_boolean (value));
break;
@@ -460,6 +472,13 @@ ide_configuration_class_init (IdeConfigurationClass *klass)
G_TYPE_STRV,
(G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
+ properties [PROP_BUILD_COMMANDS_DIR] =
+ g_param_spec_object ("build-commands-dir",
+ "Build commands Dir",
+ "Directory to run build commands from",
+ G_TYPE_FILE,
+ (G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
+
properties [PROP_CONFIG_OPTS] =
g_param_spec_string ("config-opts",
"Config Options",
@@ -1441,3 +1460,32 @@ ide_configuration_set_locality (IdeConfiguration *self,
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_LOCALITY]);
}
}
+
+/**
+ * ide_configuration_get_build_commands_dir:
+ * @self: a #IdeConfiguration
+ *
+ * Returns: (transfer none) (nullable): a #GFile or %NULL
+ */
+GFile *
+ide_configuration_get_build_commands_dir (IdeConfiguration *self)
+{
+ IdeConfigurationPrivate *priv = ide_configuration_get_instance_private (self);
+
+ g_return_val_if_fail (IDE_IS_CONFIGURATION (self), NULL);
+
+ return priv->build_commands_dir;
+}
+
+void
+ide_configuration_set_build_commands_dir (IdeConfiguration *self,
+ GFile *build_commands_dir)
+{
+ IdeConfigurationPrivate *priv = ide_configuration_get_instance_private (self);
+
+ g_return_if_fail (IDE_IS_CONFIGURATION (self));
+ g_return_if_fail (!build_commands_dir || G_IS_FILE (build_commands_dir));
+
+ if (g_set_object (&priv->build_commands_dir, build_commands_dir))
+ g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_BUILD_COMMANDS_DIR]);
+}
diff --git a/src/libide/config/ide-configuration.h b/src/libide/config/ide-configuration.h
index c0454941d..b2b33e447 100644
--- a/src/libide/config/ide-configuration.h
+++ b/src/libide/config/ide-configuration.h
@@ -121,6 +121,11 @@ const gchar * const *ide_configuration_get_build_commands (IdeConfigurat
IDE_AVAILABLE_IN_ALL
void ide_configuration_set_build_commands (IdeConfiguration *self,
const gchar *const *build_commands);
+IDE_AVAILABLE_IN_3_30
+GFile *ide_configuration_get_build_commands_dir (IdeConfiguration *self);
+IDE_AVAILABLE_IN_3_30
+void ide_configuration_set_build_commands_dir (IdeConfiguration *self,
+ GFile
*build_commands_dir);
IDE_AVAILABLE_IN_ALL
const gchar * const *ide_configuration_get_post_install_commands (IdeConfiguration *self);
IDE_AVAILABLE_IN_ALL
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]