summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2013-11-15 17:33:06 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2014-01-29 19:28:33 +0000
commit8e5e39aa29a833be16598b2392539af07808a85d (patch)
treeac12aab8bbfe0c2cc9e1e1a7d701c7b6c8c673bb
parent762d3c7746146b7d94b3e3c5df7d78c62e78202f (diff)
McdAccountManager: commit accounts one at a time
In the process, inline mcd_account_manager_write_conf_async and uncork_storage_plugins into their callers, with considerable simplification because the async API isn't actually used any more. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=27727
-rw-r--r--src/mcd-account-manager.c79
-rw-r--r--src/mcd-account-manager.h9
2 files changed, 17 insertions, 71 deletions
diff --git a/src/mcd-account-manager.c b/src/mcd-account-manager.c
index a71350cc..fa031161 100644
--- a/src/mcd-account-manager.c
+++ b/src/mcd-account-manager.c
@@ -782,8 +782,11 @@ complete_account_creation_finish (McdAccount *account,
tp_clear_object (&account);
}
- mcd_account_manager_write_conf_async (account_manager, account, NULL,
- NULL);
+ if (account != NULL)
+ {
+ mcd_storage_commit (account_manager->priv->storage,
+ mcd_account_get_unique_name (account));
+ }
if (cad->callback != NULL)
cad->callback (account_manager, account, cad->error, cad->user_data);
@@ -1191,15 +1194,6 @@ setup_account_loaded (McdAccount *account,
g_object_unref (self);
}
-static void
-uncork_storage_plugins (McdAccountManager *account_manager)
-{
- McdAccountManagerPrivate *priv = MCD_ACCOUNT_MANAGER_PRIV (account_manager);
-
- mcd_account_manager_write_conf_async (account_manager, NULL, NULL, NULL);
- mcd_storage_ready (priv->storage);
-}
-
typedef struct
{
McdAccountManager *self;
@@ -1512,7 +1506,18 @@ _mcd_account_manager_setup (McdAccountManager *account_manager)
g_object_unref (account);
}
- uncork_storage_plugins (account_manager);
+ /* FIXME: why do we need to commit the accounts at this point?
+ * It was added to uncork_storage_plugins() in 3d5b5e7a248d
+ * without explanation */
+ g_hash_table_iter_init (&iter, account_manager->priv->accounts);
+ while (g_hash_table_iter_next (&iter, NULL, &v))
+ {
+ mcd_storage_commit (storage,
+ mcd_account_get_unique_name (v));
+ }
+
+ /* uncork signals from storage plugins */
+ mcd_storage_ready (priv->storage);
migrate_accounts (account_manager);
@@ -1749,56 +1754,6 @@ mcd_account_manager_get_connectivity_monitor (McdAccountManager *self)
return self->priv->minotaur;
}
-/**
- * McdAccountManagerWriteConfCb:
- * @account_manager: the #McdAccountManager
- * @error: a set #GError on failure or %NULL if there was no error
- * @user_data: user data
- *
- * The callback from mcd_account_manager_write_conf_async(). If the config
- * writing was successful, @error will be %NULL, otherwise it will be set
- * with the appropriate error.
- */
-
-/**
- * mcd_account_manager_write_conf_async:
- * @account_manager: the #McdAccountManager
- * @account: the account to be written, or %NULL to flush all accounts
- * @callback: a callback to be called on write success or failure
- * @user_data: data to be passed to @callback
- *
- * Write the account manager configuration to disk.
- */
-void
-mcd_account_manager_write_conf_async (McdAccountManager *account_manager,
- McdAccount *account,
- McdAccountManagerWriteConfCb callback,
- gpointer user_data)
-{
- McdStorage *storage = NULL;
- const gchar *account_name = NULL;
-
- g_return_if_fail (MCD_IS_ACCOUNT_MANAGER (account_manager));
-
- storage = account_manager->priv->storage;
-
- if (account != NULL)
- {
- account_name = mcd_account_get_unique_name (account);
-
- DEBUG ("updating %s", account_name);
- mcd_storage_commit (storage, account_name);
- }
- else
- {
- DEBUG ("updating all accounts");
- mcd_storage_commit (storage, NULL);
- }
-
- if (callback != NULL)
- callback (account_manager, NULL, user_data);
-}
-
GHashTable *
_mcd_account_manager_get_accounts (McdAccountManager *account_manager)
{
diff --git a/src/mcd-account-manager.h b/src/mcd-account-manager.h
index 922f4896..f33c2949 100644
--- a/src/mcd-account-manager.h
+++ b/src/mcd-account-manager.h
@@ -66,15 +66,6 @@ McdAccountManager *mcd_account_manager_new (
TpDBusDaemon *mcd_account_manager_get_dbus_daemon
(McdAccountManager *account_manager);
-typedef void (McdAccountManagerWriteConfCb) (McdAccountManager *account_manager,
- const GError *error,
- gpointer user_data);
-
-void mcd_account_manager_write_conf_async (McdAccountManager *account_manager,
- McdAccount *account,
- McdAccountManagerWriteConfCb callback,
- gpointer user_data);
-
McdAccount *mcd_account_manager_lookup_account (McdAccountManager *account_manager,
const gchar *name);
McdAccount *mcd_account_manager_lookup_account_by_path (McdAccountManager *account_manager,