[gnome-builder] foundry: add API to get extension runtimes



commit 70de8d66ea62b83b100a18e60f50c3dc2f545341
Author: Christian Hergert <chergert redhat com>
Date:   Thu Aug 1 17:09:44 2019 -0700

    foundry: add API to get extension runtimes

 src/libide/foundry/ide-config.c | 29 +++++++++++++++++++++++++++++
 src/libide/foundry/ide-config.h | 15 +++++++++------
 2 files changed, 38 insertions(+), 6 deletions(-)
---
diff --git a/src/libide/foundry/ide-config.c b/src/libide/foundry/ide-config.c
index b5403fc74..cb09336b9 100644
--- a/src/libide/foundry/ide-config.c
+++ b/src/libide/foundry/ide-config.c
@@ -1765,3 +1765,32 @@ ide_config_set_prefix_set (IdeConfig *self,
       g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_PREFIX_SET]);
     }
 }
+
+/**
+ * ide_config_get_extensions:
+ * @self: a #IdeConfig
+ *
+ * Gets the known SDK extensions that will be used when building the project.
+ * Implementing this in your configuration backend allows plugins to know if
+ * additional binaries will be available to the build system.
+ *
+ * Returns: (not nullable) (transfer full) (element-type Ide.Runtime): an array
+ *   of #IdeRuntime for the runtime extensions for the configuration.
+ *
+ * Since: 3.34
+ */
+GPtrArray *
+ide_config_get_extensions (IdeConfig *self)
+{
+  GPtrArray *ret = NULL;
+
+  g_return_val_if_fail (IDE_IS_CONFIG (self), NULL);
+
+  if (IDE_CONFIG_GET_CLASS (self)->get_extensions)
+   ret = IDE_CONFIG_GET_CLASS (self)->get_extensions (self);
+
+  if (ret == NULL)
+    ret = g_ptr_array_new ();
+
+  return g_steal_pointer (&ret);
+}
diff --git a/src/libide/foundry/ide-config.h b/src/libide/foundry/ide-config.h
index e5ccb7793..6eedd5c57 100644
--- a/src/libide/foundry/ide-config.h
+++ b/src/libide/foundry/ide-config.h
@@ -47,14 +47,15 @@ struct _IdeConfigClass
 {
   IdeObjectClass parent;
 
-  IdeRuntime *(*get_runtime)      (IdeConfig *self);
-  void        (*set_runtime)      (IdeConfig *self,
-                                   IdeRuntime       *runtime);
-  gboolean    (*supports_runtime) (IdeConfig *self,
-                                   IdeRuntime       *runtime);
+  IdeRuntime *(*get_runtime)      (IdeConfig  *self);
+  void        (*set_runtime)      (IdeConfig  *self,
+                                   IdeRuntime *runtime);
+  gboolean    (*supports_runtime) (IdeConfig  *self,
+                                   IdeRuntime *runtime);
+  GPtrArray  *(*get_extensions)   (IdeConfig  *self);
 
   /*< private >*/
-  gpointer _reserved[16];
+  gpointer _reserved[15];
 };
 
 IDE_AVAILABLE_IN_3_32
@@ -215,5 +216,7 @@ IDE_AVAILABLE_IN_3_32
 void                  ide_config_set_internal_object       (IdeConfig             *self,
                                                             const gchar           *key,
                                                             gpointer               instance);
+IDE_AVAILABLE_IN_3_34
+GPtrArray            *ide_config_get_extensions            (IdeConfig             *self);
 
 G_END_DECLS


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