[empathy] Port EmpathyContactDialogs to new API.



commit 155c6bfe659f017a9fda6c99caf71f3c2a63f92b
Author: Xavier Claessens <xclaesse gmail com>
Date:   Sun Feb 15 22:28:11 2009 +0100

    Port EmpathyContactDialogs to new API.
---
 libempathy-gtk/empathy-contact-dialogs.c |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/libempathy-gtk/empathy-contact-dialogs.c b/libempathy-gtk/empathy-contact-dialogs.c
index 72b5b28..309cd64 100644
--- a/libempathy-gtk/empathy-contact-dialogs.c
+++ b/libempathy-gtk/empathy-contact-dialogs.c
@@ -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;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]