Mercurial > gftp.yaz
diff src/gtk/transfer.c @ 876:2d4e6fca8e7c
2007-2-6 Brian Masney <masneyb@gftp.org>
* src/text/textui.c src/gtk/gtkui_transfer.c src/uicommon/gftpui.h -
added new function: gftpui_cancel_file_transfer()
* src/uicommon/gftpui.c - use gftpui_cancel_file_transfer() to cancel
the file transfers
* lib/gftp.h lib/misc.c src/gtk/transfer.c - added pointer for the
thread_id of the transfer to the gftp_transfer structure. This will be
used in the GTK+ port so that the transfer can be stopped.
author | masneyb |
---|---|
date | Wed, 07 Feb 2007 02:43:57 +0000 |
parents | 1fae947d4418 |
children | 1808cebed602 |
line wrap: on
line diff
--- a/src/gtk/transfer.c Wed Feb 07 01:56:20 2007 +0000 +++ b/src/gtk/transfer.c Wed Feb 07 02:43:57 2007 +0000 @@ -686,33 +686,35 @@ static void create_transfer (gftp_transfer * tdata) { - pthread_t tid; + if (tdata->fromreq->stopable) + return; - if (!tdata->fromreq->stopable) + if (GFTP_IS_SAME_HOST_START_TRANS ((gftp_window_data *) tdata->fromwdata, + tdata->fromreq)) { - if (GFTP_IS_SAME_HOST_START_TRANS ((gftp_window_data *) tdata->fromwdata, - tdata->fromreq)) - { - gftp_swap_socks (tdata->fromreq, - ((gftp_window_data *) tdata->fromwdata)->request); - update_window (tdata->fromwdata); - } + gftp_swap_socks (tdata->fromreq, + ((gftp_window_data *) tdata->fromwdata)->request); + update_window (tdata->fromwdata); + } - if (GFTP_IS_SAME_HOST_START_TRANS ((gftp_window_data *) tdata->towdata, - tdata->toreq)) - { - gftp_swap_socks (tdata->toreq, - ((gftp_window_data *) tdata->towdata)->request); - update_window (tdata->towdata); - } + if (GFTP_IS_SAME_HOST_START_TRANS ((gftp_window_data *) tdata->towdata, + tdata->toreq)) + { + gftp_swap_socks (tdata->toreq, + ((gftp_window_data *) tdata->towdata)->request); + update_window (tdata->towdata); + } - num_transfers_in_progress++; - tdata->started = 1; - tdata->stalled = 1; - gtk_ctree_node_set_text (GTK_CTREE (dlwdw), tdata->user_data, 1, - _("Connecting...")); - pthread_create (&tid, NULL, _gftpui_transfer_files, tdata); - } + num_transfers_in_progress++; + tdata->started = 1; + tdata->stalled = 1; + gtk_ctree_node_set_text (GTK_CTREE (dlwdw), tdata->user_data, 1, + _("Connecting...")); + + if (tdata->thread_id == NULL) + tdata->thread_id = g_malloc0 (sizeof (pthread_t)); + + pthread_create (tdata->thread_id, NULL, _gftpui_transfer_files, tdata); }