# HG changeset patch # User masneyb # Date 1159725466 0 # Node ID d6fdfcbdb056c3deb1efc9f5ddda4e1b452eeaa3 # Parent 42a92d671a0dabc9ce5e538f3870df96afa9d442 2006-10-1 Brian Masney * src/gtk/transfer.c src/uicommon/gftpui.c src/uicommon/gftpui.h - added new functions for canceling and skipping file transfers diff -r 42a92d671a0d -r d6fdfcbdb056 ChangeLog --- a/ChangeLog Tue Sep 26 11:48:55 2006 +0000 +++ b/ChangeLog Sun Oct 01 17:57:46 2006 +0000 @@ -1,3 +1,7 @@ +2006-10-1 Brian Masney + * src/gtk/transfer.c src/uicommon/gftpui.c src/uicommon/gftpui.h - added + new functions for canceling and skipping file transfers + 2006-9-26 Brian Masney * lib/rfc959.c (rfc959_end_transfer) - close the data connection before the control connection is closed. (rfc959_put_next_file_chunk) - make @@ -3593,7 +3597,7 @@ * cvsclean - added this script - * *.[ch] - added $Id: ChangeLog,v 1.476 2006/09/26 11:48:54 masneyb Exp $ tags + * *.[ch] - added $Id: ChangeLog,v 1.477 2006/10/01 17:57:45 masneyb Exp $ tags * debian/* - updated files from Debian maintainer diff -r 42a92d671a0d -r d6fdfcbdb056 src/gtk/transfer.c --- a/src/gtk/transfer.c Tue Sep 26 11:48:55 2006 +0000 +++ b/src/gtk/transfer.c Sun Oct 01 17:57:46 2006 +0000 @@ -484,22 +484,7 @@ if (tdata->fromreq->stopable == 0) return; - g_static_mutex_lock (&tdata->structmutex); - if (tdata->started) - { - tdata->cancel = 1; - tdata->fromreq->cancel = 1; - tdata->toreq->cancel = 1; - } - else - tdata->done = 1; - - tdata->fromreq->stopable = 0; - tdata->toreq->stopable = 0; - g_static_mutex_unlock (&tdata->structmutex); - - ftp_log (gftp_logging_misc, NULL, _("Stopping the transfer of %s\n"), - ((gftp_file *) tdata->curfle->data)->file); + gftpui_common_cancel_file_transfer (tdata); } @@ -941,23 +926,10 @@ _("There are no file transfers selected\n")); return; } + node = GTK_CLIST (dlwdw)->selection->data; transdata = gtk_ctree_node_get_row_data (GTK_CTREE (dlwdw), node); - - g_static_mutex_lock (&transdata->transfer->structmutex); - if (transdata->transfer->started) - { - transdata->transfer->cancel = 1; - transdata->transfer->fromreq->cancel = 1; - transdata->transfer->toreq->cancel = 1; - transdata->transfer->skip_file = 0; - } - else - transdata->transfer->done = 1; - g_static_mutex_unlock (&transdata->transfer->structmutex); - - ftp_log (gftp_logging_misc, NULL, _("Stopping the transfer on host %s\n"), - transdata->transfer->fromreq->hostname); + gftpui_common_cancel_file_transfer (transdata->transfer); } @@ -975,30 +947,12 @@ _("There are no file transfers selected\n")); return; } + node = GTK_CLIST (dlwdw)->selection->data; transdata = gtk_ctree_node_get_row_data (GTK_CTREE (dlwdw), node); - g_static_mutex_lock (&transdata->transfer->structmutex); - if (transdata->transfer->curfle != NULL) - { - curfle = transdata->transfer->curfle->data; - if (transdata->transfer->started) - { - transdata->transfer->cancel = 1; - transdata->transfer->fromreq->cancel = 1; - transdata->transfer->toreq->cancel = 1; - transdata->transfer->skip_file = 1; - } - - curfle->transfer_action = GFTP_TRANS_ACTION_SKIP; - file = curfle->file; - } - else - file = NULL; - g_static_mutex_unlock (&transdata->transfer->structmutex); - - ftp_log (gftp_logging_misc, NULL, _("Skipping file %s on host %s\n"), - file, transdata->transfer->fromreq->hostname); + gftpui_common_skip_file_transfer (transdata->transfer, + transdata->transfer->curfle->data); } @@ -1019,39 +973,14 @@ node = GTK_CLIST (dlwdw)->selection->data; transdata = gtk_ctree_node_get_row_data (GTK_CTREE (dlwdw), node); - if (transdata->curfle == NULL || transdata->curfle->data == NULL) return; curfle = transdata->curfle->data; - - if (curfle->transfer_action & GFTP_TRANS_ACTION_SKIP) - return; - - g_static_mutex_lock (&transdata->transfer->structmutex); - - curfle->transfer_action = GFTP_TRANS_ACTION_SKIP; + gftpui_common_skip_file_transfer (transdata->transfer, curfle); - if (transdata->transfer->started && - transdata->curfle == transdata->transfer->curfle) - { - transdata->transfer->cancel = 1; - transdata->transfer->fromreq->cancel = 1; - transdata->transfer->toreq->cancel = 1; - transdata->transfer->skip_file = 1; - } - else if (transdata->curfle != transdata->transfer->curfle && - !curfle->transfer_done) - { - gtk_ctree_node_set_text (GTK_CTREE (dlwdw), curfle->user_data, 1, - _("Skipped")); - transdata->transfer->total_bytes -= curfle->size; - } - - g_static_mutex_unlock (&transdata->transfer->structmutex); - - ftp_log (gftp_logging_misc, NULL, _("Skipping file %s on host %s\n"), - curfle->file, transdata->transfer->fromreq->hostname); + gtk_ctree_node_set_text (GTK_CTREE (dlwdw), curfle->user_data, 1, + _("Skipped")); } diff -r 42a92d671a0d -r d6fdfcbdb056 src/uicommon/gftpui.c --- a/src/uicommon/gftpui.c Tue Sep 26 11:48:55 2006 +0000 +++ b/src/uicommon/gftpui.c Sun Oct 01 17:57:46 2006 +0000 @@ -1341,6 +1341,60 @@ } +void +gftpui_common_skip_file_transfer (gftp_transfer * tdata, gftp_file * curfle) +{ + g_static_mutex_lock (&tdata->structmutex); + + if (tdata->started && !(curfle->transfer_action & GFTP_TRANS_ACTION_SKIP)) + { + curfle->transfer_action = GFTP_TRANS_ACTION_SKIP; + if (tdata->curfle != NULL && curfle == tdata->curfle->data) + { + tdata->cancel = 1; + tdata->fromreq->cancel = 1; + tdata->toreq->cancel = 1; + tdata->skip_file = 1; + } + else if (!curfle->transfer_done) + tdata->total_bytes -= curfle->size; + } + + g_static_mutex_unlock (&tdata->structmutex); + + if (curfle != NULL) + tdata->fromreq->logging_function (gftp_logging_misc, tdata->fromreq, + _("Skipping file %s on host %s\n"), + curfle->file, tdata->toreq->hostname); +} + + +void +gftpui_common_cancel_file_transfer (gftp_transfer * tdata) +{ + g_static_mutex_lock (&tdata->structmutex); + + if (tdata->started) + { + tdata->cancel = 1; + tdata->fromreq->cancel = 1; + tdata->toreq->cancel = 1; + tdata->skip_file = 0; + } + else + tdata->done = 1; + + tdata->fromreq->stopable = 0; + tdata->toreq->stopable = 0; + + g_static_mutex_unlock (&tdata->structmutex); + + tdata->fromreq->logging_function (gftp_logging_misc, tdata->fromreq, + _("Stopping the transfer on host %s\n"), + tdata->toreq->hostname); +} + + int gftpui_common_transfer_files (gftp_transfer * tdata) { diff -r 42a92d671a0d -r d6fdfcbdb056 src/uicommon/gftpui.h --- a/src/uicommon/gftpui.h Tue Sep 26 11:48:55 2006 +0000 +++ b/src/uicommon/gftpui.h Sun Oct 01 17:57:46 2006 +0000 @@ -133,6 +133,11 @@ void *touidata, GList * files ); +void gftpui_common_skip_file_transfer ( gftp_transfer * tdata, + gftp_file * curfle ); + +void gftpui_common_cancel_file_transfer ( gftp_transfer * tdata ); + int gftpui_common_transfer_files ( gftp_transfer * tdata ); /* gftpuicallback.c */