diff options
author | Cosimo Cecchi <cosimo.cecchi@collabora.co.uk> | 2009-05-04 09:05:24 +0800 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2009-06-01 23:47:38 +0800 |
commit | 34ca5111a0a540b4b756f02592686668e80e538d (patch) | |
tree | 7335d063a20a9f85e593d5e2b3f3fc932fdab033 /libempathy | |
parent | 7cdb829025611c98473e11ea2512f5f8c0bf3c75 (diff) | |
download | gsoc2013-empathy-34ca5111a0a540b4b756f02592686668e80e538d.tar gsoc2013-empathy-34ca5111a0a540b4b756f02592686668e80e538d.tar.gz gsoc2013-empathy-34ca5111a0a540b4b756f02592686668e80e538d.tar.bz2 gsoc2013-empathy-34ca5111a0a540b4b756f02592686668e80e538d.tar.lz gsoc2013-empathy-34ca5111a0a540b4b756f02592686668e80e538d.tar.xz gsoc2013-empathy-34ca5111a0a540b4b756f02592686668e80e538d.tar.zst gsoc2013-empathy-34ca5111a0a540b4b756f02592686668e80e538d.zip |
Properly emit the TRANSFER_STARTED signal
Emit the TRANSFER_STARTED signal when actually starting the transfer
(after the DBus invocation callback).
Diffstat (limited to 'libempathy')
-rw-r--r-- | libempathy/empathy-ft-handler.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/libempathy/empathy-ft-handler.c b/libempathy/empathy-ft-handler.c index d7a65aaa7..ad497de47 100644 --- a/libempathy/empathy-ft-handler.c +++ b/libempathy/empathy-ft-handler.c @@ -192,6 +192,8 @@ do_finalize (GObject *object) { EmpathyFTHandlerPriv *priv = GET_PRIV (object); + DEBUG ("%p", object); + g_free (priv->content_type); priv->content_type = NULL; @@ -371,6 +373,8 @@ ft_transfer_operation_callback (EmpathyTpFile *tp_file, { priv->is_completed = TRUE; g_signal_emit (handler, signals[TRANSFER_DONE], 0, tp_file); + + empathy_tp_file_close (tp_file); } } @@ -382,6 +386,11 @@ ft_transfer_progress_callback (EmpathyTpFile *tp_file, EmpathyFTHandler *handler = user_data; EmpathyFTHandlerPriv *priv = GET_PRIV (handler); + if (transferred_bytes == 0) { + g_signal_emit (handler, signals[TRANSFER_STARTED], 0, tp_file); + } + + if (priv->transferred_bytes != transferred_bytes) { priv->transferred_bytes = transferred_bytes; @@ -419,8 +428,6 @@ ft_handler_create_channel_cb (EmpathyDispatchOperation *operation, priv->tpfile = g_object_ref (empathy_dispatch_operation_get_channel_wrapper (operation)); - g_signal_emit (handler, signals[TRANSFER_STARTED], 0, priv->tpfile); - empathy_tp_file_offer (priv->tpfile, priv->gfile, priv->cancellable, ft_transfer_progress_callback, handler, ft_transfer_operation_callback, handler); @@ -574,7 +581,6 @@ hash_job_async_close_stream_cb (GObject *source, TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER ".ContentHash", value); cleanup: - hash_data_free (hash_data); if (error != NULL) { @@ -587,6 +593,8 @@ cleanup: /* the request is complete now, push it to the dispatcher */ ft_handler_push_to_dispatcher (handler); } + + hash_data_free (hash_data); } static void @@ -928,11 +936,6 @@ empathy_ft_handler_start_transfer (EmpathyFTHandler *handler) } else { - /* emit the start signal now, so that we can catch errors in the - * op callback. - */ - g_signal_emit (handler, signals[TRANSFER_STARTED], 0, priv->tpfile); - /* TODO: add support for resume. */ empathy_tp_file_accept (priv->tpfile, 0, priv->gfile, priv->cancellable, ft_transfer_progress_callback, handler, |