Port EmpathyContactDialogs to new API.
authorXavier Claessens <xclaesse@gmail.com>
Sun, 15 Feb 2009 21:28:11 +0000 (22:28 +0100)
committerXavier Claessens <xclaesse@gmail.com>
Wed, 22 Apr 2009 10:21:08 +0000 (12:21 +0200)
libempathy-gtk/empathy-contact-dialogs.c

index 72b5b28b38be9eb4d4611d0e582c7504e8d12031..309cd649c8e8708d3530b4e171f79e98b70ed96e 100644 (file)
@@ -30,6 +30,7 @@
 #include <libmissioncontrol/mission-control.h>
 
 #include <libempathy/empathy-contact-manager.h>
+#include <libempathy/empathy-account-manager.h>
 #include <libempathy/empathy-contact-list.h>
 #include <libempathy/empathy-utils.h>
 
@@ -242,12 +243,23 @@ static gboolean
 can_add_contact_to_account (McAccount *account,
                            gpointer   user_data)
 {
-       EmpathyContactManager *mgr;
+       EmpathyAccountManager *account_manager;
+       EmpathyContactManager *contact_manager;
+       TpConnection          *connection;
        gboolean               result;
 
-       mgr = empathy_contact_manager_dup_singleton ();
-       result = empathy_contact_manager_can_add (mgr, account);
-       g_object_unref (mgr);
+       account_manager = empathy_account_manager_dup_singleton ();
+       connection = empathy_account_manager_get_connection (account_manager,
+                                                            account);
+       if (!connection) {
+               g_object_unref (account_manager);
+               return FALSE;
+       }
+
+       contact_manager = empathy_contact_manager_dup_singleton ();
+       result = empathy_contact_manager_can_add (contact_manager, connection);
+       g_object_unref (contact_manager);
+       g_object_unref (account_manager);
 
        return result;
 }