diff options
author | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2008-11-22 00:20:12 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2008-11-22 00:20:12 +0800 |
commit | 85ed795c100c111a32c2e2a017977747713329ee (patch) | |
tree | a0b06aaf012bfd3bffc177e9a93a87ec77e41913 | |
parent | 1bfcaed673317c3ea7e34903ad224e28a7a6a5ed (diff) | |
download | gsoc2013-empathy-85ed795c100c111a32c2e2a017977747713329ee.tar gsoc2013-empathy-85ed795c100c111a32c2e2a017977747713329ee.tar.gz gsoc2013-empathy-85ed795c100c111a32c2e2a017977747713329ee.tar.bz2 gsoc2013-empathy-85ed795c100c111a32c2e2a017977747713329ee.tar.lz gsoc2013-empathy-85ed795c100c111a32c2e2a017977747713329ee.tar.xz gsoc2013-empathy-85ed795c100c111a32c2e2a017977747713329ee.tar.zst gsoc2013-empathy-85ed795c100c111a32c2e2a017977747713329ee.zip |
Added a wait for file channels so outgoing transfers are only added to the manager when they are remote pending.
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
svn path=/trunk/; revision=1838
-rw-r--r-- | src/empathy.c | 57 |
1 files changed, 50 insertions, 7 deletions
diff --git a/src/empathy.c b/src/empathy.c index 56da3c7c4..bc89d451e 100644 --- a/src/empathy.c +++ b/src/empathy.c @@ -61,6 +61,52 @@ static BaconMessageConnection *connection = NULL; static void +file_channel_add_to_file_manager (TpChannel *channel) +{ + EmpathyTpFile *tp_file; + EmpathyFTManager *ft_manager; + + ft_manager = empathy_ft_manager_get_default (); + tp_file = empathy_tp_file_new (channel); + empathy_ft_manager_add_tp_file (ft_manager, tp_file); + + g_object_unref (channel); +} + +static void +file_channel_state_changed_cb (TpProxy *proxy, + guint state, + guint reason, + gpointer user_data, + GObject *weak_object) +{ + /* Only deal with the channel being offered */ + if (state == EMP_FILE_TRANSFER_STATE_REMOTE_PENDING) { + file_channel_add_to_file_manager (TP_CHANNEL (proxy)); + } +} + +static void +file_channel_get_state_cb (TpProxy *proxy, + const GValue *state_value, + const GError *error, + gpointer user_data, + GObject *weak_object) +{ + EmpFileTransferState state; + state = g_value_get_uint (state_value); + + if (state == EMP_FILE_TRANSFER_STATE_REMOTE_PENDING + || state == EMP_FILE_TRANSFER_STATE_LOCAL_PENDING) { + file_channel_add_to_file_manager (TP_CHANNEL (proxy)); + return; + } + + emp_cli_channel_type_file_connect_to_file_transfer_state_changed ( + proxy, file_channel_state_changed_cb, NULL, NULL, NULL, NULL); +} + +static void dispatch_channel_cb (EmpathyDispatcher *dispatcher, TpChannel *channel, gpointer user_data) @@ -106,13 +152,10 @@ dispatch_channel_cb (EmpathyDispatcher *dispatcher, empathy_call_window_new (channel); } else if (!tp_strdiff (channel_type, EMP_IFACE_CHANNEL_TYPE_FILE)) { - EmpathyTpFile *tp_file; - EmpathyFTManager *ft_manager; - - ft_manager = empathy_ft_manager_get_default (); - tp_file = empathy_tp_file_new (channel); - - empathy_ft_manager_add_tp_file (ft_manager, tp_file); + tp_cli_dbus_properties_call_get (g_object_ref (channel), -1, + EMP_IFACE_CHANNEL_TYPE_FILE, + "State", file_channel_get_state_cb, + NULL, NULL, NULL); } g_free (channel_type); |