diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2009-05-13 23:35:49 +0800 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2009-06-01 23:49:56 +0800 |
commit | 11bce5d5883782e2af15bd06a7a10b507b8bbef1 (patch) | |
tree | 8277e53098cca10cc9e7ac968a6a77941e88ccb8 | |
parent | cecbf767e3364d3342aef9b73206d4e29c692953 (diff) | |
download | gsoc2013-empathy-11bce5d5883782e2af15bd06a7a10b507b8bbef1.tar gsoc2013-empathy-11bce5d5883782e2af15bd06a7a10b507b8bbef1.tar.gz gsoc2013-empathy-11bce5d5883782e2af15bd06a7a10b507b8bbef1.tar.bz2 gsoc2013-empathy-11bce5d5883782e2af15bd06a7a10b507b8bbef1.tar.lz gsoc2013-empathy-11bce5d5883782e2af15bd06a7a10b507b8bbef1.tar.xz gsoc2013-empathy-11bce5d5883782e2af15bd06a7a10b507b8bbef1.tar.zst gsoc2013-empathy-11bce5d5883782e2af15bd06a7a10b507b8bbef1.zip |
Adapt the manager code
Adapt the manager code to react to the new possible hashing.
-rw-r--r-- | src/empathy-ft-manager.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/src/empathy-ft-manager.c b/src/empathy-ft-manager.c index 40a1d7b6c..53bd7be97 100644 --- a/src/empathy-ft-manager.c +++ b/src/empathy-ft-manager.c @@ -98,6 +98,9 @@ G_DEFINE_TYPE (EmpathyFTManager, empathy_ft_manager, G_TYPE_OBJECT); static EmpathyFTManager *manager_singleton = NULL; +static void ft_handler_hashing_started_cb (EmpathyFTHandler *handler, + EmpathyFTManager *manager); + static gchar * ft_manager_format_interval (guint interval) { @@ -482,6 +485,11 @@ ft_handler_transfer_done_cb (EmpathyFTHandler *handler, g_free (message); g_free (first_line); g_free (second_line); + + if (empathy_ft_handler_is_incoming (handler) && + empathy_ft_handler_get_use_hash (handler)) + g_signal_connect (handler, "hashing-started", + G_CALLBACK (ft_handler_hashing_started_cb), manager); } static void @@ -560,8 +568,9 @@ ft_handler_hashing_done_cb (EmpathyFTHandler *handler, g_free (first_line); g_free (second_line); - g_signal_connect (handler, "transfer-started", - G_CALLBACK (ft_handler_transfer_started_cb), manager); + if (!empathy_ft_handler_is_incoming (handler)) + g_signal_connect (handler, "transfer-started", + G_CALLBACK (ft_handler_transfer_started_cb), manager); } static void @@ -618,24 +627,26 @@ ft_manager_start_transfer (EmpathyFTManager *manager, EmpathyFTHandler *handler) { EmpathyFTManagerPriv *priv; - gboolean is_incoming; + gboolean is_outgoing; priv = GET_PRIV (manager); - is_incoming = empathy_ft_handler_is_incoming (handler); + is_outgoing = !empathy_ft_handler_is_incoming (handler); - DEBUG ("Start transfer, is incoming %d", is_incoming); + DEBUG ("Start transfer, is outgoing %s", + is_outgoing ? "True" : "False"); /* now connect the signals */ g_signal_connect (handler, "transfer-error", G_CALLBACK (ft_handler_transfer_error_cb), manager); - if (is_incoming) { - g_signal_connect (handler, "transfer-started", - G_CALLBACK (ft_handler_transfer_started_cb), manager); - } else { + if (is_outgoing && empathy_ft_handler_get_use_hash (handler)) { g_signal_connect (handler, "hashing-started", G_CALLBACK (ft_handler_hashing_started_cb), manager); + } else { + /* either incoming or outgoing without hash */ + g_signal_connect (handler, "transfer-started", + G_CALLBACK (ft_handler_transfer_started_cb), manager); } empathy_ft_handler_start_transfer (handler); |