From 571ae9622f8e9bfda7cc248c82c288c2164832fd Mon Sep 17 00:00:00 2001 From: Jonny Lamb Date: Fri, 21 Nov 2008 16:16:22 +0000 Subject: Added a proper Empathy event for an incoming file transfer so that the status icon flashes. (Jonny Lamb) Signed-off-by: Jonny Lamb svn path=/trunk/; revision=1777 --- src/empathy-event-manager.c | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/empathy-event-manager.c b/src/empathy-event-manager.c index 3d4ec5e99..75096b4a2 100644 --- a/src/empathy-event-manager.c +++ b/src/empathy-event-manager.c @@ -177,6 +177,17 @@ event_manager_chat_message_received_cb (EmpathyTpChat *tp_chat, g_free (msg); } +static void +event_channel_file_process_func (EventPriv *event) +{ + EmpathyFTManager *manager; + EmpathyTpFile *tp_file = (EmpathyTpFile *) event->user_data; + + manager = empathy_ft_manager_get_default (); + empathy_ft_manager_add_tp_file (manager, tp_file); + event_remove (event); +} + static void event_manager_filter_channel_cb (EmpathyDispatcher *dispatcher, TpChannel *channel, @@ -227,17 +238,29 @@ event_manager_filter_channel_cb (EmpathyDispatcher *dispatcher, NULL); /* Only deal with incoming channels */ - if (g_value_get_uint (direction) == EMP_FILE_TRANSFER_DIRECTION_INCOMING) { - EmpathyFTManager *manager; - McAccount *account; - EmpathyTpFile *tp_file; + if (g_value_get_uint (direction) == + EMP_FILE_TRANSFER_DIRECTION_INCOMING) { + EmpathyContact *contact; + gchar *msg; + McAccount *account; + EmpathyTpFile *tp_file; - manager = empathy_ft_manager_get_default (); account = empathy_channel_get_account (channel); - tp_file = empathy_tp_file_new (account, channel); - empathy_ft_manager_add_tp_file (manager, tp_file); + contact = empathy_tp_file_get_contact (tp_file); + + msg = g_strdup_printf (_("Incoming file transfer from %s"), + empathy_contact_get_name (contact)); + + event_manager_add (manager, contact, + EMPATHY_IMAGE_DOCUMENT_SEND, + msg, + channel, + event_channel_file_process_func, + tp_file); + + g_free (msg); } g_value_unset (direction); -- cgit v1.2.3