aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2009-01-07 00:46:35 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2009-01-07 00:46:35 +0800
commit8d55f797187be22ecf9f93464f0d13d51b40d6ba (patch)
treee2f82f8b595e8842312a6d0b3a8ae4f7ffd32d91
parent3c254d8497336973e7a5a624081ffb0d7dcbea8b (diff)
downloadgsoc2013-empathy-8d55f797187be22ecf9f93464f0d13d51b40d6ba.tar
gsoc2013-empathy-8d55f797187be22ecf9f93464f0d13d51b40d6ba.tar.gz
gsoc2013-empathy-8d55f797187be22ecf9f93464f0d13d51b40d6ba.tar.bz2
gsoc2013-empathy-8d55f797187be22ecf9f93464f0d13d51b40d6ba.tar.lz
gsoc2013-empathy-8d55f797187be22ecf9f93464f0d13d51b40d6ba.tar.xz
gsoc2013-empathy-8d55f797187be22ecf9f93464f0d13d51b40d6ba.tar.zst
gsoc2013-empathy-8d55f797187be22ecf9f93464f0d13d51b40d6ba.zip
Port EmpathyContactManager to the new API.
svn path=/trunk/; revision=2036
-rw-r--r--libempathy/empathy-contact-manager.c37
1 files changed, 18 insertions, 19 deletions
diff --git a/libempathy/empathy-contact-manager.c b/libempathy/empathy-contact-manager.c
index d60e47b18..f39248908 100644
--- a/libempathy/empathy-contact-manager.c
+++ b/libempathy/empathy-contact-manager.c
@@ -35,8 +35,7 @@
#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyContactManager)
typedef struct {
GHashTable *lists;
- MissionControl *mc;
- gpointer token;
+ EmpathyAccountManager *account_manager;
} EmpathyContactManagerPriv;
static void contact_manager_iface_init (EmpathyContactListIface *iface);
@@ -159,23 +158,19 @@ contact_manager_add_account (EmpathyContactManager *manager,
}
static void
-contact_manager_status_changed_cb (MissionControl *mc,
- TpConnectionStatus status,
- McPresence presence,
- TpConnectionStatusReason reason,
- const gchar *unique_name,
- EmpathyContactManager *manager)
+contact_manager_connection_changed_cb (EmpathyAccountManager *account_manager,
+ McAccount *account,
+ TpConnectionStatusReason reason,
+ TpConnectionStatus current,
+ TpConnectionStatus previous,
+ EmpathyContactManager *manager)
{
- McAccount *account;
-
- if (status != TP_CONNECTION_STATUS_CONNECTED) {
+ if (current != TP_CONNECTION_STATUS_CONNECTED) {
/* We only care about newly connected accounts */
return;
}
- account = mc_account_lookup (unique_name);
contact_manager_add_account (manager, account);
- g_object_unref (account);
}
static void
@@ -183,12 +178,11 @@ contact_manager_finalize (GObject *object)
{
EmpathyContactManagerPriv *priv = GET_PRIV (object);
- empathy_disconnect_account_status_changed (priv->token);
g_hash_table_foreach (priv->lists,
contact_manager_disconnect_foreach,
object);
g_hash_table_destroy (priv->lists);
- g_object_unref (priv->mc);
+ g_object_unref (priv->account_manager);
}
static void
@@ -205,6 +199,7 @@ static void
empathy_contact_manager_init (EmpathyContactManager *manager)
{
GSList *accounts, *l;
+ MissionControl *mc;
EmpathyContactManagerPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (manager,
EMPATHY_TYPE_CONTACT_MANAGER, EmpathyContactManagerPriv);
@@ -213,11 +208,13 @@ empathy_contact_manager_init (EmpathyContactManager *manager)
empathy_account_equal,
(GDestroyNotify) g_object_unref,
(GDestroyNotify) g_object_unref);
+ priv->account_manager = empathy_account_manager_new ();
+
+ g_signal_connect (priv->account_manager,
+ "account-connection-changed",
+ G_CALLBACK (contact_manager_connection_changed_cb), manager);
- priv->mc = empathy_mission_control_new ();
- priv->token = empathy_connect_to_account_status_changed (priv->mc,
- G_CALLBACK (contact_manager_status_changed_cb),
- manager, NULL);
+ mc = empathy_mission_control_new ();
/* Get ContactList for existing connections */
accounts = mission_control_get_online_connections (priv->mc, NULL);
@@ -225,7 +222,9 @@ empathy_contact_manager_init (EmpathyContactManager *manager)
contact_manager_add_account (manager, l->data);
g_object_unref (l->data);
}
+
g_slist_free (accounts);
+ g_object_unref (mc);
}
EmpathyContactManager *