From 09ac300a093ffe494cbea40bd5c3e2bca74aee4f Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Mon, 7 May 2012 13:56:40 +0200 Subject: approve_ft_channel: stop using the contact factory https://bugzilla.gnome.org/show_bug.cgi?id=675597 --- src/empathy-event-manager.c | 57 ++++++++++++++++----------------------------- 1 file changed, 20 insertions(+), 37 deletions(-) (limited to 'src') diff --git a/src/empathy-event-manager.c b/src/empathy-event-manager.c index d281ba21e..0d548ce43 100644 --- a/src/empathy-event-manager.c +++ b/src/empathy-event-manager.c @@ -30,7 +30,6 @@ #include #include -#include #include #include #include @@ -788,36 +787,6 @@ display_invite_room_dialog (EventManagerApproval *approval) g_object_unref (window); } -static void -event_manager_ft_got_contact_cb (TpConnection *connection, - EmpathyContact *contact, - const GError *error, - gpointer user_data, - GObject *object) -{ - EventManagerApproval *approval = (EventManagerApproval *) user_data; - GtkWidget *window = empathy_roster_window_dup (); - char *header; - EmpathyEventManagerPriv *priv = GET_PRIV (approval->manager); - - approval->contact = g_object_ref (contact); - - header = g_strdup_printf (_("Incoming file transfer from %s"), - empathy_contact_get_alias (approval->contact)); - - event_manager_add (approval->manager, NULL, - approval->contact, EMPATHY_EVENT_TYPE_TRANSFER, - EMPATHY_IMAGE_DOCUMENT_SEND, header, NULL, - approval, event_channel_process_func, NULL); - - /* FIXME better sound for incoming file transfers ?*/ - empathy_sound_manager_play (priv->sound_mgr, window, - EMPATHY_SOUND_CONVERSATION_NEW); - - g_free (header); - g_object_unref (window); -} - static void event_manager_auth_process_func (EventPriv *event) { @@ -978,18 +947,32 @@ approve_ft_channel (EmpathyEventManager *self, TpAddDispatchOperationContext *context, TpFileTransferChannel *ft) { - TpHandle handle; TpChannel *channel = TP_CHANNEL (ft); - TpConnection *connection = tp_channel_borrow_connection (channel); + EmpathyEventManagerPriv *priv = GET_PRIV (approval->manager); + GtkWidget *window; + gchar *header; approval->handler_instance = g_object_ref (ft); + approval_set_target_contact (approval, channel); + + tp_add_dispatch_operation_context_accept (context); - handle = tp_channel_get_handle (channel, NULL); + window = empathy_roster_window_dup (); - empathy_tp_contact_factory_get_from_handle (connection, handle, - event_manager_ft_got_contact_cb, approval, NULL, G_OBJECT (self)); + header = g_strdup_printf (_("Incoming file transfer from %s"), + empathy_contact_get_alias (approval->contact)); - tp_add_dispatch_operation_context_accept (context); + event_manager_add (approval->manager, NULL, + approval->contact, EMPATHY_EVENT_TYPE_TRANSFER, + EMPATHY_IMAGE_DOCUMENT_SEND, header, NULL, + approval, event_channel_process_func, NULL); + + /* FIXME better sound for incoming file transfers ?*/ + empathy_sound_manager_play (priv->sound_mgr, window, + EMPATHY_SOUND_CONVERSATION_NEW); + + g_free (header); + g_object_unref (window); } static void -- cgit v1.2.3