[gnome-builder: 126/139] sysroot: port to libide-foundry



commit 294a19cb0400c5cf9e13b159f94c5d62038b9796
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jan 9 17:39:56 2019 -0800

    sysroot: port to libide-foundry

 src/plugins/sysroot/gbp-sysroot-manager.c          | 24 -------------------
 src/plugins/sysroot/gbp-sysroot-manager.h          |  2 +-
 .../sysroot/gbp-sysroot-preferences-addin.c        |  1 +
 .../sysroot/gbp-sysroot-preferences-addin.h        |  2 +-
 src/plugins/sysroot/gbp-sysroot-preferences-row.c  |  4 +---
 src/plugins/sysroot/gbp-sysroot-preferences-row.h  |  2 +-
 src/plugins/sysroot/gbp-sysroot-runtime-provider.c | 11 +++++----
 src/plugins/sysroot/gbp-sysroot-runtime-provider.h |  2 +-
 src/plugins/sysroot/gbp-sysroot-runtime.c          | 17 +++++--------
 src/plugins/sysroot/gbp-sysroot-runtime.h          |  5 ++--
 .../sysroot/gbp-sysroot-subprocess-launcher.h      |  2 +-
 .../sysroot/gbp-sysroot-toolchain-provider.c       |  6 ++---
 .../sysroot/gbp-sysroot-toolchain-provider.h       |  2 +-
 src/plugins/sysroot/meson.build                    | 28 ++++++++--------------
 src/plugins/sysroot/sysroot-plugin.c               | 20 ++++++++++++----
 src/plugins/sysroot/sysroot.gresource.xml          |  4 +---
 src/plugins/sysroot/sysroot.plugin                 | 12 ++++++----
 17 files changed, 57 insertions(+), 87 deletions(-)
---
diff --git a/src/plugins/sysroot/gbp-sysroot-manager.c b/src/plugins/sysroot/gbp-sysroot-manager.c
index 79e92c93b..eeb0d90ce 100644
--- a/src/plugins/sysroot/gbp-sysroot-manager.c
+++ b/src/plugins/sysroot/gbp-sysroot-manager.c
@@ -63,8 +63,6 @@ sysroot_manager_get_path (void)
  * Returns a colon-separated list of additional pkgconfig paths
  *
  * Returns: (transfer full) (nullable): additional guessed paths
