[empathy] contact-widget: rely on the factory to prepare TP_CONNECTION_FEATURE_CONTACT_INFO



commit c428f8a475111473ea9a9dc246ca1d2312f41d8c
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Thu Aug 18 14:06:14 2011 +0200

    contact-widget: rely on the factory to prepare TP_CONNECTION_FEATURE_CONTACT_INFO
    
    https://bugzilla.gnome.org/show_bug.cgi?id=656831

 libempathy-gtk/empathy-contact-widget.c |   16 ++++++----------
 libempathy/empathy-client-factory.c     |    3 +++
 2 files changed, 9 insertions(+), 10 deletions(-)
---
diff --git a/libempathy-gtk/empathy-contact-widget.c b/libempathy-gtk/empathy-contact-widget.c
index 14042bf..f73d75d 100644
--- a/libempathy-gtk/empathy-contact-widget.c
+++ b/libempathy-gtk/empathy-contact-widget.c
@@ -792,16 +792,14 @@ contact_widget_details_request_cb (GObject *object,
 }
 
 static void
-contact_widget_details_feature_prepared_cb (GObject *object,
-    GAsyncResult *res,
-    gpointer user_data)
+fetch_contact_information (EmpathyContactWidget *information,
+        TpConnection *connection)
 {
-  TpConnection *connection = TP_CONNECTION (object);
-  EmpathyContactWidget *information = user_data;
   TpContact *contact;
   TpContactInfoFlags flags;
 
-  if (!tp_proxy_prepare_finish (connection, res, NULL))
+  if (!tp_proxy_has_interface_by_id (connection,
+          TP_IFACE_QUARK_CONNECTION_INTERFACE_CONTACT_INFO))
     {
       gtk_widget_hide (information->vbox_details);
       return;
@@ -846,13 +844,11 @@ contact_widget_details_update (EmpathyContactWidget *information)
 
   if (tp_contact != NULL)
     {
-      GQuark features[] = { TP_CONNECTION_FEATURE_CONTACT_INFO, 0 };
       TpConnection *connection;
 
-      /* First, make sure the CONTACT_INFO feature is ready on the connection */
       connection = tp_contact_get_connection (tp_contact);
-      tp_proxy_prepare_async (connection, features,
-          contact_widget_details_feature_prepared_cb, information);
+
+      fetch_contact_information (information, connection);
     }
 }
 
diff --git a/libempathy/empathy-client-factory.c b/libempathy/empathy-client-factory.c
index 56e1662..200ea5f 100644
--- a/libempathy/empathy-client-factory.c
+++ b/libempathy/empathy-client-factory.c
@@ -143,6 +143,9 @@ empathy_client_factory_dup_connection_features (TpSimpleClientFactory *factory,
   feature = TP_CONNECTION_FEATURE_AVATAR_REQUIREMENTS;
   g_array_append_val (features, feature);
 
+  feature = TP_CONNECTION_FEATURE_CONTACT_INFO;
+  g_array_append_val (features, feature);
+
   return features;
 }
 



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