[gnome-builder: 74/139] deviced: port to libide-foundry
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder: 74/139] deviced: port to libide-foundry
- Date: Thu, 10 Jan 2019 04:23:32 +0000 (UTC)
commit 0b53325893e7980742578f2862d2f95b0d578228
Author: Christian Hergert <chergert redhat com>
Date: Wed Jan 9 17:15:18 2019 -0800
deviced: port to libide-foundry
This ports the deviced integration plugin to use the new libide-foundry
design and objects. It is mostly a bit of tweaking to alter how objects
are created and destroyed.
.../{gbp-deviced-plugin.c => deviced-plugin.c} | 20 +++++++++++-----
src/plugins/deviced/deviced.gresource.xml | 4 +---
src/plugins/deviced/deviced.plugin | 13 +++++------
src/plugins/deviced/gbp-deviced-deploy-strategy.c | 2 +-
src/plugins/deviced/gbp-deviced-deploy-strategy.h | 2 +-
src/plugins/deviced/gbp-deviced-device-provider.c | 5 ++--
src/plugins/deviced/gbp-deviced-device-provider.h | 2 +-
src/plugins/deviced/gbp-deviced-device.c | 6 ++---
src/plugins/deviced/gbp-deviced-device.h | 5 ++--
src/plugins/deviced/meson.build | 27 ++++++++++++----------
10 files changed, 45 insertions(+), 41 deletions(-)
---
diff --git a/src/plugins/deviced/gbp-deviced-plugin.c b/src/plugins/deviced/deviced-plugin.c
similarity index 59%
rename from src/plugins/deviced/gbp-deviced-plugin.c
rename to src/plugins/deviced/deviced-plugin.c
index d82aabdd8..3e314c4ba 100644
--- a/src/plugins/deviced/gbp-deviced-plugin.c
+++ b/src/plugins/deviced/deviced-plugin.c
@@ -1,4 +1,4 @@
-/* gbp-deviced-plugin.c
+/* deviced-plugin.c
*
* Copyright 2018-2019 Christian Hergert <chergert redhat com>
*
@@ -18,15 +18,23 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-#include <ide.h>
+#define G_LOG_DOMAIN "deviced-plugin"
+
+#include "config.h"
+
+#include <libide-foundry.h>
#include <libpeas/peas.h>
#include "gbp-deviced-device-provider.h"
#include "gbp-deviced-deploy-strategy.h"
-void
-gbp_deviced_register_types (PeasObjectModule *module)
+_IDE_EXTERN void
+_gbp_deviced_register_types (PeasObjectModule *module)
{
- peas_object_module_register_extension_type (module, IDE_TYPE_DEVICE_PROVIDER,
GBP_TYPE_DEVICED_DEVICE_PROVIDER);
- peas_object_module_register_extension_type (module, IDE_TYPE_DEPLOY_STRATEGY,
GBP_TYPE_DEVICED_DEPLOY_STRATEGY);
+ peas_object_module_register_extension_type (module,
+ IDE_TYPE_DEVICE_PROVIDER,
+ GBP_TYPE_DEVICED_DEVICE_PROVIDER);
+ peas_object_module_register_extension_type (module,
+ IDE_TYPE_DEPLOY_STRATEGY,
+ GBP_TYPE_DEVICED_DEPLOY_STRATEGY);
}
diff --git a/src/plugins/deviced/deviced.gresource.xml b/src/plugins/deviced/deviced.gresource.xml
index 2fa7cfe02..3d8a98bff 100644
--- a/src/plugins/deviced/deviced.gresource.xml
+++ b/src/plugins/deviced/deviced.gresource.xml
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
- <gresource prefix="/org/gnome/builder/plugins">
+ <gresource prefix="/plugins/deviced">
<file>deviced.plugin</file>
</gresource>
- <gresource prefix="/org/gnome/builder/plugins/deviced-plugin">
- </gresource>
</gresources>
diff --git a/src/plugins/deviced/deviced.plugin b/src/plugins/deviced/deviced.plugin
index 46f792180..25811b59d 100644
--- a/src/plugins/deviced/deviced.plugin
+++ b/src/plugins/deviced/deviced.plugin
@@ -1,10 +1,9 @@
[Plugin]
-Module=deviced-plugin
-Name=Deviced
-Description=Integration with deviced devices
Authors=Christian Hergert <christian hergert me>
-Copyright=Copyright © 2017 Christian Hergert
-Depends=editor;debugger;terminal;
-Hidden=true
Builtin=true
-Embedded=gbp_deviced_register_types
+Copyright=Copyright © 2017 Christian Hergert
+Depends=editor;debuggerui;terminal;deviceui;flatpak;
+Description=Integration with deviced devices
+Embedded=_gbp_deviced_register_types
+Module=deviced
+Name=Deviced
diff --git a/src/plugins/deviced/gbp-deviced-deploy-strategy.c
b/src/plugins/deviced/gbp-deviced-deploy-strategy.c
index e13ad0c0c..46196e4a0 100644
--- a/src/plugins/deviced/gbp-deviced-deploy-strategy.c
+++ b/src/plugins/deviced/gbp-deviced-deploy-strategy.c
@@ -87,7 +87,7 @@ gbp_deviced_deploy_strategy_load_async (IdeDeployStrategy *strategy,
G_IO_ERROR,
G_IO_ERROR_NOT_SUPPORTED,
"%s is not supported by %s",
- G_OBJECT_TYPE_NAME (device),
+ device ? G_OBJECT_TYPE_NAME (device) : "(nil)",
G_OBJECT_TYPE_NAME (self));
IDE_EXIT;
}
diff --git a/src/plugins/deviced/gbp-deviced-deploy-strategy.h
b/src/plugins/deviced/gbp-deviced-deploy-strategy.h
index d726f84f4..cbe3a1547 100644
--- a/src/plugins/deviced/gbp-deviced-deploy-strategy.h
+++ b/src/plugins/deviced/gbp-deviced-deploy-strategy.h
@@ -20,7 +20,7 @@
#pragma once
-#include <ide.h>
+#include <libide-foundry.h>
G_BEGIN_DECLS
diff --git a/src/plugins/deviced/gbp-deviced-device-provider.c
b/src/plugins/deviced/gbp-deviced-device-provider.c
index 65ceeff1c..3d6fdb8a6 100644
--- a/src/plugins/deviced/gbp-deviced-device-provider.c
+++ b/src/plugins/deviced/gbp-deviced-device-provider.c
@@ -45,7 +45,6 @@ gbp_deviced_device_provider_device_added_cb (GbpDevicedDeviceProvider *self,
DevdBrowser *browser)
{
GbpDevicedDevice *wrapped;
- IdeContext *context;
IDE_ENTRY;
@@ -53,9 +52,9 @@ gbp_deviced_device_provider_device_added_cb (GbpDevicedDeviceProvider *self,
g_assert (DEVD_IS_DEVICE (device));
g_assert (DEVD_IS_BROWSER (browser));
- context = ide_object_get_context (IDE_OBJECT (self));
- wrapped = gbp_deviced_device_new (context, device);
+ wrapped = gbp_deviced_device_new (device);
g_object_set_data (G_OBJECT (device), "GBP_DEVICED_DEVICE", wrapped);
+ ide_object_append (IDE_OBJECT (self), IDE_OBJECT (wrapped));
ide_device_provider_emit_device_added (IDE_DEVICE_PROVIDER (self), IDE_DEVICE (wrapped));
diff --git a/src/plugins/deviced/gbp-deviced-device-provider.h
b/src/plugins/deviced/gbp-deviced-device-provider.h
index a345cb916..b033f1c16 100644
--- a/src/plugins/deviced/gbp-deviced-device-provider.h
+++ b/src/plugins/deviced/gbp-deviced-device-provider.h
@@ -20,7 +20,7 @@
#pragma once
-#include <ide.h>
+#include <libide-foundry.h>
G_BEGIN_DECLS
diff --git a/src/plugins/deviced/gbp-deviced-device.c b/src/plugins/deviced/gbp-deviced-device.c
index 7f61b720b..0ced14221 100644
--- a/src/plugins/deviced/gbp-deviced-device.c
+++ b/src/plugins/deviced/gbp-deviced-device.c
@@ -316,14 +316,13 @@ gbp_deviced_device_init (GbpDevicedDevice *self)
}
GbpDevicedDevice *
-gbp_deviced_device_new (IdeContext *context,
- DevdDevice *device)
+gbp_deviced_device_new (DevdDevice *device)
{
g_autofree gchar *id = NULL;
const gchar *name;
const gchar *icon_name;
- g_return_val_if_fail (IDE_IS_CONTEXT (context), NULL);
+ g_return_val_if_fail (IDE_IS_MAIN_THREAD (), NULL);
g_return_val_if_fail (DEVD_IS_DEVICE (device), NULL);
id = g_strdup_printf ("deviced:%s", devd_device_get_id (device));
@@ -332,7 +331,6 @@ gbp_deviced_device_new (IdeContext *context,
return g_object_new (GBP_TYPE_DEVICED_DEVICE,
"id", id,
- "context", context,
"device", device,
"display-name", name,
"icon-name", icon_name,
diff --git a/src/plugins/deviced/gbp-deviced-device.h b/src/plugins/deviced/gbp-deviced-device.h
index 37cc4ce9b..e98fbb7a5 100644
--- a/src/plugins/deviced/gbp-deviced-device.h
+++ b/src/plugins/deviced/gbp-deviced-device.h
@@ -20,7 +20,7 @@
#pragma once
-#include <ide.h>
+#include <libide-foundry.h>
#include <libdeviced.h>
G_BEGIN_DECLS
@@ -29,8 +29,7 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (GbpDevicedDevice, gbp_deviced_device, GBP, DEVICED_DEVICE, IdeDevice)
-GbpDevicedDevice *gbp_deviced_device_new (IdeContext *context,
- DevdDevice *device);
+GbpDevicedDevice *gbp_deviced_device_new (DevdDevice *device);
void gbp_deviced_device_get_commit_async (GbpDevicedDevice *self,
const gchar *commit_id,
GCancellable *cancellable,
diff --git a/src/plugins/deviced/meson.build b/src/plugins/deviced/meson.build
index e2393d54b..c728cb5d2 100644
--- a/src/plugins/deviced/meson.build
+++ b/src/plugins/deviced/meson.build
@@ -1,23 +1,26 @@
-if get_option('with_deviced')
+if get_option('plugin_deviced')
-deviced_resources = gnome.compile_resources(
- 'deviced-resources',
- 'deviced.gresource.xml',
- c_name: 'gbp_deviced',
-)
+if not get_option('plugin_flatpak')
+ error('-Dplugin_flatpak=true is required to enable deviced')
+endif
-deviced_sources = [
- 'gbp-deviced-plugin.c',
+plugins_sources += files([
+ 'deviced-plugin.c',
'gbp-deviced-deploy-strategy.c',
'gbp-deviced-device.c',
'gbp-deviced-device-provider.c',
-]
+])
+
+plugin_deviced_resources = gnome.compile_resources(
+ 'deviced-resources',
+ 'deviced.gresource.xml',
+ c_name: 'gbp_deviced',
+)
-gnome_builder_plugins_deps += [
+plugins_deps += [
dependency('libdeviced', version: '>=3.27.4'),
]
-gnome_builder_plugins_sources += files(deviced_sources)
-gnome_builder_plugins_sources += deviced_resources[0]
+plugins_sources += plugin_deviced_resources[0]
endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]