[gnome-builder] configuration: Add app-id property to IdeConfiguration



commit 3d2b9e7577b16e03e8e98ea6d57a587a03800df9
Author: Matthew Leeds <mleeds redhat com>
Date:   Thu Sep 1 22:15:19 2016 -0500

    configuration: Add app-id property to IdeConfiguration
    
    This property is especially useful for the flatpak runtime.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=773764

 libide/buildsystem/ide-configuration.c |   46 ++++++++++++++++++++++++++++++++
 libide/buildsystem/ide-configuration.h |    3 ++
 2 files changed, 49 insertions(+), 0 deletions(-)
---
diff --git a/libide/buildsystem/ide-configuration.c b/libide/buildsystem/ide-configuration.c
index 48cbce8..fc458de 100644
--- a/libide/buildsystem/ide-configuration.c
+++ b/libide/buildsystem/ide-configuration.c
@@ -42,6 +42,7 @@ struct _IdeConfiguration
   gchar          *id;
   gchar          *prefix;
   gchar          *runtime_id;
+  gchar          *app_id;
 
   IdeEnvironment *environment;
 
@@ -73,6 +74,7 @@ enum {
   PROP_PREFIX,
   PROP_RUNTIME,
   PROP_RUNTIME_ID,
+  PROP_APP_ID,
   N_PROPS
 };
 
@@ -246,6 +248,7 @@ ide_configuration_finalize (GObject *object)
   g_clear_pointer (&self->id, g_free);
   g_clear_pointer (&self->prefix, g_free);
   g_clear_pointer (&self->runtime_id, g_free);
+  g_clear_pointer (&self->app_id, g_free);
 
   G_OBJECT_CLASS (ide_configuration_parent_class)->finalize (object);
 }
@@ -304,6 +307,10 @@ ide_configuration_get_property (GObject    *object,
       g_value_set_string (value, ide_configuration_get_runtime_id (self));
       break;
 
+    case PROP_APP_ID:
+      g_value_set_string (value, ide_configuration_get_app_id (self));
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
     }
@@ -363,6 +370,10 @@ ide_configuration_set_property (GObject      *object,
       ide_configuration_set_runtime_id (self, g_value_get_string (value));
       break;
 
+    case PROP_APP_ID:
+      ide_configuration_set_app_id (self, g_value_get_string (value));
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
     }
@@ -464,6 +475,13 @@ ide_configuration_class_init (IdeConfigurationClass *klass)
                          "host",
                          (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
+  properties [PROP_APP_ID] =
+    g_param_spec_string ("app-id",
+                         "App ID",
+                         "The application ID (such as org.gnome.Builder)",
+                         NULL,
+                         (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
   g_object_class_install_properties (object_class, N_PROPS, properties);
 
   signals [CHANGED] =
@@ -581,6 +599,34 @@ ide_configuration_set_device (IdeConfiguration *self,
   ide_configuration_set_device_id (self, device_id);
 }
 
+/**
+ * ide_configuration_get_app_id:
+ * @self: An #IdeConfiguration
+ *
+ * Gets the application ID for the configuration.
+ *
+ * Returns: (transfer none) (nullable): A string.
+ */
+const gchar *
+ide_configuration_get_app_id (IdeConfiguration *self)
+{
+  g_return_val_if_fail (IDE_IS_CONFIGURATION (self), NULL);
+
+  return self->app_id;
+}
+
+void
+ide_configuration_set_app_id (IdeConfiguration *self,
+                              const gchar      *app_id)
+{
+  g_return_if_fail (IDE_IS_CONFIGURATION (self));
+  g_return_if_fail (app_id != NULL);
+
+  g_free (self->app_id);
+
+  self->app_id = g_strdup (app_id);
+}
+
 const gchar *
 ide_configuration_get_runtime_id (IdeConfiguration *self)
 {
diff --git a/libide/buildsystem/ide-configuration.h b/libide/buildsystem/ide-configuration.h
index 9e629d4..e0f8918 100644
--- a/libide/buildsystem/ide-configuration.h
+++ b/libide/buildsystem/ide-configuration.h
@@ -76,6 +76,9 @@ IdeConfiguration     *ide_configuration_duplicate            (IdeConfiguration
 guint                 ide_configuration_get_sequence         (IdeConfiguration  *self);
 IdeBuildCommandQueue *ide_configuration_get_prebuild         (IdeConfiguration  *self);
 IdeBuildCommandQueue *ide_configuration_get_postbuild        (IdeConfiguration  *self);
+const gchar          *ide_configuration_get_app_id           (IdeConfiguration  *self);
+void                  ide_configuration_set_app_id           (IdeConfiguration  *self,
+                                                              const gchar        *app_id);
 const gchar          *ide_configuration_get_internal_string  (IdeConfiguration  *self,
                                                               const gchar       *key);
 void                  ide_configuration_set_internal_string  (IdeConfiguration  *self,


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