diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2014-02-05 13:24:45 +0000 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2014-02-06 13:06:29 +0000 |
commit | e3748958037ac74bd6b89e6ea2439378e91b3b89 (patch) | |
tree | 072977082199bffcf26ab766662bc8e4b1d1e068 /mission-control-plugins | |
parent | 5090a5d462bfaa62300fa0526c043f60759306a6 (diff) |
McdStorage: watch and proxy plugins' change-notification signals
This lets us get rid of the "ready" vfunc on plugins: we now
connect to each plugin's signals only after we have called
mcp_account_storage_list(), so we won't get double-notification for
accounts that are both present in the initial list and signalled.
This means we can remove a queue of delayed signal emissions from the
test D-Bus plugin (and when it's ported to this API, from Empathy's
libaccounts/UOA plugin). As far as I can see, list() and ready() happen
within the same main-loop iteration anyway, so I don't think it was
even possible to receive notification of a new account in that window.
Empathy's GNOME Online Accounts plugin never really implemented this:
in theory, it was incorrect, since any account that happened to be
added between list() and ready() would be lost altogether. However,
list() and ready() seem to happen in the same main-loop iteration,
so this might never have been a practical concern.
Rather than "fixing" Empathy's GOA plugin, it seems better to remove
the difficult case altogether.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=74581
Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Diffstat (limited to 'mission-control-plugins')
-rw-r--r-- | mission-control-plugins/account-storage.c | 60 | ||||
-rw-r--r-- | mission-control-plugins/account-storage.h | 6 |
2 files changed, 4 insertions, 62 deletions
diff --git a/mission-control-plugins/account-storage.c b/mission-control-plugins/account-storage.c index b04e3bdf..51d3e6de 100644 --- a/mission-control-plugins/account-storage.c +++ b/mission-control-plugins/account-storage.c @@ -61,7 +61,6 @@ * iface->delete_finish = foo_plugin_delete_finish; * iface->commit = foo_plugin_commit; * iface->list = foo_plugin_list; - * iface->ready = foo_plugin_ready; * iface->get_identifier = foo_plugin_get_identifier; * iface->get_additional_info = foo_plugin_get_additional_info; * iface->get_restrictions = foo_plugin_get_restrictions; @@ -166,13 +165,6 @@ default_create (McpAccountStorage *storage, } static void -default_ready (McpAccountStorage *storage, - McpAccountManager *am) -{ - /* do nothing */ -} - -static void default_get_identifier (McpAccountStorage *storage, const gchar *account, GValue *identifier) @@ -244,7 +236,6 @@ class_init (gpointer klass, iface->delete_async = default_delete_async; iface->delete_finish = default_delete_finish; iface->commit = default_commit; - iface->ready = default_ready; iface->get_identifier = default_get_identifier; iface->get_additional_info = default_get_additional_info; iface->get_restrictions = default_get_restrictions; @@ -265,8 +256,10 @@ class_init (gpointer klass, * Emitted if an external entity creates an account * in the backend the emitting plugin handles. * - * Should not be fired until mcp_account_storage_ready() has been called - * + * This signal does not need to be emitted before mcp_account_storage_list() + * returns (if it is, it will be ignored). All accounts that exist + * at the time that mcp_account_storage_list() returns must be included + * in its result, even if they were also signalled via this signal. */ signals[CREATED] = g_signal_new ("created", type, G_SIGNAL_RUN_LAST, 0, NULL, NULL, @@ -291,8 +284,6 @@ class_init (gpointer klass, * mcp_account_storage_list_typed_parameters() and * mcp_account_storage_set_parameter() do not use the * "param-" prefix, but this signal does. - * - * Should not be fired until mcp_account_storage_ready() has been called */ signals[ALTERED_ONE] = g_signal_new ("altered-one", type, G_SIGNAL_RUN_LAST, 0, NULL, NULL, @@ -306,9 +297,6 @@ class_init (gpointer klass, * * Emitted if an external entity deletes an account * in the backend the emitting plugin handles. - * - * Should not be fired until mcp_account_storage_ready() has been called - * */ signals[DELETED] = g_signal_new ("deleted", type, G_SIGNAL_RUN_LAST, 0, NULL, NULL, @@ -328,9 +316,6 @@ class_init (gpointer klass, * Before emitting this signal, the plugin must update its * internal cache (if any) so that mcp_account_storage_get_attribute() * will return the new value for Enabled when queried. - * - * Should not be fired until mcp_account_storage_ready() has been called - * */ signals[TOGGLED] = g_signal_new ("toggled", type, G_SIGNAL_RUN_LAST, 0, NULL, NULL, @@ -343,8 +328,6 @@ class_init (gpointer klass, * * emitted if an external entity modified important parameters of the * account and a reconnection is required in order to apply them. - * - * Should not be fired until mcp_account_storage_ready() has been called **/ signals[RECONNECT] = g_signal_new ("reconnect", type, G_SIGNAL_RUN_LAST, 0, NULL, NULL, @@ -402,7 +385,6 @@ mcp_account_storage_get_type (void) * @delete: implementation of mcp_account_storage_delete() * @commit: implementation of mcp_account_storage_commit() * @list: implementation of mcp_account_storage_list() - * @ready: implementation of mcp_account_storage_ready() * @get_identifier: implementation of mcp_account_storage_get_identifier() * @get_additional_info: implementation of * mcp_account_storage_get_additional_info() @@ -939,40 +921,6 @@ mcp_account_storage_list (McpAccountStorage *storage, } /** - * McpAccountStorageReadyFunc: - * @storage: an #McpAccountStorage instance - * @am: an #McpAccountManager instance - * - * An implementation of mcp_account_storage_ready(). - */ - -/** - * mcp_account_storage_ready: - * @storage: an #McpAccountStorage instance - * @am: an #McpAccountManager instance - * - * Informs the plugin that it is now permitted to create new accounts, - * ie it can now fire its "created", "altered-one", "toggled" and "deleted" - * signals. - * - * The default implementation does nothing. It should be overridden by - * any plugin that will emit "created", "altered-one", "toggled" and/or - * "deleted". - */ -void -mcp_account_storage_ready (McpAccountStorage *storage, - McpAccountManager *am) -{ - McpAccountStorageIface *iface = MCP_ACCOUNT_STORAGE_GET_IFACE (storage); - - SDEBUG (storage, ""); - g_return_if_fail (iface != NULL); - g_return_if_fail (iface->ready != NULL); - - iface->ready (storage, am); -} - -/** * McpAccountStorageGetIdentifierFunc: * @storage: an #McpAccountStorage instance * @account: the unique name of the account diff --git a/mission-control-plugins/account-storage.h b/mission-control-plugins/account-storage.h index 95ffcc14..b8015217 100644 --- a/mission-control-plugins/account-storage.h +++ b/mission-control-plugins/account-storage.h @@ -116,9 +116,6 @@ struct _McpAccountStorageIface GList * (*list) (McpAccountStorage *storage, McpAccountManager *am); - void (*ready) (McpAccountStorage *storage, - McpAccountManager *am); - void (*get_identifier) (McpAccountStorage *storage, const gchar *account, GValue *identifier); @@ -193,9 +190,6 @@ gboolean mcp_account_storage_delete_finish (McpAccountStorage *storage, GAsyncResult *result, GError **error); -void mcp_account_storage_ready (McpAccountStorage *storage, - McpAccountManager *am); - gboolean mcp_account_storage_commit (McpAccountStorage *storage, McpAccountManager *am, |