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 | |
parent | 2da0807f7a4b6be29b980c95b888452f5a6ddc9b (diff) | |
download | telepathy-mission-control-b8617c51c1729e1579f9f066ead1fa80b0fd99a1.tar.gz |
Rename commit_one() to commit()
account_name==NULL still means to commit all.
-rw-r--r-- | mission-control-plugins/account-storage.c | 26 | ||||
-rw-r--r-- | mission-control-plugins/account-storage.h | 6 | ||||
-rw-r--r-- | src/mcd-account-manager-default.c | 2 | ||||
-rw-r--r-- | src/mcd-storage.c | 4 | ||||
-rw-r--r-- | tests/twisted/dbus-account-plugin.c | 73 | ||||
-rw-r--r-- | tests/twisted/mcp-account-diversion.c | 5 |
6 files changed, 58 insertions, 58 deletions
diff --git a/mission-control-plugins/account-storage.c b/mission-control-plugins/account-storage.c index 28ca4cfa..7b813c4c 100644 --- a/mission-control-plugins/account-storage.c +++ b/mission-control-plugins/account-storage.c @@ -59,7 +59,7 @@ * iface->get = foo_plugin_get; * iface->set = foo_plugin_get; * iface->delete = foo_plugin_delete; - * iface->commit_one = foo_plugin_commit_one; + * iface->commit = foo_plugin_commit; * iface->list = foo_plugin_list; * iface->ready = foo_plugin_ready; * iface->get_identifier = foo_plugin_get_identifier; @@ -165,7 +165,7 @@ default_delete (const McpAccountStorage *storage, } static gboolean -default_commit_one (const McpAccountStorage *storage, +default_commit (const McpAccountStorage *storage, const McpAccountManager *am, const gchar *account) { @@ -213,7 +213,7 @@ class_init (gpointer klass, iface->set_parameter = default_set_parameter; iface->create = default_create; iface->delete = default_delete; - iface->commit_one = default_commit_one; + iface->commit = default_commit; iface->ready = default_ready; iface->get_identifier = default_get_identifier; iface->get_additional_info = default_get_additional_info; @@ -365,7 +365,7 @@ mcp_account_storage_get_type (void) * @delete: implementation of mcp_account_storage_delete() * @list: implementation of mcp_account_storage_list() * @ready: implementation of mcp_account_storage_ready() - * @commit_one: implementation of mcp_account_storage_commit_one() + * @commit: implementation of mcp_account_storage_commit() * @get_identifier: implementation of mcp_account_storage_get_identifier() * @get_additional_info: implementation of * mcp_account_storage_get_additional_info() @@ -503,7 +503,7 @@ mcp_account_storage_get (const McpAccountStorage *storage, * * The plugin is not expected to write to its long term storage * at this point. It can expect Mission Control to call - * mcp_account_storage_commit_one() after a short delay. + * mcp_account_storage_commit() after a short delay. * * Plugins that implement mcp_storage_set_attribute() and * mcp_account_storage_set_parameter() can just return %FALSE here. @@ -642,7 +642,7 @@ mcp_account_storage_set_parameter (McpAccountStorage *storage, * Inform the plugin that a new account is being created. @manager, @protocol * and @identification are given to help determining the account's unique name, * but does not need to be stored on the account yet, mcp_account_storage_set() - * and mcp_account_storage_commit_one() will be called later. + * and mcp_account_storage_commit() will be called later. * * It is recommended to use mcp_account_manager_get_unique_name() to create the * unique name, but it's not mandatory. One could base the unique name on an @@ -650,7 +650,7 @@ mcp_account_storage_set_parameter (McpAccountStorage *storage, * (e.g. goa__1234). * * #McpAccountStorage::created signal should not be emitted for this account, - * not even when mcp_account_storage_commit_one() will be called. + * not even when mcp_account_storage_commit() will be called. * * There is a default implementation, which just returns %NULL and raise an * error. @@ -735,19 +735,19 @@ mcp_account_storage_delete (const McpAccountStorage *storage, } /** - * McpAccountStorageCommitOneFunc: + * McpAccountStorageCommitFunc: * @storage: an #McpAccountStorage instance * @am: an #McpAccountManager instance * @account: (allow-none): the unique suffix of an account's object path, * or %NULL * - * An implementation of mcp_account_storage_commit_one(). + * An implementation of mcp_account_storage_commit(). * * Returns: %TRUE if the commit process was started successfully */ /** - * mcp_account_storage_commit_one: + * mcp_account_storage_commit: * @storage: an #McpAccountStorage instance * @am: an #McpAccountManager instance * @account: (allow-none): the unique suffix of an account's object path, @@ -771,7 +771,7 @@ mcp_account_storage_delete (const McpAccountStorage *storage, * obvious. */ gboolean -mcp_account_storage_commit_one (const McpAccountStorage *storage, +mcp_account_storage_commit (const McpAccountStorage *storage, const McpAccountManager *am, const gchar *account) { @@ -779,9 +779,9 @@ mcp_account_storage_commit_one (const McpAccountStorage *storage, SDEBUG (storage, "called for %s", account ? account : "<all accounts>"); g_return_val_if_fail (iface != NULL, FALSE); - g_return_val_if_fail (iface->commit_one != NULL, FALSE); + g_return_val_if_fail (iface->commit != NULL, FALSE); - return iface->commit_one (storage, am, account); + return iface->commit (storage, am, account); } /** diff --git a/mission-control-plugins/account-storage.h b/mission-control-plugins/account-storage.h index fc0cc8f3..14ec5770 100644 --- a/mission-control-plugins/account-storage.h +++ b/mission-control-plugins/account-storage.h @@ -85,7 +85,7 @@ typedef gboolean (*McpAccountStorageDeleteFunc) ( typedef GList * (*McpAccountStorageListFunc) ( const McpAccountStorage *storage, const McpAccountManager *am); -typedef gboolean (*McpAccountStorageCommitOneFunc) ( +typedef gboolean (*McpAccountStorageCommitFunc) ( const McpAccountStorage *storage, const McpAccountManager *am, const gchar *account); @@ -117,7 +117,7 @@ struct _McpAccountStorageIface McpAccountStorageDeleteFunc delete; McpAccountStorageListFunc list; McpAccountStorageReadyFunc ready; - McpAccountStorageCommitOneFunc commit_one; + McpAccountStorageCommitFunc commit; McpAccountStorageGetIdentifierFunc get_identifier; McpAccountStorageGetAdditionalInfoFunc get_additional_info; McpAccountStorageGetRestrictionsFunc get_restrictions; @@ -168,7 +168,7 @@ void mcp_account_storage_ready (const McpAccountStorage *storage, const McpAccountManager *am); gboolean -mcp_account_storage_commit_one (const McpAccountStorage *storage, +mcp_account_storage_commit (const McpAccountStorage *storage, const McpAccountManager *am, const gchar *account); diff --git a/src/mcd-account-manager-default.c b/src/mcd-account-manager-default.c index 202e8c43..515cdbd3 100644 --- a/src/mcd-account-manager-default.c +++ b/src/mcd-account-manager-default.c @@ -1015,7 +1015,7 @@ account_storage_iface_init (McpAccountStorageIface *iface, iface->set_parameter = set_parameter; iface->create = _create; iface->delete = _delete; - iface->commit_one = _commit; + iface->commit = _commit; iface->list = _list; } diff --git a/src/mcd-storage.c b/src/mcd-storage.c index 353a2b0a..df79d89e 100644 --- a/src/mcd-storage.c +++ b/src/mcd-storage.c @@ -2169,7 +2169,7 @@ mcd_storage_commit (McdStorage *self, const gchar *account) DEBUG ("flushing plugin %s %s to long term storage", mcp_account_storage_name (sa->storage), account); - mcp_account_storage_commit_one (sa->storage, ma, account); + mcp_account_storage_commit (sa->storage, ma, account); return; } @@ -2179,7 +2179,7 @@ mcd_storage_commit (McdStorage *self, const gchar *account) DEBUG ("flushing plugin %s to long term storage", mcp_account_storage_name (plugin)); - mcp_account_storage_commit_one (plugin, ma, NULL); + mcp_account_storage_commit (plugin, ma, NULL); } } 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; } |