]> git.0d.be Git - empathy.git/commitdiff
Use empathy_contact_call_when_ready instead of _run_ API. Fixes bug #561247 and
authorXavier Claessens <xclaesse@gmail.com>
Sun, 29 Mar 2009 08:25:41 +0000 (08:25 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Sun, 29 Mar 2009 08:25:41 +0000 (08:25 +0000)
From: Xavier Claessens <xclaesse@gmail.com>

svn path=/trunk/; revision=2748

libempathy-gtk/empathy-contact-widget.c

index 07058e4bcbc0e4dd6fdfbf4e6beb1c09a78abe4b..f8ff36731ce41189e9bfb3c3f3a54d0296b644b7 100644 (file)
@@ -42,6 +42,9 @@
 #include "empathy-avatar-image.h"
 #include "empathy-ui-utils.h"
 
 #include "empathy-avatar-image.h"
 #include "empathy-ui-utils.h"
 
+#define DEBUG_FLAG EMPATHY_DEBUG_CONTACT
+#include <libempathy/empathy-debug.h>
+
 /* Delay before updating the widget when the id entry changed (seconds) */
 #define ID_CHANGED_TIMEOUT 1
 
 /* Delay before updating the widget when the id entry changed (seconds) */
 #define ID_CHANGED_TIMEOUT 1
 
@@ -687,6 +690,19 @@ contact_widget_contact_update (EmpathyContactWidget *information)
     }
 }
 
     }
 }
 
+static void
+contact_widget_change_contact_cb (EmpathyContact *contact,
+                                  const GError *error,
+                                  gpointer information,
+                                  GObject *weak_object)
+{
+  if (error)
+    DEBUG ("Error: %s", error->message);
+  else
+    contact_widget_set_contact (information, contact);
+  g_object_unref (contact);
+}
+
 static void
 contact_widget_change_contact (EmpathyContactWidget *information)
 {
 static void
 contact_widget_change_contact (EmpathyContactWidget *information)
 {
@@ -717,12 +733,13 @@ contact_widget_change_contact (EmpathyContactWidget *information)
 
   if (contact)
     {
 
   if (contact)
     {
-      empathy_contact_run_until_ready (contact,
+      /* Give the contact ref to the callback */
+      empathy_contact_call_when_ready (contact,
           EMPATHY_CONTACT_READY_HANDLE |
           EMPATHY_CONTACT_READY_ID,
           EMPATHY_CONTACT_READY_HANDLE |
           EMPATHY_CONTACT_READY_ID,
-          NULL);
-      contact_widget_set_contact (information, contact);
-      g_object_unref (contact);
+          contact_widget_change_contact_cb,
+          information, NULL,
+          G_OBJECT (information->vbox_contact_widget));
     }
 }
 
     }
 }