}
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)
{
}
}
+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)
typedef struct {
GtkTreeModel *model;
GHashTable *ft_handler_to_row_ref;
- GHashTable *cancellable_refs;
/* Widgets */
GtkWidget *window;
GtkTreePath *path = NULL;
GtkTreeIter iter;
gboolean update_selection;
- GCancellable *cancellable;
EmpathyFTManagerPriv *priv = GET_PRIV (manager);
row_ref = ft_manager_get_row_from_handler (manager, handler);
if (update_selection)
gtk_tree_selection_select_iter (selection, &iter);
-
- cancellable = g_hash_table_lookup (priv->cancellable_refs, handler);
-
- if (cancellable != NULL) {
- g_cancellable_cancel (cancellable);
- }
}
static gboolean
char *first_line, *second_line, *message;
gboolean incoming;
GtkTreeRowReference *row_ref;
- EmpathyFTManagerPriv *priv = GET_PRIV (manager);
DEBUG ("Transfer done");
message = g_strdup_printf ("%s\n%s", first_line, second_line);
ft_manager_update_handler_message (manager, row_ref, message);
- /* remove the cancellable object */
- g_hash_table_remove (priv->cancellable_refs, handler);
-
/* update buttons */
ft_manager_update_buttons (manager);
ft_manager_start_transfer (EmpathyFTManager *manager,
EmpathyFTHandler *handler)
{
- GCancellable *cancellable;
EmpathyFTManagerPriv *priv;
gboolean is_incoming;
priv = GET_PRIV (manager);
- cancellable = g_cancellable_new ();
- g_hash_table_insert (priv->cancellable_refs, g_object_ref (handler),
- cancellable);
-
is_incoming = empathy_ft_handler_is_incoming (handler);
DEBUG ("Start transfer, is incoming %d", is_incoming);
G_CALLBACK (ft_handler_hashing_started_cb), manager);
}
- empathy_ft_handler_start_transfer (handler, cancellable);
+ empathy_ft_handler_start_transfer (handler);
}
static void
GtkTreeIter iter;
GtkTreeModel *model;
EmpathyFTHandler *handler;
- GCancellable *cancellable;
EmpathyFTManagerPriv *priv;
priv = GET_PRIV (manager);
empathy_contact_get_name (empathy_ft_handler_get_contact (handler)),
empathy_ft_handler_get_filename (handler));
- cancellable = g_hash_table_lookup (priv->cancellable_refs, handler);
- g_assert (cancellable != NULL);
+ empathy_ft_handler_cancel_transfer (handler);
- g_cancellable_cancel (cancellable);
+ g_object_unref (handler);
}
static gboolean
priv->ft_handler_to_row_ref = g_hash_table_new_full (g_direct_hash,
g_direct_equal, (GDestroyNotify) g_object_unref,
(GDestroyNotify) gtk_tree_row_reference_free);
- priv->cancellable_refs = g_hash_table_new_full (g_direct_hash, g_direct_equal,
- (GDestroyNotify) g_object_unref, (GDestroyNotify) g_object_unref);
ft_manager_build_ui (manager);
}