From 0d76e8c1c2deaace4512cb1c1dc6d2d24c39352c Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 29 Aug 2013 16:41:54 +0100 Subject: [PATCH 13/16] mcd_master_connect_automatic_accounts: move to McdAccountManager Iterating over all accounts? Looks like a job for the account manager. --- src/mcd-account-manager.c | 7 +++++++ src/mcd-master.c | 21 --------------------- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/src/mcd-account-manager.c b/src/mcd-account-manager.c index 1b2fbc5..5975438 100644 --- a/src/mcd-account-manager.c +++ b/src/mcd-account-manager.c @@ -1418,6 +1418,8 @@ _mcd_account_manager_setup (McdAccountManager *account_manager) McdStorage *storage = priv->storage; McdLoadAccountsData *lad; gchar **accounts, **name; + GHashTableIter iter; + gpointer v; tp_list_connection_names (priv->dbus_daemon, list_connection_names_cb, NULL, NULL, @@ -1481,6 +1483,11 @@ _mcd_account_manager_setup (McdAccountManager *account_manager) migrate_accounts (account_manager, lad); release_load_accounts_lock (lad); + + g_hash_table_iter_init (&iter, account_manager->priv->accounts); + + while (g_hash_table_iter_next (&iter, NULL, &v)) + _mcd_account_maybe_autoconnect (v); } static void diff --git a/src/mcd-master.c b/src/mcd-master.c index f1cbbf7..7a1f4ba 100644 --- a/src/mcd-master.c +++ b/src/mcd-master.c @@ -127,22 +127,6 @@ typedef struct { static McdMaster *default_master = NULL; static void -mcd_master_connect_automatic_accounts (McdMaster *master) -{ - McdMasterPrivate *priv = master->priv; - GHashTable *accounts; - GHashTableIter iter; - gpointer ht_key, ht_value; - - accounts = _mcd_account_manager_get_accounts (priv->account_manager); - g_hash_table_iter_init (&iter, accounts); - while (g_hash_table_iter_next (&iter, &ht_key, &ht_value)) - { - _mcd_account_maybe_autoconnect (ht_value); - } -} - -static void _mcd_master_get_property (GObject * obj, guint prop_id, GValue * val, GParamSpec * pspec) { @@ -259,11 +243,6 @@ mcd_master_constructor (GType type, guint n_params, mcd_kludge_transport_install (master, mcd_account_manager_get_connectivity_monitor (priv->account_manager)); - /* we assume that at this point all transport plugins have been registered. - * We get the active transports and check whether some accounts should be - * automatically connected */ - mcd_master_connect_automatic_accounts (master); - return (GObject *) master; } -- 1.8.4.rc3