diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2013-11-12 16:00:31 +0000 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2014-01-29 19:28:29 +0000 |
commit | 65e376653dfea9d1b3712f8429b657f9d4338386 (patch) | |
tree | f74fb3d7dcdb2cc0e8b8d7ed095a073c40e237ba /mission-control-plugins | |
parent | 21ab80884868a065772297d31f8ce8ba0d30bb7b (diff) |
Remove mcp_account_storage_set()
_set_attribute() and _set_parameter() are now mandatory for writable
storage plugins.
Note that most of the keyfile escaping code is still needed to help
plugins to read their old keyfile values.
[adjusted to apply earlier in the branch; left in the code that
detects whether mcd_storage_set_parameter() is a no-op for an
escaped parameter; took out mcp_account_storage_emit_created
documentation fix -smcv]
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=71384
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Diffstat (limited to 'mission-control-plugins')
-rw-r--r-- | mission-control-plugins/account-storage.c | 76 | ||||
-rw-r--r-- | mission-control-plugins/account-storage.h | 13 |
2 files changed, 4 insertions, 85 deletions
diff --git a/mission-control-plugins/account-storage.c b/mission-control-plugins/account-storage.c index 8f5609ce..83189564 100644 --- a/mission-control-plugins/account-storage.c +++ b/mission-control-plugins/account-storage.c @@ -57,7 +57,6 @@ * iface->provider = "org.freedesktop.Telepathy.MissionControl5.FooStorage"; * * iface->get = foo_plugin_get; - * iface->set = foo_plugin_get; * iface->delete = foo_plugin_delete; * iface->commit = foo_plugin_commit; * iface->list = foo_plugin_list; @@ -112,16 +111,6 @@ enum static guint signals[NO_SIGNAL] = { 0 }; static gboolean -default_set (const McpAccountStorage *storage, - const McpAccountManager *am, - const gchar *account, - const gchar *key, - const gchar *val) -{ - return FALSE; -} - -static gboolean default_set_attribute (McpAccountStorage *storage, McpAccountManager *am, const gchar *account, @@ -164,7 +153,6 @@ class_init (gpointer klass, McpAccountStorageIface *iface = klass; iface->owns = default_owns; - iface->set = default_set; iface->set_attribute = default_set_attribute; iface->set_parameter = default_set_parameter; @@ -423,59 +411,6 @@ mcp_account_storage_get (const McpAccountStorage *storage, } /** - * McpAccountStorageSetFunc: - * @storage: an #McpAccountStorage instance - * @am: an #McpAccountManager instance - * @account: the unique name of the account - * @key: the setting whose value we wish to store: either an attribute - * like "DisplayName", or "param-" plus a parameter like "account" - * @val: a non-%NULL value for @key - * - * An implementation of mcp_account_storage_set(). - * - * Returns: %TRUE if @storage is responsible for @account - */ - -/** - * mcp_account_storage_set: - * @storage: an #McpAccountStorage instance - * @am: an #McpAccountManager instance - * @account: the unique name of the account - * @key: the non-%NULL setting whose value we wish to store: either an - * attribute like "DisplayName", or "param-" plus a parameter like "account" - * @value: a value to associate with @key, escaped as if for a #GKeyFile - * - * The plugin is expected to either quickly and synchronously - * update its internal cache of values with @value, or to - * decline to store the setting. - * - * The plugin is not expected to write to its long term storage - * at this point. It can expect Mission Control to call either - * mcp_account_storage_commit() with either @account or %NULL - * after a short delay. - * - * Plugins that implement mcp_storage_set_attribute() and - * mcp_account_storage_set_parameter() can just return %FALSE here. - * There is a default implementation, which just returns %FALSE. - * - * Returns: %TRUE if the attribute was claimed, %FALSE otherwise - */ -gboolean -mcp_account_storage_set (const McpAccountStorage *storage, - const McpAccountManager *am, - const gchar *account, - const gchar *key, - const gchar *value) -{ - McpAccountStorageIface *iface = MCP_ACCOUNT_STORAGE_GET_IFACE (storage); - - SDEBUG (storage, ""); - g_return_val_if_fail (iface != NULL, FALSE); - - return iface->set (storage, am, account, key, value); -} - -/** * mcp_account_storage_set_attribute: * @storage: an #McpAccountStorage instance * @am: an #McpAccountManager instance @@ -493,9 +428,8 @@ mcp_account_storage_set (const McpAccountStorage *storage, * The plugin is not expected to write to its long term storage * at this point. * - * There is a default implementation, which just returns %FALSE. - * Mission Control will call mcp_account_storage_set() instead, - * using a keyfile-escaped version of @value. + * There is a default implementation, which just returns %FALSE for read-only + * storage plugins. * * Returns: %TRUE if the attribute was claimed, %FALSE otherwise * @@ -537,10 +471,8 @@ mcp_account_storage_set_attribute (McpAccountStorage *storage, * The plugin is not expected to write to its long term storage * at this point. * - * There is a default implementation, which just returns %FALSE. - * Mission Control will call mcp_account_storage_set() instead, - * using "param-" + @parameter as key and a keyfile-escaped version - * of @value as value. + * There is a default implementation, which just returns %FALSE for read-only + * storage plugins. * * Returns: %TRUE if the parameter was claimed, %FALSE otherwise * diff --git a/mission-control-plugins/account-storage.h b/mission-control-plugins/account-storage.h index ecc4e267..198e8353 100644 --- a/mission-control-plugins/account-storage.h +++ b/mission-control-plugins/account-storage.h @@ -64,12 +64,6 @@ typedef gboolean (*McpAccountStorageGetFunc) ( const McpAccountManager *am, const gchar *account, const gchar *key); -typedef gboolean (*McpAccountStorageSetFunc) ( - const McpAccountStorage *storage, - const McpAccountManager *am, - const gchar *account, - const gchar *key, - const gchar *val); typedef gchar * (*McpAccountStorageCreate) ( const McpAccountStorage *storage, const McpAccountManager *am, @@ -112,7 +106,6 @@ struct _McpAccountStorageIface const gchar *desc; const gchar *provider; - McpAccountStorageSetFunc set; McpAccountStorageGetFunc get; McpAccountStorageDeleteFunc delete; McpAccountStorageCommitFunc commit; @@ -149,12 +142,6 @@ gboolean mcp_account_storage_get (const McpAccountStorage *storage, const gchar *account, const gchar *key); -gboolean mcp_account_storage_set (const McpAccountStorage *storage, - const McpAccountManager *am, - const gchar *account, - const gchar *key, - const gchar *value); - gchar * mcp_account_storage_create (const McpAccountStorage *storage, const McpAccountManager *am, const gchar *manager, |