aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy-event-manager.c
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2009-05-06 03:19:38 +0800
committerCosimo Cecchi <cosimoc@gnome.org>2009-06-01 23:47:40 +0800
commit9d33f23f7615d118c685c5e6352492a4ee7703f6 (patch)
tree7fc2414a1c55815fce8f0d819548c6364e0491c0 /src/empathy-event-manager.c
parent3d6b55954ec8fe6fd037f78f3114bdf6f6952e1a (diff)
downloadgsoc2013-empathy-9d33f23f7615d118c685c5e6352492a4ee7703f6.tar
gsoc2013-empathy-9d33f23f7615d118c685c5e6352492a4ee7703f6.tar.gz
gsoc2013-empathy-9d33f23f7615d118c685c5e6352492a4ee7703f6.tar.bz2
gsoc2013-empathy-9d33f23f7615d118c685c5e6352492a4ee7703f6.tar.lz
gsoc2013-empathy-9d33f23f7615d118c685c5e6352492a4ee7703f6.tar.xz
gsoc2013-empathy-9d33f23f7615d118c685c5e6352492a4ee7703f6.tar.zst
gsoc2013-empathy-9d33f23f7615d118c685c5e6352492a4ee7703f6.zip
Cleanup after rebase v2
Diffstat (limited to 'src/empathy-event-manager.c')
-rw-r--r--src/empathy-event-manager.c51
1 files changed, 36 insertions, 15 deletions
diff --git a/src/empathy-event-manager.c b/src/empathy-event-manager.c
index bd31b193e..c8749bc46 100644
--- a/src/empathy-event-manager.c
+++ b/src/empathy-event-manager.c
@@ -752,6 +752,32 @@ event_manager_muc_invite_got_contact_cb (EmpathyTpContactFactory *factory,
}
static void
+event_manager_ft_got_contact_cb (EmpathyTpContactFactory *factory,
+ EmpathyContact *contact,
+ const GError *error,
+ gpointer user_data,
+ GObject *object)
+{
+ EventManagerApproval *approval = (EventManagerApproval *) user_data;
+ char *header;
+
+ approval->contact = contact;
+
+ header = g_strdup_printf (_("Incoming file transfer from %s"),
+ empathy_contact_get_name (approval->contact));
+
+ event_manager_add (approval->manager, approval->contact,
+ EMPATHY_IMAGE_DOCUMENT_SEND, header, NULL, approval,
+ event_channel_process_func, NULL);
+
+ /* FIXME better sound for incoming file transfers ?*/
+ empathy_sound_play (empathy_main_window_get (),
+ EMPATHY_SOUND_CONVERSATION_NEW);
+
+ g_free (header);
+}
+
+static void
event_manager_approve_channel_cb (EmpathyDispatcher *dispatcher,
EmpathyDispatchOperation *operation, EmpathyEventManager *manager)
{
@@ -839,23 +865,18 @@ event_manager_approve_channel_cb (EmpathyDispatcher *dispatcher,
}
else if (!tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER))
{
- EmpathyTpFile *file;
- gchar *header;
-
- file = EMPATHY_TP_FILE (empathy_dispatch_operation_get_channel_wrapper (operation));
- approval->contact = g_object_ref (empathy_tp_file_get_contact (file));
-
- header = g_strdup_printf (_("Incoming file transfer from %s"),
- empathy_contact_get_name (approval->contact));
-
- event_manager_add (manager, approval->contact, EMPATHY_IMAGE_DOCUMENT_SEND,
- header, NULL, approval, event_channel_process_func, NULL);
+ TpChannel *channel;
+ TpConnection *connection;
+ TpHandle handle;
+ EmpathyTpContactFactory *factory;
- /* FIXME better sound for incoming file transfers ?*/
- empathy_sound_play (empathy_main_window_get (),
- EMPATHY_SOUND_CONVERSATION_NEW);
+ channel = empathy_dispatch_operation_get_channel (operation);
+ handle = tp_channel_get_handle (channel, NULL);
- g_free (header);
+ connection = tp_channel_borrow_connection (channel);
+ factory = empathy_tp_contact_factory_dup_singleton (connection);
+ empathy_tp_contact_factory_get_from_handle (factory, handle,
+ event_manager_ft_got_contact_cb, approval, NULL, G_OBJECT (manager));
}
else if (!tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_STREAM_TUBE) ||
!tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_DBUS_TUBE))