telepathy-mission-control: mcd_master_connect_automatic_accounts: move to McdAccountManager

Simon McVittie smcv at kemper.freedesktop.org
Wed Sep 4 05:38:36 PDT 2013


Module: telepathy-mission-control
Branch: master
Commit: 3ec7b1947bf5c595edc1f2329aa6ce7b9feda816
URL:    http://cgit.freedesktop.org/telepathy/telepathy-mission-control/commit/?id=3ec7b1947bf5c595edc1f2329aa6ce7b9feda816

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Thu Aug 29 16:41:54 2013 +0100

mcd_master_connect_automatic_accounts: move to McdAccountManager

Iterating over all accounts? Looks like a job for the account manager.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68712
Signed-off-by: Simon McVittie <simon.mcvittie at collabora.co.uk>
Reviewed-by: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>

---

 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 31329f3..3371a45 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;
 }
 



More information about the telepathy-commits mailing list