summaryrefslogtreecommitdiff
path: root/tests/twisted
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.co.uk>2013-11-07 15:07:56 -0500
committerXavier Claessens <xavier.claessens@collabora.co.uk>2013-11-08 16:56:43 -0500
commit2da0807f7a4b6be29b980c95b888452f5a6ddc9b (patch)
treec8956ae760f24584e9f2bb5edb3155e93bb38546 /tests/twisted
parent100fcffec5f53ff19c101114633198d468722349 (diff)
Simplify a bit storage API
This is an API break, but we already did some since last release. This removes mcp_account_storage_commit() because it is redundant with mcp_account_storage_commit_one (plugin, am, NULL); This removes mcp_account_storage_owns() because an account is now owned by one and only one storage plugin and MC now keeps track of which storage plugin each account comes from. Finally this adds default implementation on most iface methods to make read-only plugins easier to implement. Only _get() and _list() and mandatory.
Diffstat (limited to 'tests/twisted')
-rw-r--r--tests/twisted/dbus-account-plugin.c23
-rw-r--r--tests/twisted/mcp-account-diversion.c7
2 files changed, 6 insertions, 24 deletions
diff --git a/tests/twisted/dbus-account-plugin.c b/tests/twisted/dbus-account-plugin.c
index 3cf29ca1..063b886d 100644
--- a/tests/twisted/dbus-account-plugin.c
+++ b/tests/twisted/dbus-account-plugin.c
@@ -1370,9 +1370,8 @@ test_dbus_account_plugin_commit_one (const McpAccountStorage *storage,
DEBUG ("%s", account_name);
- /* MC does not call @commit_one with parameter %NULL (meaning "all accounts")
- * if we also implement commit(), which, as it happens, we do */
- g_return_val_if_fail (account_name != NULL, FALSE);
+ if (account_name == NULL)
+ return test_dbus_account_plugin_commit (storage, am);
if (!self->active || account == NULL)
return FALSE;
@@ -1580,22 +1579,6 @@ test_dbus_account_plugin_get_restrictions (const McpAccountStorage *storage,
return account->restrictions;
}
-static gboolean
-test_dbus_account_plugin_owns (McpAccountStorage *storage,
- McpAccountManager *am,
- const gchar *account_name)
-{
- TestDBusAccountPlugin *self = TEST_DBUS_ACCOUNT_PLUGIN (storage);
- Account *account = lookup_account (self, account_name);
-
- DEBUG ("%s", account_name);
-
- if (!self->active || account == NULL || (account->flags & UNCOMMITTED_DELETION))
- return FALSE;
-
- return TRUE;
-}
-
static void
account_storage_iface_init (McpAccountStorageIface *iface)
{
@@ -1611,11 +1594,9 @@ account_storage_iface_init (McpAccountStorageIface *iface)
iface->list = test_dbus_account_plugin_list;
iface->ready = test_dbus_account_plugin_ready;
iface->delete = test_dbus_account_plugin_delete;
- iface->commit = test_dbus_account_plugin_commit;
iface->commit_one = test_dbus_account_plugin_commit_one;
iface->get_identifier = test_dbus_account_plugin_get_identifier;
iface->get_additional_info = test_dbus_account_plugin_get_additional_info;
iface->get_restrictions = test_dbus_account_plugin_get_restrictions;
iface->create = test_dbus_account_plugin_create;
- iface->owns = test_dbus_account_plugin_owns;
}
diff --git a/tests/twisted/mcp-account-diversion.c b/tests/twisted/mcp-account-diversion.c
index 923f51b4..9e8bb867 100644
--- a/tests/twisted/mcp-account-diversion.c
+++ b/tests/twisted/mcp-account-diversion.c
@@ -206,8 +206,9 @@ _delete (const McpAccountStorage *self,
static gboolean
-_commit (const McpAccountStorage *self,
- const McpAccountManager *am)
+_commit_one (const McpAccountStorage *self,
+ const McpAccountManager *am,
+ const gchar *account_name)
{
gsize n;
gchar *data;
@@ -266,7 +267,7 @@ account_storage_iface_init (McpAccountStorageIface *iface,
iface->get = _get;
iface->set = _set;
iface->delete = _delete;
- iface->commit = _commit;
+ iface->commit_one = _commit_one;
iface->list = _list;
}