[gnome-builder/wip/tintou/jhbuild: 2/3] Initial work on the addition of cross-platform compilation support
- From: Corentin Noël <corentinnoel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/tintou/jhbuild: 2/3] Initial work on the addition of cross-platform compilation support
- Date: Tue, 13 Feb 2018 09:45:23 +0000 (UTC)
commit 220fa2677f9410c0d3743f8a74d36f2b7ff87a1f
Author: Corentin Noël <corentin noel collabora co uk>
Date: Wed Feb 7 17:56:42 2018 +0000
Initial work on the addition of cross-platform compilation support
meson_options.txt | 1 +
.../cross-compilation/cross-compilation-plugin.c | 49 +++++
.../cross-compilation.gresource.xml | 6 +
.../cross-compilation/cross-compilation.plugin | 8 +
.../ide-cross-compilation-device-provider.c | 162 ++++++++++++++
.../ide-cross-compilation-device-provider.h | 33 +++
.../ide-cross-compilation-device.c | 101 +++++++++
.../ide-cross-compilation-device.h | 38 ++++
.../ide-cross-compilation-preferences-addin.c | 244 +++++++++++++++++++++
.../ide-cross-compilation-preferences-addin.h | 33 +++
src/plugins/cross-compilation/meson.build | 19 ++
src/plugins/meson.build | 2 +
12 files changed, 696 insertions(+)
---
diff --git a/meson_options.txt b/meson_options.txt
index 3b97300c8..aa9804489 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -30,6 +30,7 @@ option('with_code_index', type: 'boolean')
option('with_command_bar', type: 'boolean')
option('with_comment_code', type: 'boolean')
option('with_create_project', type: 'boolean')
+option('with_cross_compilation', type: 'boolean')
option('with_ctags', type: 'boolean')
option('with_documentation_card', type: 'boolean')
option('with_devhelp', type: 'boolean')
diff --git a/src/plugins/cross-compilation/cross-compilation-plugin.c
b/src/plugins/cross-compilation/cross-compilation-plugin.c
new file mode 100644
index 000000000..a654eedaa
--- /dev/null
+++ b/src/plugins/cross-compilation/cross-compilation-plugin.c
@@ -0,0 +1,49 @@
+/* ide-cross-compilation-plugin.c
+ *
+ * Copyright (C) 2018 Corentin Noël <corentin noel collabora co uk>
+ * Copyright (C) 2018 Collabora Ltd.
+ *
+ * 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-cross-compilation-device-provider.h"
+#include "ide-cross-compilation-device.h"
+#include "ide-cross-compilation-preferences-addin.h"
+
+#include <libpeas/peas.h>
+#include <ide.h>
+
+void _ide_cross_compilation_device_provider_register_type (GTypeModule *module);
+void _ide_cross_compilation_device_register_type (GTypeModule *module);
+void _ide_cross_compilation_preferences_addin_register_type (GTypeModule *module);
+
+void
+ide_cross_compilation_register_types (PeasObjectModule *module)
+{
+ _ide_cross_compilation_device_provider_register_type (G_TYPE_MODULE (module));
+ _ide_cross_compilation_device_register_type (G_TYPE_MODULE (module));
+ _ide_cross_compilation_preferences_addin_register_type (G_TYPE_MODULE (module));
+
+ peas_object_module_register_extension_type (module,
+ IDE_TYPE_DEVICE_PROVIDER,
+ IDE_TYPE_CROSS_COMPILATION_DEVICE_PROVIDER);
+
+ peas_object_module_register_extension_type (module,
+ IDE_TYPE_DEVICE,
+ IDE_TYPE_CROSS_COMPILATION_DEVICE);
+
+ peas_object_module_register_extension_type (module,
+ IDE_TYPE_PREFERENCES_ADDIN,
+ IDE_TYPE_CROSS_COMPILATION_PREFERENCES_ADDIN);
+}
diff --git a/src/plugins/cross-compilation/cross-compilation.gresource.xml
b/src/plugins/cross-compilation/cross-compilation.gresource.xml
new file mode 100644
index 000000000..28c498c5e
--- /dev/null
+++ b/src/plugins/cross-compilation/cross-compilation.gresource.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+ <gresource prefix="/org/gnome/builder/plugins">
+ <file>cross-compilation.plugin</file>
+ </gresource>
+</gresources>
diff --git a/src/plugins/cross-compilation/cross-compilation.plugin
b/src/plugins/cross-compilation/cross-compilation.plugin
new file mode 100644
index 000000000..e8c78c4c9
--- /dev/null
+++ b/src/plugins/cross-compilation/cross-compilation.plugin
@@ -0,0 +1,8 @@
+[Plugin]
+Module=cross-compilation-plugin
+Name=Cross-Compilation
+Description=Provides support for cross-compilation
+Authors=Corentin Noël <corentin noel collabora co uk>
+Copyright=Copyright © 2018 Collabora Ltd.
+Builtin=true
+Embedded=ide_cross_compilation_register_types
diff --git a/src/plugins/cross-compilation/ide-cross-compilation-device-provider.c
b/src/plugins/cross-compilation/ide-cross-compilation-device-provider.c
new file mode 100644
index 000000000..65924032c
--- /dev/null
+++ b/src/plugins/cross-compilation/ide-cross-compilation-device-provider.c
@@ -0,0 +1,162 @@
+/* ide-cross-compilation-device-provider.c
+ *
+ * Copyright (C) 2018 Corentin Noël <corentin noel collabora co uk>
+ * Copyright (C) 2018 Collabora Ltd.
+ *
+ * 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-cross-compilation-device-provider.h"
+#include "ide-cross-compilation-device.h"
+
+struct _IdeCrossCompilationDeviceProvider
+{
+ IdeObject parent_instance;
+
+ GPtrArray *devices;
+
+ guint settled : 1;
+};
+
+static void device_provider_iface_init (IdeDeviceProviderInterface *iface);
+static void context_loaded (IdeContext* context, gpointer user_data);
+
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (IdeCrossCompilationDeviceProvider,
+ ide_cross_compilation_device_provider,
+ IDE_TYPE_OBJECT,
+ 0,
+ G_IMPLEMENT_INTERFACE (IDE_TYPE_DEVICE_PROVIDER,
+ device_provider_iface_init))
+
+enum {
+ PROP_0,
+ PROP_SETTLED,
+ LAST_PROP
+};
+
+static GParamSpec *properties [LAST_PROP];
+
+static GPtrArray *
+ide_cross_compilation_device_provider_get_devices (IdeDeviceProvider *provider)
+{
+ IdeCrossCompilationDeviceProvider *self = IDE_CROSS_COMPILATION_DEVICE_PROVIDER(provider);
+
+ g_return_val_if_fail (IDE_IS_CROSS_COMPILATION_DEVICE_PROVIDER (self), NULL);
+
+ return g_ptr_array_ref (self->devices);
+}
+
+static void
+ide_cross_compilation_device_provider_constructed (GObject *object)
+{
+ IdeCrossCompilationDeviceProvider *self = IDE_CROSS_COMPILATION_DEVICE_PROVIDER(object);
+ IdeContext *context;
+
+ g_assert (IDE_IS_CROSS_COMPILATION_DEVICE_PROVIDER (self));
+
+ context = ide_object_get_context (IDE_OBJECT(object));
+ g_signal_connect (context, "loaded", G_CALLBACK (context_loaded), self);
+
+ self->settled = TRUE;
+ g_object_notify_by_pspec (object, properties [PROP_SETTLED]);
+}
+
+static void
+ide_cross_compilation_device_provider_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ IdeCrossCompilationDeviceProvider *self = IDE_CROSS_COMPILATION_DEVICE_PROVIDER(object);
+
+ switch (prop_id)
+ {
+ case PROP_SETTLED:
+ g_value_set_boolean (value, self->settled);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ }
+}
+
+static void
+ide_cross_compilation_device_provider_init (IdeCrossCompilationDeviceProvider *self)
+{
+ self->devices = g_ptr_array_new_with_free_func (g_object_unref);
+}
+
+static void
+ide_cross_compilation_device_provider_finalize (GObject *object)
+{
+ IdeCrossCompilationDeviceProvider *self = IDE_CROSS_COMPILATION_DEVICE_PROVIDER(object);
+
+ g_clear_pointer (&self->devices, g_ptr_array_unref);
+
+ G_OBJECT_CLASS (ide_cross_compilation_device_provider_parent_class)->finalize (object);
+}
+
+static void
+ide_cross_compilation_device_provider_class_init (IdeCrossCompilationDeviceProviderClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->constructed = ide_cross_compilation_device_provider_constructed;
+ object_class->finalize = ide_cross_compilation_device_provider_finalize;
+ object_class->get_property = ide_cross_compilation_device_provider_get_property;
+
+ properties [PROP_SETTLED] =
+ g_param_spec_boolean ("settled",
+ "Settled",
+ "Settled",
+ FALSE,
+ (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_properties (object_class, LAST_PROP, properties);
+}
+
+static void ide_cross_compilation_device_provider_class_finalize (IdeCrossCompilationDeviceProviderClass
*klass) {
+
+}
+
+static void
+device_provider_iface_init (IdeDeviceProviderInterface *iface)
+{
+ iface->get_devices = ide_cross_compilation_device_provider_get_devices;
+}
+
+static void
+context_loaded (IdeContext* context,
+ gpointer user_data)
+{
+ IdeDevice *device;
+ IdeBuildSystem *build_system;
+ IdeCrossCompilationDeviceProvider *self = IDE_CROSS_COMPILATION_DEVICE_PROVIDER(user_data);
+ gchar *build_id;
+
+ build_system = ide_context_get_build_system (context);
+ build_id = ide_build_system_get_id (build_system);
+ device = ide_cross_compilation_device_new (ide_object_get_context (IDE_OBJECT (self)),
+ "ARM Device",
+ "super-test",
+ "x86_64-linux-gnu");
+ g_ptr_array_add (self->devices, device);
+ ide_device_provider_emit_device_added (IDE_DEVICE_PROVIDER (self), device);
+}
+
+void
+_ide_cross_compilation_device_provider_register_type (GTypeModule *module)
+{
+ ide_cross_compilation_device_provider_register_type (module);
+}
diff --git a/src/plugins/cross-compilation/ide-cross-compilation-device-provider.h
b/src/plugins/cross-compilation/ide-cross-compilation-device-provider.h
new file mode 100644
index 000000000..46464bf25
--- /dev/null
+++ b/src/plugins/cross-compilation/ide-cross-compilation-device-provider.h
@@ -0,0 +1,33 @@
+/* ide-cross-compilation-device-provider.h
+ *
+ * Copyright (C) 2018 Corentin Noël <corentin noel collabora co uk>
+ * Copyright (C) 2018 Collabora Ltd.
+ *
+ * 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_CROSS_COMPILATION_DEVICE_PROVIDER_H
+#define IDE_CROSS_COMPILATION_DEVICE_PROVIDER_H
+
+#include <ide.h>
+
+G_BEGIN_DECLS
+
+#define IDE_TYPE_CROSS_COMPILATION_DEVICE_PROVIDER (ide_cross_compilation_device_provider_get_type())
+
+G_DECLARE_FINAL_TYPE (IdeCrossCompilationDeviceProvider, ide_cross_compilation_device_provider, IDE,
CROSS_COMPILATION_DEVICE_PROVIDER, IdeObject)
+
+G_END_DECLS
+
+#endif /* IDE_CROSS_COMPILATION_DEVICE_PROVIDER_H */
diff --git a/src/plugins/cross-compilation/ide-cross-compilation-device.c
b/src/plugins/cross-compilation/ide-cross-compilation-device.c
new file mode 100644
index 000000000..ba6fbd22b
--- /dev/null
+++ b/src/plugins/cross-compilation/ide-cross-compilation-device.c
@@ -0,0 +1,101 @@
+/* ide-cross-compilation-device.c
+ *
+ * Copyright (C) 2018 Corentin Noël <corentin noel collabora co uk>
+ * Copyright (C) 2018 Collabora Ltd.
+ *
+ * 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-cross-compilation-device.h"
+
+struct _IdeCrossCompilationDevice
+{
+ IdeDevice parent_instance;
+ gchar *system_type;
+};
+
+G_DEFINE_DYNAMIC_TYPE (IdeCrossCompilationDevice, ide_cross_compilation_device, IDE_TYPE_DEVICE)
+
+IdeDevice *
+ide_cross_compilation_device_new (IdeContext *context,
+ const gchar *display_name,
+ const gchar *id,
+ const gchar *system_type)
+{
+ IdeCrossCompilationDevice *self;
+
+ self = g_object_new (IDE_TYPE_CROSS_COMPILATION_DEVICE,
+ "context", context,
+ "display-name", display_name,
+ "id", id,
+ NULL);
+
+ self->system_type = g_strdup (system_type);
+
+ return IDE_DEVICE (self);
+}
+
+static const gchar *
+ide_cross_compilation_device_get_system_type (IdeDevice *device)
+{
+ IdeCrossCompilationDevice *self = IDE_CROSS_COMPILATION_DEVICE(device);
+
+ g_assert (IDE_IS_CROSS_COMPILATION_DEVICE (self));
+
+ return self->system_type;
+}
+
+void ide_cross_compilation_device_prepare_configuration (IdeDevice *self,
+ IdeConfiguration *configuration)
+{
+ g_critical("Here~~\n");
+}
+
+static void
+ide_cross_compilation_device_init (IdeCrossCompilationDevice *self) {
+
+}
+
+static void
+ide_cross_compilation_device_finalize (GObject *object)
+{
+ IdeCrossCompilationDevice *self = IDE_CROSS_COMPILATION_DEVICE(object);
+
+ g_clear_pointer (&self->system_type, g_free);
+
+ G_OBJECT_CLASS (ide_cross_compilation_device_parent_class)->finalize (object);
+}
+
+static void
+ide_cross_compilation_device_class_init (IdeCrossCompilationDeviceClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ IdeDeviceClass *device_class = IDE_DEVICE_CLASS (klass);
+
+ object_class->finalize = ide_cross_compilation_device_finalize;
+
+ device_class->get_system_type = ide_cross_compilation_device_get_system_type;
+ device_class->prepare_configuration = ide_cross_compilation_device_prepare_configuration;
+}
+
+static void ide_cross_compilation_device_class_finalize (IdeCrossCompilationDeviceClass *klass) {
+
+}
+
+void
+_ide_cross_compilation_device_register_type (GTypeModule *module)
+{
+ ide_cross_compilation_device_register_type (module);
+}
+
diff --git a/src/plugins/cross-compilation/ide-cross-compilation-device.h
b/src/plugins/cross-compilation/ide-cross-compilation-device.h
new file mode 100644
index 000000000..00eefa48b
--- /dev/null
+++ b/src/plugins/cross-compilation/ide-cross-compilation-device.h
@@ -0,0 +1,38 @@
+/* ide-cross-compilation-device.h
+ *
+ * Copyright (C) 2018 Corentin Noël <corentin noel collabora co uk>
+ * Copyright (C) 2018 Collabora Ltd.
+ *
+ * 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_CROSS_COMPILATION_DEVICE_H
+#define IDE_CROSS_COMPILATION_DEVICE_H
+
+#include <ide.h>
+
+G_BEGIN_DECLS
+
+#define IDE_TYPE_CROSS_COMPILATION_DEVICE (ide_cross_compilation_device_get_type())
+
+G_DECLARE_FINAL_TYPE (IdeCrossCompilationDevice, ide_cross_compilation_device, IDE,
CROSS_COMPILATION_DEVICE, IdeDevice)
+
+IdeDevice *ide_cross_compilation_device_new (IdeContext *context,
+ const gchar *display_name,
+ const gchar *id,
+ const gchar *system_type);
+
+G_END_DECLS
+
+#endif /* IDE_CROSS_COMPILATION_DEVICE_H */
diff --git a/src/plugins/cross-compilation/ide-cross-compilation-preferences-addin.c
b/src/plugins/cross-compilation/ide-cross-compilation-preferences-addin.c
new file mode 100644
index 000000000..103d1ba47
--- /dev/null
+++ b/src/plugins/cross-compilation/ide-cross-compilation-preferences-addin.c
@@ -0,0 +1,244 @@
+/* ide-cross-compilation-preference-addin.c
+ *
+ * Copyright (C) 2018 Corentin Noël <corentin noel collabora co uk>
+ * Copyright (C) 2018 Collabora Ltd.
+ *
+ * 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 <dazzle.h>
+#include <glib/gi18n.h>
+
+#include "ide-cross-compilation-preferences-addin.h"
+
+struct _IdeCrossCompilationPreferencesAddin
+{
+ GObject parent_instance;
+
+ GArray *ids;
+ DzlPreferences *preferences;
+};
+
+static void preferences_addin_iface_init (IdePreferencesAddinInterface *iface);
+
+static GtkWidget *create_new_device_row (IdeCrossCompilationPreferencesAddin *self);
+
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (IdeCrossCompilationPreferencesAddin,
+ ide_cross_compilation_preferences_addin,
+ IDE_TYPE_OBJECT,
+ 0,
+ G_IMPLEMENT_INTERFACE (IDE_TYPE_PREFERENCES_ADDIN,
+ preferences_addin_iface_init))
+
+static void
+cross_compilation_preferences_foreach_build_system (PeasExtensionSet *set,
+ PeasPluginInfo *info,
+ PeasExtension *exten,
+ gpointer data)
+{
+ IdeCrossCompilationPreferencesAddin *self = IDE_CROSS_COMPILATION_PREFERENCES_ADDIN (data);
+ IdeBuildSystem *build_system = IDE_BUILD_SYSTEM (exten);
+ gchar *build_system_name = ide_build_system_get_display_name (build_system);
+ gchar *build_system_id = ide_build_system_get_id (build_system);
+ GtkWidget *target_name;
+ guint id;
+
+ dzl_preferences_add_list_group (self->preferences, "devices.id", build_system_id, build_system_name,
GTK_SELECTION_NONE, 0);
+
+ target_name = g_object_new (DZL_TYPE_PREFERENCES_ENTRY,
+ "visible", TRUE,
+ "title", _("Target Name"),
+ NULL);
+ id = dzl_preferences_add_custom (self->preferences, "devices.id", build_system_id, target_name, "device
name", 0);
+ g_array_append_val (self->ids, id);
+}
+
+static void
+ide_cross_compilation_preferences_addin_load (IdePreferencesAddin *addin,
+ DzlPreferences *preferences)
+{
+ IdeCrossCompilationPreferencesAddin *self = IDE_CROSS_COMPILATION_PREFERENCES_ADDIN(addin);
+ GtkWidget *add_row, *flow, *device_name;
+ guint id;
+ GObject *context;
+ PeasExtensionSet *build_systems;
+
+ IDE_ENTRY;
+
+ g_assert (IDE_IS_CROSS_COMPILATION_PREFERENCES_ADDIN (self));
+ g_assert (DZL_IS_PREFERENCES (preferences));
+
+ self->ids = g_array_new (FALSE, FALSE, sizeof (guint));
+ self->preferences = preferences;
+
+ dzl_preferences_add_page (preferences, "devices", _("Devices"), 200);
+
+ dzl_preferences_add_list_group (preferences, "devices", "devices", NULL, GTK_SELECTION_SINGLE, 0);
+
+ dzl_preferences_add_list_group (preferences, "devices", "add-device", NULL, GTK_SELECTION_NONE, 1);
+ add_row = create_new_device_row (self);
+ id = dzl_preferences_add_custom (preferences, "devices", "add-device", add_row, "targets test", 0);
+ g_array_append_val (self->ids, id);
+
+ flow = gtk_widget_get_ancestor (add_row, DZL_TYPE_COLUMN_LAYOUT);
+
+ g_assert (flow != NULL);
+
+ dzl_column_layout_set_max_columns (DZL_COLUMN_LAYOUT (flow), 1);
+
+ dzl_preferences_add_page (self->preferences, "devices.id", NULL, 0);
+ dzl_preferences_add_list_group (self->preferences, "devices.id", "general", _("General"),
GTK_SELECTION_NONE, 0);
+
+ device_name = g_object_new (DZL_TYPE_PREFERENCES_ENTRY,
+ "visible", TRUE,
+ "title", _("Name"),
+ NULL);
+ id = dzl_preferences_add_custom (self->preferences, "devices.id", "general", device_name, "device name",
0);
+ g_array_append_val (self->ids, id);
+
+ /* List all the build systems to allow the configuration of each.
+ */
+ context = g_object_new (IDE_TYPE_CONTEXT, NULL);
+ build_systems = peas_extension_set_new (NULL, IDE_TYPE_BUILD_SYSTEM, "context", context, NULL);
+ peas_extension_set_foreach (build_systems, cross_compilation_preferences_foreach_build_system, self);
+
+ g_object_unref (build_systems);
+ g_object_unref (context);
+
+ IDE_EXIT;
+}
+
+static void
+ide_cross_compilation_preferences_addin_unload (IdePreferencesAddin *addin,
+ DzlPreferences *preferences)
+{
+ IdeCrossCompilationPreferencesAddin *self = IDE_CROSS_COMPILATION_PREFERENCES_ADDIN (addin);
+
+ IDE_ENTRY;
+
+ g_assert (IDE_IS_CROSS_COMPILATION_PREFERENCES_ADDIN (self));
+ g_assert (DZL_IS_PREFERENCES (preferences));
+
+ /* Clear preferences so reload code doesn't try to
+ * make forward progress updating items.
+ */
+ self->preferences = NULL;
+
+ for (guint i = 0; i < self->ids->len; i++)
+ {
+ guint id = g_array_index (self->ids, guint, i);
+
+ dzl_preferences_remove_id (preferences, id);
+ }
+
+ g_clear_pointer (&self->ids, g_array_unref);
+
+ IDE_EXIT;
+}
+
+static void
+preferences_addin_iface_init (IdePreferencesAddinInterface *iface)
+{
+ iface->load = ide_cross_compilation_preferences_addin_load;
+ iface->unload = ide_cross_compilation_preferences_addin_unload;
+}
+
+static void
+ide_cross_compilation_preferences_addin_class_init (IdeCrossCompilationPreferencesAddinClass *klass)
+{
+
+}
+
+static void ide_cross_compilation_preferences_addin_class_finalize (IdeCrossCompilationPreferencesAddinClass
*klass) {
+
+}
+
+static void
+ide_cross_compilation_preferences_addin_init (IdeCrossCompilationPreferencesAddin *self)
+{
+
+}
+
+static void
+ide_cross_compilation_preferences_addin_add_device (IdeCrossCompilationPreferencesAddin *self,
+ DzlPreferencesBin *bin)
+{
+ g_assert (IDE_IS_CROSS_COMPILATION_PREFERENCES_ADDIN (self));
+ g_assert (DZL_IS_PREFERENCES_BIN (bin));
+
+ if (self->preferences != NULL)
+ {
+ GHashTable *map = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_free);
+ g_hash_table_insert (map, "{id}",0);
+ dzl_preferences_set_page (self->preferences, "devices.id", map);
+ g_hash_table_unref (map);
+ }
+}
+
+static GtkWidget *
+create_new_device_row (IdeCrossCompilationPreferencesAddin *self)
+{
+ GtkWidget *grid, *label, *subtitle, *image, *row;
+ GtkStyleContext *style;
+
+ grid = g_object_new (GTK_TYPE_GRID,
+ "orientation", GTK_ORIENTATION_HORIZONTAL,
+ "visible", TRUE,
+ NULL);
+
+ label = g_object_new (GTK_TYPE_LABEL,
+ "hexpand", TRUE,
+ "label", _("Add New Device"),
+ "visible", TRUE,
+ "xalign", 0.0f,
+ NULL);
+
+ subtitle = g_object_new (GTK_TYPE_LABEL,
+ "hexpand", TRUE,
+ "label", g_markup_printf_escaped ("<small>%s</small>", _("Add another device if
your project targets another architecture or board than the once you are currently using")),
+ "use-markup", TRUE,
+ "wrap", TRUE,
+ "visible", TRUE,
+ "xalign", 0.0f,
+ NULL);
+ style = gtk_widget_get_style_context (subtitle);
+ gtk_style_context_add_class (style, GTK_STYLE_CLASS_DIM_LABEL);
+
+ image = g_object_new (GTK_TYPE_IMAGE,
+ "icon-name", "list-add-symbolic",
+ "visible", TRUE,
+ NULL);
+
+ gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 1, 1);
+ gtk_grid_attach (GTK_GRID (grid), subtitle, 0, 1, 1, 1);
+ gtk_grid_attach (GTK_GRID (grid), image, 1, 0, 1, 2);
+
+ row = g_object_new (DZL_TYPE_PREFERENCES_BIN,
+ "child", grid,
+ "visible", TRUE,
+ NULL);
+
+ g_signal_connect_object (row,
+ "preference-activated",
+ G_CALLBACK (ide_cross_compilation_preferences_addin_add_device),
+ self,
+ G_CONNECT_SWAPPED);
+ return row;
+}
+
+void
+_ide_cross_compilation_preferences_addin_register_type (GTypeModule *module)
+{
+ ide_cross_compilation_preferences_addin_register_type (module);
+}
diff --git a/src/plugins/cross-compilation/ide-cross-compilation-preferences-addin.h
b/src/plugins/cross-compilation/ide-cross-compilation-preferences-addin.h
new file mode 100644
index 000000000..9d6369997
--- /dev/null
+++ b/src/plugins/cross-compilation/ide-cross-compilation-preferences-addin.h
@@ -0,0 +1,33 @@
+/* ide-cross-compilation-preference-addin.h
+ *
+ * Copyright (C) 2018 Corentin Noël <corentin noel collabora co uk>
+ * Copyright (C) 2018 Collabora Ltd.
+ *
+ * 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_CROSS_COMPILATION_PREFERENCES_ADDIN_H
+#define IDE_CROSS_COMPILATION_PREFERENCES_ADDIN_H
+
+#include <ide.h>
+
+G_BEGIN_DECLS
+
+#define IDE_TYPE_CROSS_COMPILATION_PREFERENCES_ADDIN (ide_cross_compilation_preferences_addin_get_type())
+
+G_DECLARE_FINAL_TYPE (IdeCrossCompilationPreferencesAddin, ide_cross_compilation_preferences_addin, IDE,
CROSS_COMPILATION_PREFERENCES_ADDIN, IdeObject)
+
+G_END_DECLS
+
+#endif /* IDE_CROSS_COMPILATION_PREFERENCES_ADDIN_H */
diff --git a/src/plugins/cross-compilation/meson.build b/src/plugins/cross-compilation/meson.build
new file mode 100644
index 000000000..666bdf086
--- /dev/null
+++ b/src/plugins/cross-compilation/meson.build
@@ -0,0 +1,19 @@
+if get_option('with_cross_compilation')
+
+cross_compilation_resources = gnome.compile_resources(
+ 'cross-compilation-resources',
+ 'cross-compilation.gresource.xml',
+ c_name: 'ide_cross_compilation',
+)
+
+cross_compilation_sources = [
+ 'cross-compilation-plugin.c',
+ 'ide-cross-compilation-device.c',
+ 'ide-cross-compilation-device-provider.c',
+ 'ide-cross-compilation-preferences-addin.c'
+]
+
+gnome_builder_plugins_sources += files(cross_compilation_sources)
+gnome_builder_plugins_sources += cross_compilation_resources[0]
+
+endif
diff --git a/src/plugins/meson.build b/src/plugins/meson.build
index b0ae89ff4..2916e172c 100644
--- a/src/plugins/meson.build
+++ b/src/plugins/meson.build
@@ -22,6 +22,7 @@ subdir('color-picker')
subdir('command-bar')
subdir('comment-code')
subdir('create-project')
+subdir('cross-compilation')
subdir('ctags')
subdir('documentation-card')
subdir('devhelp')
@@ -101,6 +102,7 @@ status += [
'Color Picker .......... : @0@'.format(get_option('with_color_picker')),
'Command Bar ........... : @0@'.format(get_option('with_command_bar')),
'Comment Code .......... : @0@'.format(get_option('with_comment_code')),
+ 'Cross-Compilation ..... : @0@'.format(get_option('with_cross_compilation')),
'Project Wizard ........ : @0@'.format(get_option('with_create_project')),
'CTags ................. : @0@'.format(get_option('with_ctags')),
'Devhelp ............... : @0@'.format(get_option('with_devhelp')),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]