diff options
author | Xavier Claessens <xavier.claessens@collabora.co.uk> | 2013-11-08 12:54:34 -0500 |
---|---|---|
committer | Xavier Claessens <xavier.claessens@collabora.co.uk> | 2013-11-08 16:56:44 -0500 |
commit | b8617c51c1729e1579f9f066ead1fa80b0fd99a1 (patch) | |
tree | 63910f057f5278fe163130db67eaf5d4f7aaf4be /tests/twisted | |
parent | 2da0807f7a4b6be29b980c95b888452f5a6ddc9b (diff) |
Rename commit_one() to commit()
account_name==NULL still means to commit all.
Diffstat (limited to 'tests/twisted')
-rw-r--r-- | tests/twisted/dbus-account-plugin.c | 73 | ||||
-rw-r--r-- | tests/twisted/mcp-account-diversion.c | 5 |
2 files changed, 39 insertions, 39 deletions
diff --git a/tests/twisted/dbus-account-plugin.c b/tests/twisted/dbus-account-plugin.c index 063b886d..d1c0bf14 100644 --- a/tests/twisted/dbus-account-plugin.c +++ b/tests/twisted/dbus-account-plugin.c @@ -1194,36 +1194,6 @@ test_dbus_account_plugin_set_parameter (McpAccountStorage *storage, return TRUE; } -static gboolean -test_dbus_account_plugin_commit (const McpAccountStorage *storage, - const McpAccountManager *am) -{ - TestDBusAccountPlugin *self = TEST_DBUS_ACCOUNT_PLUGIN (storage); - GHashTableIter iter; - gpointer k; - - DEBUG ("called"); - - if (!self->active) - return FALSE; - - g_dbus_connection_emit_signal (self->bus, NULL, - TEST_DBUS_ACCOUNT_PLUGIN_PATH, TEST_DBUS_ACCOUNT_PLUGIN_IFACE, - "CommittingAll", NULL, NULL); - - g_hash_table_iter_init (&iter, self->accounts); - - while (g_hash_table_iter_next (&iter, &k, NULL)) - { - if (!mcp_account_storage_commit_one (storage, am, k)) - { - g_warning ("declined to commit account %s", (const gchar *) k); - } - } - - return TRUE; -} - static void delete_account_cb (GObject *source_object, GAsyncResult *res, @@ -1355,11 +1325,9 @@ update_parameters_cb (GObject *source_object, } static gboolean -test_dbus_account_plugin_commit_one (const McpAccountStorage *storage, - const McpAccountManager *am, +commit_one (TestDBusAccountPlugin *self, const gchar *account_name) { - TestDBusAccountPlugin *self = TEST_DBUS_ACCOUNT_PLUGIN (storage); Account *account = lookup_account (self, account_name); GHashTableIter iter; gpointer k; @@ -1370,9 +1338,6 @@ test_dbus_account_plugin_commit_one (const McpAccountStorage *storage, DEBUG ("%s", account_name); - if (account_name == NULL) - return test_dbus_account_plugin_commit (storage, am); - if (!self->active || account == NULL) return FALSE; @@ -1524,6 +1489,40 @@ test_dbus_account_plugin_commit_one (const McpAccountStorage *storage, return TRUE; } +static gboolean +test_dbus_account_plugin_commit (const McpAccountStorage *storage, + const McpAccountManager *am, + const gchar *account_name) +{ + TestDBusAccountPlugin *self = TEST_DBUS_ACCOUNT_PLUGIN (storage); + GHashTableIter iter; + gpointer k; + + DEBUG ("called"); + + if (!self->active) + return FALSE; + + if (account_name != NULL) + return commit_one (self, account_name); + + g_dbus_connection_emit_signal (self->bus, NULL, + TEST_DBUS_ACCOUNT_PLUGIN_PATH, TEST_DBUS_ACCOUNT_PLUGIN_IFACE, + "CommittingAll", NULL, NULL); + + g_hash_table_iter_init (&iter, self->accounts); + + while (g_hash_table_iter_next (&iter, &k, NULL)) + { + if (!commit_one (self, k)) + { + g_warning ("declined to commit account %s", (const gchar *) k); + } + } + + return TRUE; +} + static void test_dbus_account_plugin_get_identifier (const McpAccountStorage *storage, const gchar *account_name, @@ -1594,7 +1593,7 @@ 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_one = test_dbus_account_plugin_commit_one; + iface->commit = test_dbus_account_plugin_commit; 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; diff --git a/tests/twisted/mcp-account-diversion.c b/tests/twisted/mcp-account-diversion.c index 9e8bb867..c3fa55a0 100644 --- a/tests/twisted/mcp-account-diversion.c +++ b/tests/twisted/mcp-account-diversion.c @@ -206,7 +206,7 @@ _delete (const McpAccountStorage *self, static gboolean -_commit_one (const McpAccountStorage *self, +_commit (const McpAccountStorage *self, const McpAccountManager *am, const gchar *account_name) { @@ -221,6 +221,7 @@ _commit_one (const McpAccountStorage *self, if (!_have_config ()) _create_config (); + /* In this naïve implementation, we always commit all accounts together */ data = g_key_file_to_data (adp->keyfile, &n, NULL); rval = g_file_set_contents (_conf_filename (), data, n, NULL); adp->save = !rval; @@ -267,7 +268,7 @@ account_storage_iface_init (McpAccountStorageIface *iface, iface->get = _get; iface->set = _set; iface->delete = _delete; - iface->commit_one = _commit_one; + iface->commit = _commit; iface->list = _list; } |