From 059082374fc8d1cda07486e5e3eb9546a1739811 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Mon, 4 May 2009 01:44:24 +0200 Subject: Rework the logic of cancelling transfers Rework the logic of cancelling transfers so that the GCancellable object is not used from an UI frontend, as that would require to duplicate storage for each EmpathyFTHandler in the manager. --- libempathy/empathy-ft-handler.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'libempathy/empathy-ft-handler.c') diff --git a/libempathy/empathy-ft-handler.c b/libempathy/empathy-ft-handler.c index 89fc13399..93232b187 100644 --- a/libempathy/empathy-ft-handler.c +++ b/libempathy/empathy-ft-handler.c @@ -912,15 +912,14 @@ empathy_ft_handler_new_incoming (EmpathyTpFile *tp_file, } void -empathy_ft_handler_start_transfer (EmpathyFTHandler *handler, - GCancellable *cancellable) +empathy_ft_handler_start_transfer (EmpathyFTHandler *handler) { EmpathyFTHandlerPriv *priv; g_return_if_fail (EMPATHY_IS_FT_HANDLER (handler)); priv = GET_PRIV (handler); - priv->cancellable = g_object_ref (cancellable); + priv->cancellable = g_cancellable_new (); if (priv->tpfile == NULL) { @@ -940,6 +939,20 @@ empathy_ft_handler_start_transfer (EmpathyFTHandler *handler, } } +void +empathy_ft_handler_cancel_transfer (EmpathyFTHandler *handler) +{ + EmpathyFTHandlerPriv *priv; + + g_return_if_fail (EMPATHY_IS_FT_HANDLER (handler)); + + priv = GET_PRIV (handler); + + g_return_if_fail (priv->tpfile != NULL); + + empathy_tp_file_cancel (priv->tpfile); +} + void empathy_ft_handler_incoming_set_destination (EmpathyFTHandler *handler, GFile *destination) -- cgit v1.2.3