]> git.0d.be Git - empathy.git/blobdiff - libempathy/empathy-contact-manager.c
[darcs-to-svn @ Connect accounts in empathy-launcher, not in empathy-contact-list]
[empathy.git] / libempathy / empathy-contact-manager.c
index 15fb82eedeb84f312467e8f662dbe352f765df88..cf5a81fe26ccf776a4e51e34a43c2d4e37631ca8 100644 (file)
@@ -1,6 +1,6 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 /*
- * Copyright (C) 2007 Xavier Claessens <xclaesse@gmail.com>
+ * Copyright (C) 2007 Collabora Ltd.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
  * License along with this program; if not, write to the
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
+ * 
+ * Authors: Xavier Claessens <xclaesse@gmail.com>
  */
 
 #include <config.h>
 
 #include <string.h>
 
+#include <libtelepathy/tp-helpers.h>
 #include <libtelepathy/tp-constants.h>
 
 #include "empathy-contact-manager.h"
@@ -35,8 +38,9 @@
 #define DEBUG_DOMAIN "ContactManager"
 
 struct _EmpathyContactManagerPriv {
-       GHashTable *lists;
-       gboolean    setup;
+       GHashTable     *lists;
+       MissionControl *mc;
+       gboolean        setup;
 };
 
 typedef struct {
@@ -128,7 +132,6 @@ static void
 empathy_contact_manager_init (EmpathyContactManager *manager)
 {
        EmpathyContactManagerPriv *priv;
-       MissionControl            *mc;
        GSList                    *accounts, *l;
 
        priv = GET_PRIV (manager);
@@ -138,14 +141,15 @@ empathy_contact_manager_init (EmpathyContactManager *manager)
                                             (GDestroyNotify) g_object_unref,
                                             (GDestroyNotify) g_object_unref);
 
-       mc = empathy_session_get_mission_control ();
+       priv->mc = mission_control_new (tp_get_bus ());
 
-       dbus_g_proxy_connect_signal (DBUS_G_PROXY (mc), "AccountStatusChanged",
+       dbus_g_proxy_connect_signal (DBUS_G_PROXY (priv->mc),
+                                    "AccountStatusChanged",
                                     G_CALLBACK (contact_manager_status_changed_cb),
                                     manager, NULL);
 
        /* Get ContactList for existing connections */
-       accounts = mission_control_get_online_connections (mc, NULL);
+       accounts = mission_control_get_online_connections (priv->mc, NULL);
        for (l = accounts; l; l = l->next) {
                McAccount *account;
 
@@ -165,6 +169,7 @@ contact_manager_finalize (GObject *object)
        priv = GET_PRIV (object);
 
        g_hash_table_destroy (priv->lists);
+       g_object_unref (priv->mc);
 }
 
 EmpathyContactManager *