[gnome-builder/wip/mwleeds/ide-config-provider: 3/6] Create GbpFlatpakConfiguration



commit 3991deb8f710ada5727b8110266cca989354452c
Author: Matthew Leeds <mleeds redhat com>
Date:   Thu Dec 22 16:08:18 2016 -0600

    Create GbpFlatpakConfiguration

 plugins/flatpak/Makefile.am                 |    2 +
 plugins/flatpak/gbp-flatpak-configuration.c |  115 +++++++++++++++++++++++++++
 plugins/flatpak/gbp-flatpak-configuration.h |   32 ++++++++
 3 files changed, 149 insertions(+), 0 deletions(-)
---
diff --git a/plugins/flatpak/Makefile.am b/plugins/flatpak/Makefile.am
index 4cc85e6..61f5441 100644
--- a/plugins/flatpak/Makefile.am
+++ b/plugins/flatpak/Makefile.am
@@ -10,6 +10,8 @@ plugin_LTLIBRARIES = libflatpak-plugin.la
 dist_plugin_DATA = flatpak.plugin
 
 libflatpak_plugin_la_SOURCES = \
+       gbp-flatpak-configuration.c \
+       gbp-flatpak-configuration.h \
        gbp-flatpak-configuration-provider.c \
        gbp-flatpak-configuration-provider.h \
        gbp-flatpak-runtime-provider.c \
diff --git a/plugins/flatpak/gbp-flatpak-configuration.c b/plugins/flatpak/gbp-flatpak-configuration.c
new file mode 100644
index 0000000..06cefae
--- /dev/null
+++ b/plugins/flatpak/gbp-flatpak-configuration.c
@@ -0,0 +1,115 @@
+/* gbp-flatpak-configuration.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/>.
+ */
+
+#define G_LOG_DOMAIN "gbp-flatpak-configuration"
+
+#include "ide-debug.h"
+
+#include "gbp-flatpak-configuration.h"
+#include "buildsystem/ide-configuration.h"
+
+struct _GbpFlatpakConfiguration
+{
+  IdeConfiguration parent_instance;
+
+  gchar *primary_module;
+};
+
+G_DEFINE_TYPE (GbpFlatpakConfiguration, gbp_flatpak_configuration, IDE_TYPE_CONFIGURATION)
+
+enum {
+  PROP_0,
+  PROP_PRIMARY_MODULE,
+  N_PROPS
+};
+
+static GParamSpec *properties [N_PROPS];
+
+static void
+gbp_flatpak_configuration_get_property (GObject    *object,
+                                        guint       prop_id,
+                                        GValue     *value,
+                                        GParamSpec *pspec)
+{
+  GbpFlatpakConfiguration *self = GBP_FLATPAK_CONFIGURATION (object);
+
+  switch (prop_id)
+    {
+    case PROP_PRIMARY_MODULE:
+      g_value_set_string (value, self->primary_module);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    }
+}
+
+static void
+gbp_flatpak_configuration_set_property (GObject      *object,
+                                        guint         prop_id,
+                                        const GValue *value,
+                                        GParamSpec   *pspec)
+{
+  GbpFlatpakConfiguration *self = GBP_FLATPAK_CONFIGURATION (object);
+
+  switch (prop_id)
+    {
+    case PROP_PRIMARY_MODULE:
+      self->primary_module = g_value_dup_string (value);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    }
+}
+
+static void
+gbp_flatpak_configuration_finalize (GObject *object)
+{
+  GbpFlatpakConfiguration *self = (GbpFlatpakConfiguration *)object;
+
+  g_clear_pointer (&self->primary_module, g_free);
+
+  G_OBJECT_CLASS (gbp_flatpak_configuration_parent_class)->finalize (object);
+}
+
+static void
+gbp_flatpak_configuration_class_init (GbpFlatpakConfigurationClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->finalize = gbp_flatpak_configuration_finalize;
+  object_class->get_property = gbp_flatpak_configuration_get_property;
+  object_class->set_property = gbp_flatpak_configuration_set_property;
+
+  properties [PROP_PRIMARY_MODULE] =
+    g_param_spec_string ("primary-module",
+                         "Primary module",
+                         "Primary module",
+                         NULL,
+                         (G_PARAM_READWRITE |
+                          G_PARAM_CONSTRUCT |
+                          G_PARAM_STATIC_STRINGS));
+
+  g_object_class_install_properties (object_class, N_PROPS, properties);
+}
+
+static void
+gbp_flatpak_configuration_init (GbpFlatpakConfiguration *self)
+{
+}
diff --git a/plugins/flatpak/gbp-flatpak-configuration.h b/plugins/flatpak/gbp-flatpak-configuration.h
new file mode 100644
index 0000000..44539a5
--- /dev/null
+++ b/plugins/flatpak/gbp-flatpak-configuration.h
@@ -0,0 +1,32 @@
+/* gbp-flatpak-configuration.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 GBP_FLATPAK_CONFIGURATION_H
+#define GBP_FLATPAK_CONFIGURATION_H
+
+#include <ide.h>
+
+G_BEGIN_DECLS
+
+#define GBP_TYPE_FLATPAK_CONFIGURATION (gbp_flatpak_configuration_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpFlatpakConfiguration, gbp_flatpak_configuration, GBP, FLATPAK_CONFIGURATION, 
IdeConfiguration)
+
+G_END_DECLS
+
+#endif /* GBP_FLATPAK_CONFIGURATION_H */


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