From ea82d4be5876f8adb5d958359019d76b65669841 Mon Sep 17 00:00:00 2001
From: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Date: Fri, 16 Dec 2011 16:07:46 +0100
Subject: No need to manually prepare the connection

tp-glib does it for us now, thanks to the EmpathyClientFactory.
---
 src/empathy-accounts-dialog.c | 34 +++++++++-------------------------
 1 file changed, 9 insertions(+), 25 deletions(-)

(limited to 'src')

diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c
index 488388c4f..d7b16edf2 100644
--- a/src/empathy-accounts-dialog.c
+++ b/src/empathy-accounts-dialog.c
@@ -659,29 +659,6 @@ account_dialog_got_self_contact (TpConnection *conn,
   gtk_widget_show (editor);
 }
 
-static void
-conn_prepared (GObject *src,
-    GAsyncResult *result,
-    gpointer user_data)
-{
-  TpConnection *conn = TP_CONNECTION (src);
-  EmpathyAccountsDialog *dialog = user_data;
-  GError *error = NULL;
-
-  if (!tp_proxy_prepare_finish (conn, result, &error))
-    {
-      DEBUG ("Failed to get self-contact: %s", error->message);
-      account_dialog_show_contact_details_failed (dialog, TRUE);
-      g_error_free (error);
-      return;
-    }
-
-  empathy_tp_contact_factory_get_from_handle (conn,
-      tp_connection_get_self_handle (conn),
-      account_dialog_got_self_contact,
-      NULL, NULL, G_OBJECT (dialog));
-}
-
 static void
 account_dialog_create_dialog_content (EmpathyAccountsDialog *dialog,
     EmpathyAccountSettings *settings)
@@ -709,9 +686,16 @@ account_dialog_create_dialog_content (EmpathyAccountsDialog *dialog,
     conn = tp_account_get_connection (account);
 
   if (conn != NULL)
-    tp_proxy_prepare_async (conn, NULL, conn_prepared, dialog);
+    {
+      empathy_tp_contact_factory_get_from_handle (conn,
+          tp_connection_get_self_handle (conn),
+          account_dialog_got_self_contact,
+          NULL, NULL, G_OBJECT (dialog));
+    }
   else
-    account_dialog_show_contact_details_failed (dialog, FALSE);
+    {
+      account_dialog_show_contact_details_failed (dialog, FALSE);
+    }
 
   bbox = gtk_hbutton_box_new ();
   gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_END);
-- 
cgit v1.2.3