Commit 19c46749 authored by Debarshi Ray's avatar Debarshi Ray
Browse files

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.

Based on initial work done by Jean Felder.

#43
parent 44889c76
......@@ -421,6 +421,20 @@
<arg name="account_object_path" type="o" direction="out"/>
</method>
<!--
IsSupportedProvider:
@provider_type: A provider of online accounts
@is_supported: Whether the provider is supported or not
Checks if a certain type of provider of online accounts (for example,
"google" or "lastfm") is supported. If @provider_type is supported,
then @is_supported is set to %TRUE.
-->
<method name="IsSupportedProvider">
<arg name="provider_type" type="s" direction="in"/>
<arg name="is_supported" type="b" direction="out"/>
</method>
</interface>
......
......@@ -7,7 +7,11 @@ goa_manager_override_properties
goa_manager_call_add_account
goa_manager_call_add_account_finish
goa_manager_call_add_account_sync
goa_manager_call_is_supported_provider
goa_manager_call_is_supported_provider_finish
goa_manager_call_is_supported_provider_sync
goa_manager_complete_add_account
goa_manager_complete_is_supported_provider
GoaManagerProxy
GoaManagerProxyClass
goa_manager_proxy_new
......
......@@ -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), NULL);
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,26 @@ 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)
{
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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment