[empathy] contact-widget: use empathy_client_factory_dup_contact_by_id_async()
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] contact-widget: use empathy_client_factory_dup_contact_by_id_async()
- Date: Tue, 15 May 2012 11:24:35 +0000 (UTC)
commit 4180f9c6cb1cb97e22e8c5ca54ba1c04111f6198
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Thu May 10 12:25:21 2012 +0200
contact-widget: use empathy_client_factory_dup_contact_by_id_async()
https://bugzilla.gnome.org/show_bug.cgi?id=675597
libempathy-gtk/empathy-contact-widget.c | 35 +++++++++++++++++++++---------
1 files changed, 24 insertions(+), 11 deletions(-)
---
diff --git a/libempathy-gtk/empathy-contact-widget.c b/libempathy-gtk/empathy-contact-widget.c
index 22e4085..5a3658c 100644
--- a/libempathy-gtk/empathy-contact-widget.c
+++ b/libempathy-gtk/empathy-contact-widget.c
@@ -36,10 +36,10 @@
#include <telepathy-glib/util.h>
#include <telepathy-glib/interfaces.h>
-#include <libempathy/empathy-tp-contact-factory.h>
#include <libempathy/empathy-location.h>
#include <libempathy/empathy-time.h>
#include <libempathy/empathy-utils.h>
+#include <libempathy/empathy-client-factory.h>
#include "empathy-calendar-button.h"
#include "empathy-contact-widget.h"
@@ -1492,21 +1492,29 @@ contact_widget_set_contact (EmpathyContactWidget *self,
}
static void
-contact_widget_got_contact_cb (TpConnection *connection,
- EmpathyContact *contact,
- const GError *error,
- gpointer user_data,
- GObject *weak_object)
+contact_widget_got_contact_cb (GObject *source,
+ GAsyncResult *result,
+ gpointer user_data)
{
EmpathyContactWidget *self = user_data;
+ GError *error = NULL;
+ EmpathyContact *contact;
+
+ contact = empathy_client_factory_dup_contact_by_id_finish (
+ EMPATHY_CLIENT_FACTORY (source), result, &error);
- if (error != NULL)
+ if (contact == NULL)
{
DEBUG ("Error: %s", error->message);
- return;
+ g_error_free (error);
+ goto out;
}
contact_widget_set_contact (self, contact);
+
+ g_object_unref (contact);
+out:
+ g_object_unref (self);
}
static void
@@ -1526,9 +1534,14 @@ contact_widget_change_contact (EmpathyContactWidget *self)
id = gtk_entry_get_text (GTK_ENTRY (self->priv->widget_id));
if (!EMP_STR_EMPTY (id))
{
- empathy_tp_contact_factory_get_from_id (connection, id,
- contact_widget_got_contact_cb, self, NULL,
- G_OBJECT (self));
+ EmpathyClientFactory *factory;
+
+ factory = empathy_client_factory_dup ();
+
+ empathy_client_factory_dup_contact_by_id_async (factory, connection,
+ id, contact_widget_got_contact_cb, g_object_ref (self));
+
+ g_object_unref (factory);
}
}
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]