[gnome-online-accounts/wip/rishi/issue-43] daemon, dbus: Enable checking if a provider type is supported
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-online-accounts/wip/rishi/issue-43] daemon, dbus: Enable checking if a provider type is supported
- Date: Mon, 3 Feb 2020 19:02:28 +0000 (UTC)
commit 6ade0793911f8fab642012ba5047176c92525afe
Author: Debarshi Ray <debarshir gnome org>
Date: Mon Feb 3 20:01:18 2020 +0100
daemon, dbus: Enable checking if a provider type is supported
With the advent of Flatpak, applications can no longer be expected to
be updated in lockstep with the operating system. In this case,
applications are meant to link against libgoa-1.0.so, while goa-daemon
and libgoa-backend-1.0.so are considered part of the OS.
Therefore, when a newer version of an application is running against
an older operating system, it needs to introspect the provider types
supported by the backend daemon so that features not supported by the
OS can be disabled at run-time.
https://gitlab.gnome.org/GNOME/gnome-online-accounts/issues/43
data/dbus-interfaces.xml | 5 +++++
src/daemon/goadaemon.c | 28 ++++++++++++++++++++++++++++
2 files changed, 33 insertions(+)
---
diff --git a/data/dbus-interfaces.xml b/data/dbus-interfaces.xml
index 2fa79824..6ac52f02 100644
--- a/data/dbus-interfaces.xml
+++ b/data/dbus-interfaces.xml
@@ -421,6 +421,11 @@
<arg name="account_object_path" type="o" direction="out"/>
</method>
+ <method name="IsSupportedProvider">
+ <arg name="provider_type" type="s" direction="in"/>
+ <arg name="is_supported" type="b" direction="out"/>
+ </method>
+
</interface>
diff --git a/src/daemon/goadaemon.c b/src/daemon/goadaemon.c
index bfbe41c8..65e96548 100644
--- a/src/daemon/goadaemon.c
+++ b/src/daemon/goadaemon.c
@@ -76,6 +76,12 @@ static gboolean on_manager_handle_add_account (GoaManager *object,
GVariant *details,
gpointer user_data);
+static gboolean
+on_manager_handle_is_supported_provider (GoaManager *manager,
+ GDBusMethodInvocation *invocation,
+ const gchar *provider_type,
+ gpointer user_data);
+
static gboolean on_account_handle_remove (GoaAccount *account,
GDBusMethodInvocation *invocation,
gpointer user_data);
@@ -265,6 +271,7 @@ goa_daemon_init (GoaDaemon *self)
"handle-add-account",
G_CALLBACK (on_manager_handle_add_account),
self);
+ g_signal_connect (self->manager, "handle-is-supported-provider", G_CALLBACK
(on_manager_handle_is_supported_provider), self);
object = goa_object_skeleton_new ("/org/gnome/OnlineAccounts/Manager");
goa_object_skeleton_set_manager (object, self->manager);
g_dbus_object_manager_server_export (self->object_manager, G_DBUS_OBJECT_SKELETON (object));
@@ -1292,6 +1299,27 @@ on_manager_handle_add_account (GoaManager *manager,
/* ---------------------------------------------------------------------------------------------------- */
+static gboolean
+on_manager_handle_is_supported_provider (GoaManager *manager,
+ GDBusMethodInvocation *invocation,
+ const gchar *provider_type,
+ gpointer user_data)
+{
+ GoaDaemon *self = GOA_DAEMON (user_data);
+ GoaProvider *provider = NULL;
+ gboolean is_supported;
+
+ provider = goa_provider_get_for_provider_type (provider_type);
+ is_supported = provider == NULL ? FALSE : TRUE;
+
+ goa_manager_complete_is_supported_provider (manager, invocation, is_supported);
+
+ g_clear_object (&provider);
+ return TRUE;
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
typedef struct
{
GoaObject *object;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]