From 4723b7016072a1cd4f41dfddcf990d97d68def36 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Tue, 8 May 2012 10:37:34 +0200 Subject: [PATCH] call-observer: use tp_channel_get_target_contact() --- src/empathy-call-observer.c | 36 ++++-------------------------------- 1 file changed, 4 insertions(+), 32 deletions(-) diff --git a/src/empathy-call-observer.c b/src/empathy-call-observer.c index 35ceeb04..de21506d 100644 --- a/src/empathy-call-observer.c +++ b/src/empathy-call-observer.c @@ -102,29 +102,16 @@ auto_reject_ctx_free (AutoRejectCtx *ctx) } static void -get_contact_cb (TpConnection *connection, - guint n_contacts, - TpContact * const *contacts, - guint n_failed, - const TpHandle *failed, - const GError *error, - gpointer user_data, - GObject *weak_object) +display_reject_notification (EmpathyCallObserver *self, + TpChannel *channel) { - EmpathyCallObserver *self = (EmpathyCallObserver *) weak_object; - NotifyNotification *notification; TpContact *contact; + NotifyNotification *notification; gchar *summary, *body; EmpathyContact *emp_contact; GdkPixbuf *pixbuf; - if (n_contacts != 1) - { - DEBUG ("Failed to get TpContact; ignoring notification bubble"); - return; - } - - contact = contacts[0]; + contact = tp_channel_get_target_contact (channel); summary = g_strdup_printf (_("Missed call from %s"), tp_contact_get_alias (contact)); @@ -152,21 +139,6 @@ get_contact_cb (TpConnection *connection, g_object_unref (emp_contact); } -static void -display_reject_notification (EmpathyCallObserver *self, - TpChannel *channel) -{ - TpHandle handle; - TpContactFeature features[] = { TP_CONTACT_FEATURE_ALIAS, - TP_CONTACT_FEATURE_AVATAR_DATA }; - - handle = tp_channel_get_handle (channel, NULL); - - tp_connection_get_contacts_by_handle (tp_channel_borrow_connection (channel), - 1, &handle, G_N_ELEMENTS (features), features, get_contact_cb, - g_object_ref (channel), g_object_unref, G_OBJECT (self)); -} - static TpChannel * find_main_channel (GList *channels) { -- 2.39.2