aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2009-07-22 01:45:20 +0800
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>2009-07-22 01:45:20 +0800
commit08c068fc1b90777c3a2b9c313e282f93f24b3f71 (patch)
treecae754e3f2af08e14b9c2df0b0a176fb6cc999f1 /libempathy
parent68dcc8dcce232a4e8c803bd6cc71052c473f9203 (diff)
downloadgsoc2013-empathy-08c068fc1b90777c3a2b9c313e282f93f24b3f71.tar
gsoc2013-empathy-08c068fc1b90777c3a2b9c313e282f93f24b3f71.tar.gz
gsoc2013-empathy-08c068fc1b90777c3a2b9c313e282f93f24b3f71.tar.bz2
gsoc2013-empathy-08c068fc1b90777c3a2b9c313e282f93f24b3f71.tar.lz
gsoc2013-empathy-08c068fc1b90777c3a2b9c313e282f93f24b3f71.tar.xz
gsoc2013-empathy-08c068fc1b90777c3a2b9c313e282f93f24b3f71.tar.zst
gsoc2013-empathy-08c068fc1b90777c3a2b9c313e282f93f24b3f71.zip
Make the account manager listen to AccountValidityChanged
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-account-manager.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/libempathy/empathy-account-manager.c b/libempathy/empathy-account-manager.c
index 7df1a80b7..5d1363fce 100644
--- a/libempathy/empathy-account-manager.c
+++ b/libempathy/empathy-account-manager.c
@@ -282,6 +282,10 @@ account_manager_add_account (EmpathyAccountManager *manager,
EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
EmpathyAccount *account;
+ account = g_hash_table_lookup (priv->accounts, path);
+ if (account != NULL)
+ return account;
+
account = empathy_account_new (priv->dbus, path);
g_hash_table_insert (priv->accounts, g_strdup (path), account);
@@ -322,6 +326,21 @@ account_manager_got_all_cb (TpProxy *proxy,
}
static void
+account_validity_changed_cb (TpAccountManager *proxy,
+ const gchar *path,
+ gboolean valid,
+ gpointer user_data,
+ GObject *weak_object)
+{
+ EmpathyAccountManager *manager = EMPATHY_ACCOUNT_MANAGER (weak_object);
+
+ if (!valid)
+ return;
+
+ account_manager_add_account (manager, path);
+}
+
+static void
account_manager_name_owner_cb (TpDBusDaemon *proxy,
const gchar *name,
const gchar *new_owner,
@@ -334,6 +353,15 @@ account_manager_name_owner_cb (TpDBusDaemon *proxy,
account_manager_name_owner_cb, user_data);
priv->tp_manager = tp_account_manager_new (priv->dbus);
+
+ tp_cli_account_manager_connect_to_account_validity_changed (
+ priv->tp_manager,
+ account_validity_changed_cb,
+ NULL,
+ NULL,
+ G_OBJECT (manager),
+ NULL);
+
tp_cli_dbus_properties_call_get_all (priv->tp_manager, -1,
TP_IFACE_ACCOUNT_MANAGER,
account_manager_got_all_cb,
@@ -795,8 +823,11 @@ empathy_account_manager_created_cb (TpAccountManager *proxy,
}
account = account_manager_add_account (manager, account_path);
- g_signal_connect (account, "notify::ready",
- G_CALLBACK (empathy_account_manager_created_ready_cb), result);
+ if (empathy_account_is_ready (account))
+ empathy_account_manager_created_ready_cb (account, NULL, result);
+ else
+ g_signal_connect (account, "notify::ready",
+ G_CALLBACK (empathy_account_manager_created_ready_cb), result);
}
void