[gnome-builder/wip/mwleeds/ide-config-provider: 10/17] Add IdeConfigurationProvider



commit 07db3d27ee34a179559a55e7f06daacd526e7a0f
Author: Matthew Leeds <mleeds redhat com>
Date:   Wed Dec 21 13:31:05 2016 -0600

    Add IdeConfigurationProvider

 libide/Makefile.am                              |    2 +
 libide/buildsystem/OVERVIEW.md                  |    5 ++
 libide/buildsystem/ide-configuration-provider.c |   61 +++++++++++++++++++++++
 libide/buildsystem/ide-configuration-provider.h |   49 ++++++++++++++++++
 libide/ide.h                                    |    1 +
 5 files changed, 118 insertions(+), 0 deletions(-)
---
diff --git a/libide/Makefile.am b/libide/Makefile.am
index d385eb5..1db5e87 100644
--- a/libide/Makefile.am
+++ b/libide/Makefile.am
@@ -40,6 +40,7 @@ libide_1_0_la_public_headers =                            \
        buildsystem/ide-builder.h                         \
        buildsystem/ide-configuration-manager.h           \
        buildsystem/ide-configuration.h                   \
+       buildsystem/ide-configuration-provider.h          \
        buildsystem/ide-environment-variable.h            \
        buildsystem/ide-environment.h                     \
        buildsystem/ide-simple-builder.h                  \
@@ -210,6 +211,7 @@ libide_1_0_la_public_sources =                            \
        buildsystem/ide-builder.c                         \
        buildsystem/ide-configuration-manager.c           \
        buildsystem/ide-configuration.c                   \
+       buildsystem/ide-configuration-provider.c          \
        buildsystem/ide-environment-variable.c            \
        buildsystem/ide-environment.c                     \
        buildsystem/ide-simple-builder.c                  \
diff --git a/libide/buildsystem/OVERVIEW.md b/libide/buildsystem/OVERVIEW.md
index 643a506..0d9c8f2 100644
--- a/libide/buildsystem/OVERVIEW.md
+++ b/libide/buildsystem/OVERVIEW.md
@@ -32,6 +32,11 @@ file.
 
 An individual configuration that was loaded/persisted to the .buildconfig file.
 
+## ide-configuration-provider.*
+
+This is the interface used for loading and unloading configurations into the
+IdeConfigurationManager. The flatpak plugin is one place it's implemented.
+
 ## ide-environment.c
 
 Manages a collection of key/value pairs (IdeEnvironmentVariable). This is a
diff --git a/libide/buildsystem/ide-configuration-provider.c b/libide/buildsystem/ide-configuration-provider.c
new file mode 100644
index 0000000..99c2610
--- /dev/null
+++ b/libide/buildsystem/ide-configuration-provider.c
@@ -0,0 +1,61 @@
+/* ide-configuration-provider.c
+ *
+ * Copyright (C) 2016 Matthew Leeds <mleeds redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "ide-configuration-manager.h"
+#include "ide-configuration-provider.h"
+
+G_DEFINE_INTERFACE (IdeConfigurationProvider, ide_configuration_provider, G_TYPE_OBJECT)
+
+static void
+ide_configuration_provider_real_load (IdeConfigurationProvider *self,
+                                      IdeConfigurationManager  *manager)
+{
+}
+
+static void
+ide_configuration_provider_real_unload (IdeConfigurationProvider *self,
+                                        IdeConfigurationManager  *manager)
+{
+}
+
+static void
+ide_configuration_provider_default_init (IdeConfigurationProviderInterface *iface)
+{
+  iface->load = ide_configuration_provider_real_load;
+  iface->unload = ide_configuration_provider_real_unload;
+}
+
+void
+ide_configuration_provider_load (IdeConfigurationProvider *self,
+                                 IdeConfigurationManager  *manager)
+{
+  g_return_if_fail (IDE_IS_CONFIGURATION_PROVIDER (self));
+  g_return_if_fail (IDE_IS_CONFIGURATION_MANAGER (manager));
+
+  IDE_CONFIGURATION_PROVIDER_GET_IFACE (self)->load (self, manager);
+}
+
+void
+ide_configuration_provider_unload (IdeConfigurationProvider *self,
+                                   IdeConfigurationManager  *manager)
+{
+  g_return_if_fail (IDE_IS_CONFIGURATION_PROVIDER (self));
+  g_return_if_fail (IDE_IS_CONFIGURATION_MANAGER (manager));
+
+  IDE_CONFIGURATION_PROVIDER_GET_IFACE (self)->unload (self, manager);
+}
diff --git a/libide/buildsystem/ide-configuration-provider.h b/libide/buildsystem/ide-configuration-provider.h
new file mode 100644
index 0000000..6eb75d2
--- /dev/null
+++ b/libide/buildsystem/ide-configuration-provider.h
@@ -0,0 +1,49 @@
+/* ide-configuration-provider.h
+ *
+ * Copyright (C) 2016 Matthew Leeds <mleeds redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef IDE_CONFIGURATION_PROVIDER_H
+#define IDE_CONFIGURATION_PROVIDER_H
+
+#include <gio/gio.h>
+
+#include "ide-types.h"
+
+G_BEGIN_DECLS
+
+#define IDE_TYPE_CONFIGURATION_PROVIDER (ide_configuration_provider_get_type ())
+
+G_DECLARE_INTERFACE (IdeConfigurationProvider, ide_configuration_provider, IDE, CONFIGURATION_PROVIDER, 
GObject)
+
+struct _IdeConfigurationProviderInterface
+{
+  GTypeInterface parent;
+
+  void   (*load)         (IdeConfigurationProvider *self,
+                          IdeConfigurationManager  *manager);
+  void   (*unload)       (IdeConfigurationProvider *self,
+                          IdeConfigurationManager  *manager);
+};
+
+void ide_configuration_provider_load   (IdeConfigurationProvider *self,
+                                        IdeConfigurationManager  *manager);
+void ide_configuration_provider_unload (IdeConfigurationProvider *self,
+                                        IdeConfigurationManager  *manager);
+
+G_END_DECLS
+
+#endif /* IDE_CONFIGURATION_PROVIDER_H */
diff --git a/libide/ide.h b/libide/ide.h
index 78aa113..b630b53 100644
--- a/libide/ide.h
+++ b/libide/ide.h
@@ -45,6 +45,7 @@ G_BEGIN_DECLS
 #include "buildsystem/ide-builder.h"
 #include "buildsystem/ide-configuration-manager.h"
 #include "buildsystem/ide-configuration.h"
+#include "buildsystem/ide-configuration-provider.h"
 #include "buildsystem/ide-environment-variable.h"
 #include "buildsystem/ide-environment.h"
 #include "buildsystem/ide-simple-builder.h"


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