[gnome-builder: 114/139] qemu: port to libide-foundry



commit 3e01246f1e32ba5b6d2608799a5c79b24896d34c
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jan 9 17:34:55 2019 -0800

    qemu: port to libide-foundry

 src/plugins/qemu/gbp-qemu-device-provider.c           |  9 +++++----
 src/plugins/qemu/gbp-qemu-device-provider.h           |  2 +-
 src/plugins/qemu/meson.build                          | 17 ++++++++---------
 src/plugins/qemu/{gbp-qemu-plugin.c => qemu-plugin.c} | 14 +++++++++-----
 src/plugins/qemu/qemu.gresource.xml                   |  4 +---
 src/plugins/qemu/qemu.plugin                          | 11 ++++++-----
 6 files changed, 30 insertions(+), 27 deletions(-)
---
diff --git a/src/plugins/qemu/gbp-qemu-device-provider.c b/src/plugins/qemu/gbp-qemu-device-provider.c
index c69801446..9b9d05afa 100644
--- a/src/plugins/qemu/gbp-qemu-device-provider.c
+++ b/src/plugins/qemu/gbp-qemu-device-provider.c
@@ -79,7 +79,7 @@ gbp_qemu_device_provider_load_worker (IdeTask      *task,
   g_autofree gchar *status = NULL;
   g_autoptr(GError) error = NULL;
   g_autoptr(GPtrArray) devices = NULL;
-  IdeContext *context;
+  GbpQemuDeviceProvider *self;
 
   IDE_ENTRY;
 
@@ -87,6 +87,9 @@ gbp_qemu_device_provider_load_worker (IdeTask      *task,
   g_assert (GBP_IS_QEMU_DEVICE_PROVIDER (source_object));
   g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
 
+  self = ide_task_get_source_object (task);
+  g_assert (GBP_IS_QEMU_DEVICE_PROVIDER (self));
+
   devices = g_ptr_array_new_with_free_func (g_object_unref);
 
   /* The first thing we need to do is ensure that binfmt is available
@@ -125,8 +128,6 @@ gbp_qemu_device_provider_load_worker (IdeTask      *task,
       IDE_EXIT;
     }
 
-  context = ide_object_get_context (source_object);
-
   /* Now locate which of the machines are registered. Qemu has a huge
    * list of these, so we only check for ones we think are likely to
    * be used. If you want support for more, let us know.
@@ -162,9 +163,9 @@ gbp_qemu_device_provider_load_worker (IdeTask      *task,
           device = g_object_new (IDE_TYPE_LOCAL_DEVICE,
                                  "id", machines[i].filename,
                                  "triplet", triplet,
-                                 "context", context,
                                  "display-name", display_name,
                                  NULL);
+          ide_object_append (IDE_OBJECT (self), IDE_OBJECT (device));
           g_ptr_array_add (devices, g_steal_pointer (&device));
         }
     }
diff --git a/src/plugins/qemu/gbp-qemu-device-provider.h b/src/plugins/qemu/gbp-qemu-device-provider.h
index 1a4635427..a51c5697b 100644
--- a/src/plugins/qemu/gbp-qemu-device-provider.h
+++ b/src/plugins/qemu/gbp-qemu-device-provider.h
@@ -20,7 +20,7 @@
 
 #pragma once
 
-#include <ide.h>
+#include <libide-foundry.h>
 
 G_BEGIN_DECLS
 
diff --git a/src/plugins/qemu/meson.build b/src/plugins/qemu/meson.build
index 0b50c10cb..ca36d1bb7 100644
--- a/src/plugins/qemu/meson.build
+++ b/src/plugins/qemu/meson.build
@@ -1,17 +1,16 @@
-if get_option('with_qemu')
+if get_option('plugin_qemu')
 
-qemu_resources = gnome.compile_resources(
+plugins_sources += files([
+  'qemu-plugin.c',
+  'gbp-qemu-device-provider.c',
+])
+
+plugin_qemu_resources = gnome.compile_resources(
   'qemu-resources',
   'qemu.gresource.xml',
   c_name: 'gbp_qemu',
 )
 
-qemu_sources = [
-  'gbp-qemu-plugin.c',
-  'gbp-qemu-device-provider.c',
-]
-
-gnome_builder_plugins_sources += files(qemu_sources)
-gnome_builder_plugins_sources += qemu_resources[0]
+plugins_sources += plugin_qemu_resources[0]
 
 endif
diff --git a/src/plugins/qemu/gbp-qemu-plugin.c b/src/plugins/qemu/qemu-plugin.c
similarity index 71%
rename from src/plugins/qemu/gbp-qemu-plugin.c
rename to src/plugins/qemu/qemu-plugin.c
index 2636fc2fd..7d3b17194 100644
--- a/src/plugins/qemu/gbp-qemu-plugin.c
+++ b/src/plugins/qemu/qemu-plugin.c
@@ -1,4 +1,4 @@
-/* gbp-qemu-plugin.c
+/* qemu-plugin.c
  *
  * Copyright 2018-2019 Christian Hergert <chergert redhat com>
  *
@@ -18,13 +18,17 @@
  * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
-#include <ide.h>
+#include "config.h"
+
+#include <libide-foundry.h>
 #include <libpeas/peas.h>
 
 #include "gbp-qemu-device-provider.h"
 
-void
-gbp_qemu_register_types (PeasObjectModule *module)
+_IDE_EXTERN void
+_gbp_qemu_register_types (PeasObjectModule *module)
 {
-  peas_object_module_register_extension_type (module, IDE_TYPE_DEVICE_PROVIDER, 
GBP_TYPE_QEMU_DEVICE_PROVIDER);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_DEVICE_PROVIDER,
+                                              GBP_TYPE_QEMU_DEVICE_PROVIDER);
 }
diff --git a/src/plugins/qemu/qemu.gresource.xml b/src/plugins/qemu/qemu.gresource.xml
index b854ffac2..3a85e49c2 100644
--- a/src/plugins/qemu/qemu.gresource.xml
+++ b/src/plugins/qemu/qemu.gresource.xml
@@ -1,8 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <gresources>
-  <gresource prefix="/org/gnome/builder/plugins">
+  <gresource prefix="/plugins/qemu">
     <file>qemu.plugin</file>
   </gresource>
-  <gresource prefix="/org/gnome/builder/plugins/qemu-plugin">
-  </gresource>
 </gresources>
diff --git a/src/plugins/qemu/qemu.plugin b/src/plugins/qemu/qemu.plugin
index 7462f9658..c7700b763 100644
--- a/src/plugins/qemu/qemu.plugin
+++ b/src/plugins/qemu/qemu.plugin
@@ -1,8 +1,9 @@
 [Plugin]
-Module=qemu-plugin
-Name=Qemu
-Description=Integration with Qemu cross-architecture emulation
 Authors=Christian Hergert <christian hergert me>
-Copyright=Copyright © 2018 Christian Hergert
 Builtin=true
-Embedded=gbp_qemu_register_types
+Copyright=Copyright © 2018 Christian Hergert
+Depends=deviceui;
+Description=Integration with Qemu cross-architecture emulation
+Embedded=_gbp_qemu_register_types
+Module=qemu
+Name=Qemu


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