- *
- * Since: 3.32
  */
 static gchar *
 sysroot_manager_find_additional_pkgconfig_paths (GbpSysrootManager *self,
@@ -118,8 +116,6 @@ sysroot_manager_save (GbpSysrootManager *self)
  * Returns the default #GbpSysrootManager instance.
  *
  * Returns: (transfer none): the common sysroot manager
- *
- * Since: 3.32
  */
 GbpSysrootManager *
 gbp_sysroot_manager_get_default (void)
@@ -146,8 +142,6 @@ gbp_sysroot_manager_get_default (void)
  * This creates a new target and initializes its fields to the default parameters.
  *
  * Returns: (transfer full): the unique identifier of the new target
- *
- * Since: 3.32
  */
 gchar *
 gbp_sysroot_manager_create_target (GbpSysrootManager *self)
@@ -199,8 +193,6 @@ gbp_sysroot_manager_remove_target (GbpSysrootManager *self,
  * @name: the displayable name of the target
  *
  * Sets the displayable name of the target.
- *
- * Since: 3.32
  */
 void
 gbp_sysroot_manager_set_target_name (GbpSysrootManager *self,
@@ -225,8 +217,6 @@ gbp_sysroot_manager_set_target_name (GbpSysrootManager *self,
  * Gets the displayable name of the target.
  *
  * Returns: (transfer full): the name of the target to display.
- *
- * Since: 3.32
  */
 gchar *
 gbp_sysroot_manager_get_target_name (GbpSysrootManager *self,
@@ -246,8 +236,6 @@ gbp_sysroot_manager_get_target_name (GbpSysrootManager *self,
  * @name: the architecture of the target
  *
  * Sets the architecture of the target.
- *
- * Since: 3.32
  */
 void
 gbp_sysroot_manager_set_target_arch (GbpSysrootManager *self,
@@ -272,8 +260,6 @@ gbp_sysroot_manager_set_target_arch (GbpSysrootManager *self,
  * Gets the architecture of the target.
  *
  * Returns: (transfer full): the architecture of the target.
- *
- * Since: 3.32
  */
 gchar *
 gbp_sysroot_manager_get_target_arch (GbpSysrootManager *self,
@@ -293,8 +279,6 @@ gbp_sysroot_manager_get_target_arch (GbpSysrootManager *self,
  * @path: the sysroot path of the target
  *
  * Sets the sysroot path of the target.
- *
- * Since: 3.32
  */
 void
 gbp_sysroot_manager_set_target_path (GbpSysrootManager *self,
@@ -368,8 +352,6 @@ gbp_sysroot_manager_set_target_path (GbpSysrootManager *self,
  * Gets the sysroot path of the target.
  *
  * Returns: (transfer full): the sysroot path of the target.
- *
- * Since: 3.32
  */
 gchar *
 gbp_sysroot_manager_get_target_path (GbpSysrootManager *self,
@@ -391,8 +373,6 @@ gbp_sysroot_manager_get_target_path (GbpSysrootManager *self,
  *
  * Sets the additional Pkg-Config paths of the target.
  * It is possible to use several paths by separating them with a colon character.
- *
- * Since: 3.32
  */
 void
 gbp_sysroot_manager_set_target_pkg_config_path (GbpSysrootManager *self,
@@ -418,8 +398,6 @@ gbp_sysroot_manager_set_target_pkg_config_path (GbpSysrootManager *self,
  * This is often used when the target has its libraries in an architecture-specific folder.
  *
  * Returns: (transfer full) (nullable): the additional paths to pkg-config, using a colon separator.
- *
- * Since: 3.32
  */
 gchar *
 gbp_sysroot_manager_get_target_pkg_config_path (GbpSysrootManager *self,
@@ -440,8 +418,6 @@ gbp_sysroot_manager_get_target_pkg_config_path (GbpSysrootManager *self,
  *
  * Returns: (transfer full) (nullable): the %NULL-terminated list of all the available sysroot
  * unique identifiers.
- *
- * Since: 3.32
  */
 gchar **
 gbp_sysroot_manager_list (GbpSysrootManager *self)
diff --git a/src/plugins/sysroot/gbp-sysroot-manager.h b/src/plugins/sysroot/gbp-sysroot-manager.h
index 51c93a904..dda3c7eb3 100644
--- a/src/plugins/sysroot/gbp-sysroot-manager.h
+++ b/src/plugins/sysroot/gbp-sysroot-manager.h
@@ -21,7 +21,7 @@
 
 #pragma once
 
-#include <ide.h>
+#include <libide-foundry.h>
 
 G_BEGIN_DECLS
 
diff --git a/src/plugins/sysroot/gbp-sysroot-preferences-addin.c 
b/src/plugins/sysroot/gbp-sysroot-preferences-addin.c
index 7d3215084..6e27005e6 100644
--- a/src/plugins/sysroot/gbp-sysroot-preferences-addin.c
+++ b/src/plugins/sysroot/gbp-sysroot-preferences-addin.c
@@ -22,6 +22,7 @@
 #define G_LOG_DOMAIN "gbp-sysroot-preferences-addin"
 
 #include <glib/gi18n.h>
+#include <libide-gui.h>
 
 #include "gbp-sysroot-preferences-addin.h"
 #include "gbp-sysroot-preferences-row.h"
diff --git a/src/plugins/sysroot/gbp-sysroot-preferences-addin.h 
b/src/plugins/sysroot/gbp-sysroot-preferences-addin.h
index 2aea987ba..ab888f912 100644
--- a/src/plugins/sysroot/gbp-sysroot-preferences-addin.h
+++ b/src/plugins/sysroot/gbp-sysroot-preferences-addin.h
@@ -21,7 +21,7 @@
 
 #pragma once
 
-#include <ide.h>
+#include <libide-foundry.h>
 
 G_BEGIN_DECLS
 
diff --git a/src/plugins/sysroot/gbp-sysroot-preferences-row.c 
b/src/plugins/sysroot/gbp-sysroot-preferences-row.c
index c3f3c90b0..778ddcbce 100644
--- a/src/plugins/sysroot/gbp-sysroot-preferences-row.c
+++ b/src/plugins/sysroot/gbp-sysroot-preferences-row.c
@@ -214,8 +214,6 @@ gbp_sysroot_preferences_row_finalize (GObject *object)
  * @self: a #GbpSysrootPreferencesRow
  *
  * Requests the configuration popover the be shown over the widget.
- *
- * Since: 3.32
  */
 void
 gbp_sysroot_preferences_row_show_popup (GbpSysrootPreferencesRow *self)
@@ -307,7 +305,7 @@ gbp_sysroot_preferences_row_class_init (GbpSysrootPreferencesRowClass *klass)
 
   g_object_class_install_properties (object_class, N_PROPS, properties);
 
-  gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/builder/plugins/sysroot-plugin/gbp-sysroot-preferences-row.ui");
+  gtk_widget_class_set_template_from_resource (widget_class, 
"/plugins/sysroot/gbp-sysroot-preferences-row.ui");
   gtk_widget_class_bind_template_child (widget_class, GbpSysrootPreferencesRow, display_name);
   gtk_widget_class_bind_template_child (widget_class, GbpSysrootPreferencesRow, popover);
   gtk_widget_class_bind_template_child (widget_class, GbpSysrootPreferencesRow, name_entry);
diff --git a/src/plugins/sysroot/gbp-sysroot-preferences-row.h 
b/src/plugins/sysroot/gbp-sysroot-preferences-row.h
index c7ef9e705..4d397084b 100644
--- a/src/plugins/sysroot/gbp-sysroot-preferences-row.h
+++ b/src/plugins/sysroot/gbp-sysroot-preferences-row.h
@@ -21,7 +21,7 @@
 
 #pragma once
 
-#include <ide.h>
+#include <libide-foundry.h>
 
 G_BEGIN_DECLS
 
diff --git a/src/plugins/sysroot/gbp-sysroot-runtime-provider.c 
b/src/plugins/sysroot/gbp-sysroot-runtime-provider.c
index 05d240cfc..8a30570ea 100644
--- a/src/plugins/sysroot/gbp-sysroot-runtime-provider.c
+++ b/src/plugins/sysroot/gbp-sysroot-runtime-provider.c
@@ -69,10 +69,13 @@ sysroot_runtime_provider_add_target (GbpSysrootRuntimeProvider *self,
                                      const gchar               *target)
 {
   g_autoptr(GbpSysrootRuntime) runtime = NULL;
-  IdeContext *context = NULL;
 
-  context = ide_object_get_context (IDE_OBJECT (self->runtime_manager));
-  runtime = gbp_sysroot_runtime_new (context, target);
+  g_assert (IDE_IS_MAIN_THREAD ());
+  g_assert (GBP_IS_SYSROOT_RUNTIME_PROVIDER (self));
+  g_assert (target != NULL);
+
+  runtime = gbp_sysroot_runtime_new (target);
+  ide_object_append (IDE_OBJECT (self), IDE_OBJECT (runtime));
 
   ide_runtime_manager_add (self->runtime_manager, IDE_RUNTIME (runtime));
   g_ptr_array_add (self->runtimes, g_steal_pointer (&runtime));
@@ -95,13 +98,11 @@ sysroot_runtime_provider_target_changed (GbpSysrootRuntimeProvider
 static void
 gbp_sysroot_runtime_provider_class_init (GbpSysrootRuntimeProviderClass *klass)
 {
-  
 }
 
 static void
 gbp_sysroot_runtime_provider_init (GbpSysrootRuntimeProvider *self)
 {
-  
 }
 
 static void
diff --git a/src/plugins/sysroot/gbp-sysroot-runtime-provider.h 
b/src/plugins/sysroot/gbp-sysroot-runtime-provider.h
index 0eebba0fe..688bc2479 100644
--- a/src/plugins/sysroot/gbp-sysroot-runtime-provider.h
+++ b/src/plugins/sysroot/gbp-sysroot-runtime-provider.h
@@ -21,7 +21,7 @@
 
 #pragma once
 
-#include <ide.h>
+#include <libide-foundry.h>
 
 G_BEGIN_DECLS
 
diff --git a/src/plugins/sysroot/gbp-sysroot-runtime.c b/src/plugins/sysroot/gbp-sysroot-runtime.c
index 1eb93388a..86bf89eaa 100644
--- a/src/plugins/sysroot/gbp-sysroot-runtime.c
+++ b/src/plugins/sysroot/gbp-sysroot-runtime.c
@@ -38,19 +38,16 @@ struct _GbpSysrootRuntime
 G_DEFINE_TYPE (GbpSysrootRuntime, gbp_sysroot_runtime, IDE_TYPE_RUNTIME)
 
 GbpSysrootRuntime *
-gbp_sysroot_runtime_new (IdeContext  *context,
-                         const gchar *sysroot_id)
+gbp_sysroot_runtime_new (const gchar *sysroot_id)
 {
   g_autoptr(GbpSysrootRuntime) runtime = NULL;
   g_autofree gchar *built_id = NULL;
 
-  g_return_val_if_fail (IDE_IS_CONTEXT (context), NULL);
   g_return_val_if_fail (sysroot_id != NULL, NULL);
 
   built_id = g_strconcat (RUNTIME_PREFIX, sysroot_id, NULL);
   runtime = g_object_new (GBP_TYPE_SYSROOT_RUNTIME,
                           "id", built_id,
-                          "context", context,
                           "display-name", "",
                           NULL);
 
@@ -64,8 +61,6 @@ gbp_sysroot_runtime_new (IdeContext  *context,
  * Gets the associated unique identifier of the sysroot target.
  *
  * Returns: (transfer none): the unique identifier of the sysroot target.
- *
- * Since: 3.32
  */
 const gchar *
 gbp_sysroot_runtime_get_sysroot_id (GbpSysrootRuntime *self)
@@ -75,7 +70,7 @@ gbp_sysroot_runtime_get_sysroot_id (GbpSysrootRuntime *self)
   if (!g_str_has_prefix (runtime_id, RUNTIME_PREFIX))
     return runtime_id;
 
-  return runtime_id + strlen(RUNTIME_PREFIX);
+  return runtime_id + strlen (RUNTIME_PREFIX);
 }
 
 static IdeSubprocessLauncher *
@@ -231,10 +226,10 @@ gbp_sysroot_runtime_constructed (GObject *object)
   ide_runtime_set_display_name (IDE_RUNTIME (object), display_name);
 
   g_signal_connect_object (sysroot_manager,
-                            "target-name-changed",
-                            G_CALLBACK (sysroot_runtime_target_name_changed),
-                            object,
-                            G_CONNECT_SWAPPED);
+                           "target-name-changed",
+                           G_CALLBACK (sysroot_runtime_target_name_changed),
+                           object,
+                           G_CONNECT_SWAPPED);
 
   G_OBJECT_CLASS (gbp_sysroot_runtime_parent_class)->constructed (object);
 }
diff --git a/src/plugins/sysroot/gbp-sysroot-runtime.h b/src/plugins/sysroot/gbp-sysroot-runtime.h
index 050237645..a8c225938 100644
--- a/src/plugins/sysroot/gbp-sysroot-runtime.h
+++ b/src/plugins/sysroot/gbp-sysroot-runtime.h
@@ -21,7 +21,7 @@
 
 #pragma once
 
-#include <ide.h>
+#include <libide-foundry.h>
 
 G_BEGIN_DECLS
 
@@ -29,8 +29,7 @@ G_BEGIN_DECLS
 
 G_DECLARE_FINAL_TYPE (GbpSysrootRuntime, gbp_sysroot_runtime, GBP, SYSROOT_RUNTIME, IdeRuntime)
 
-GbpSysrootRuntime  *gbp_sysroot_runtime_new            (IdeContext        *context,
-                                                        const gchar       *sysroot_id);
+GbpSysrootRuntime  *gbp_sysroot_runtime_new            (const gchar       *sysroot_id);
 const gchar        *gbp_sysroot_runtime_get_sysroot_id (GbpSysrootRuntime *self);
 
 G_END_DECLS
diff --git a/src/plugins/sysroot/gbp-sysroot-subprocess-launcher.h 
b/src/plugins/sysroot/gbp-sysroot-subprocess-launcher.h
index e5ac5adc1..166db6eae 100644
--- a/src/plugins/sysroot/gbp-sysroot-subprocess-launcher.h
+++ b/src/plugins/sysroot/gbp-sysroot-subprocess-launcher.h
@@ -21,7 +21,7 @@
 
 #pragma once
 
-#include <ide.h>
+#include <libide-foundry.h>
 
 G_BEGIN_DECLS
 
diff --git a/src/plugins/sysroot/gbp-sysroot-toolchain-provider.c 
b/src/plugins/sysroot/gbp-sysroot-toolchain-provider.c
index f09417757..89c858ba6 100644
--- a/src/plugins/sysroot/gbp-sysroot-toolchain-provider.c
+++ b/src/plugins/sysroot/gbp-sysroot-toolchain-provider.c
@@ -141,14 +141,12 @@ gbp_sysroot_toolchain_provider_try_poky (GbpSysrootToolchainProvider *self,
       g_autofree gchar *sdk_pkg_config_path = NULL;
       g_autofree gchar *qemu_static_name = NULL;
       g_autofree gchar *qemu_static_path = NULL;
-      IdeContext *context;
 
       sdk_file = g_file_new_for_path (sdk_path);
       sdk_canonical_path = g_file_get_path (sdk_file);
       toolchain_id = g_strdup_printf ("sysroot:%s", sdk_canonical_path);
       display_name = g_strdup_printf (_("%s (Sysroot SDK)"), sdk_canonical_path);
-      context = ide_object_get_context (IDE_OBJECT (self));
-      toolchain = ide_simple_toolchain_new (context, toolchain_id, display_name);
+      toolchain = ide_simple_toolchain_new (toolchain_id, display_name);
       ide_toolchain_set_host_triplet (IDE_TOOLCHAIN (toolchain), sysroot_triplet);
 
       sdk_tools_path = g_build_filename (sdk_canonical_path, "usr", "bin", sysroot_basename, NULL);
@@ -316,5 +314,5 @@ gbp_sysroot_toolchain_provider_class_init (GbpSysrootToolchainProviderClass *kla
 static void
 gbp_sysroot_toolchain_provider_init (GbpSysrootToolchainProvider *self)
 {
-  
+
 }
diff --git a/src/plugins/sysroot/gbp-sysroot-toolchain-provider.h 
b/src/plugins/sysroot/gbp-sysroot-toolchain-provider.h
index c99bbcde5..652faecc3 100644
--- a/src/plugins/sysroot/gbp-sysroot-toolchain-provider.h
+++ b/src/plugins/sysroot/gbp-sysroot-toolchain-provider.h
@@ -22,7 +22,7 @@
 
 #pragma once
 
-#include <ide.h>
+#include <libide-foundry.h>
 
 G_BEGIN_DECLS
 
diff --git a/src/plugins/sysroot/meson.build b/src/plugins/sysroot/meson.build
index 01c2b4d72..aad3d6229 100644
--- a/src/plugins/sysroot/meson.build
+++ b/src/plugins/sysroot/meson.build
@@ -1,30 +1,22 @@
-if get_option('with_sysroot')
+if get_option('plugin_sysroot')
 
-sysroot_resources = gnome.compile_resources(
-  'sysroot-resources',
-  'sysroot.gresource.xml',
-  c_name: 'gbp_sysroot',
-)
-
-sysroot_sources = [
+plugins_sources += files([
   'sysroot-plugin.c',
   'gbp-sysroot-manager.c',
-  'gbp-sysroot-manager.h',
   'gbp-sysroot-preferences-addin.c',
-  'gbp-sysroot-preferences-addin.h',
   'gbp-sysroot-preferences-row.c',
-  'gbp-sysroot-preferences-row.h',
   'gbp-sysroot-runtime.c',
-  'gbp-sysroot-runtime.h',
   'gbp-sysroot-runtime-provider.c',
-  'gbp-sysroot-runtime-provider.h',
   'gbp-sysroot-subprocess-launcher.c',
-  'gbp-sysroot-subprocess-launcher.h',
   'gbp-sysroot-toolchain-provider.c',
-  'gbp-sysroot-toolchain-provider.h'
-]
+])
+
+plugin_sysroot_resources = gnome.compile_resources(
+  'sysroot-resources',
+  'sysroot.gresource.xml',
+  c_name: 'gbp_sysroot',
+)
 
-gnome_builder_plugins_sources += files(sysroot_sources)
-gnome_builder_plugins_sources += sysroot_resources[0]
+plugins_sources += plugin_sysroot_resources[0]
 
 endif
diff --git a/src/plugins/sysroot/sysroot-plugin.c b/src/plugins/sysroot/sysroot-plugin.c
index b5cc31e86..4da9b9cc3 100644
--- a/src/plugins/sysroot/sysroot-plugin.c
+++ b/src/plugins/sysroot/sysroot-plugin.c
@@ -19,16 +19,26 @@
  * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
+#include "config.h"
+
 #include <libpeas/peas.h>
+#include <libide-foundry.h>
+#include <libide-gui.h>
 
 #include "gbp-sysroot-runtime-provider.h"
 #include "gbp-sysroot-preferences-addin.h"
 #include "gbp-sysroot-toolchain-provider.h"
 
-void
-gbp_sysroot_register_types (PeasObjectModule *module)
+_IDE_EXTERN void
+_gbp_sysroot_register_types (PeasObjectModule *module)
 {
-  peas_object_module_register_extension_type (module, IDE_TYPE_RUNTIME_PROVIDER, 
GBP_TYPE_SYSROOT_RUNTIME_PROVIDER);
-  peas_object_module_register_extension_type (module, IDE_TYPE_PREFERENCES_ADDIN, 
GBP_TYPE_SYSROOT_PREFERENCES_ADDIN);
-  peas_object_module_register_extension_type (module, IDE_TYPE_TOOLCHAIN_PROVIDER, 
GBP_TYPE_SYSROOT_TOOLCHAIN_PROVIDER);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_RUNTIME_PROVIDER,
+                                              GBP_TYPE_SYSROOT_RUNTIME_PROVIDER);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_PREFERENCES_ADDIN,
+                                              GBP_TYPE_SYSROOT_PREFERENCES_ADDIN);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_TOOLCHAIN_PROVIDER,
+                                              GBP_TYPE_SYSROOT_TOOLCHAIN_PROVIDER);
 }
diff --git a/src/plugins/sysroot/sysroot.gresource.xml b/src/plugins/sysroot/sysroot.gresource.xml
index 298d19cef..58b98e0c8 100644
--- a/src/plugins/sysroot/sysroot.gresource.xml
+++ b/src/plugins/sysroot/sysroot.gresource.xml
@@ -1,9 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <gresources>
-  <gresource prefix="/org/gnome/builder/plugins">
+  <gresource prefix="/plugins/sysroot">
     <file>sysroot.plugin</file>
-  </gresource>
-  <gresource prefix="/org/gnome/builder/plugins/sysroot-plugin">
     <file>gbp-sysroot-preferences-row.ui</file>
   </gresource>
 </gresources>
diff --git a/src/plugins/sysroot/sysroot.plugin b/src/plugins/sysroot/sysroot.plugin
index e98638bc7..64c2d23a5 100644
--- a/src/plugins/sysroot/sysroot.plugin
+++ b/src/plugins/sysroot/sysroot.plugin
@@ -1,8 +1,10 @@
 [Plugin]
-Module=sysroot-plugin
-Name=Sysroot Support
-Description=Provides sysroot support
 Authors=Corentin Noël <corentin noel collabora com>
-Copyright=Copyright © 2018 Collabora Ltd.
 Builtin=true
-Embedded=gbp_sysroot_register_types
+Copyright=Copyright © 2018 Collabora Ltd.
+Depends=buildui;
+Description=Provides sysroot support
+Embedded=_gbp_sysroot_register_types
+Hidden=true
+Module=sysroot
+Name=Sysroot Support


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