comparison src/uicommon/gftpui.c @ 819:d6fdfcbdb056

2006-10-1 Brian Masney <masneyb@gftp.org> * src/gtk/transfer.c src/uicommon/gftpui.c src/uicommon/gftpui.h - added new functions for canceling and skipping file transfers
author masneyb
date Sun, 01 Oct 2006 17:57:46 +0000
parents 789ff8cb3170
children 435b11d2d628
comparison
equal deleted inserted replaced
818:42a92d671a0d 819:d6fdfcbdb056
1339 1339
1340 return ((int) num_read); 1340 return ((int) num_read);
1341 } 1341 }
1342 1342
1343 1343
1344 void
1345 gftpui_common_skip_file_transfer (gftp_transfer * tdata, gftp_file * curfle)
1346 {
1347 g_static_mutex_lock (&tdata->structmutex);
1348
1349 if (tdata->started && !(curfle->transfer_action & GFTP_TRANS_ACTION_SKIP))
1350 {
1351 curfle->transfer_action = GFTP_TRANS_ACTION_SKIP;
1352 if (tdata->curfle != NULL && curfle == tdata->curfle->data)
1353 {
1354 tdata->cancel = 1;
1355 tdata->fromreq->cancel = 1;
1356 tdata->toreq->cancel = 1;
1357 tdata->skip_file = 1;
1358 }
1359 else if (!curfle->transfer_done)
1360 tdata->total_bytes -= curfle->size;
1361 }
1362
1363 g_static_mutex_unlock (&tdata->structmutex);
1364
1365 if (curfle != NULL)
1366 tdata->fromreq->logging_function (gftp_logging_misc, tdata->fromreq,
1367 _("Skipping file %s on host %s\n"),
1368 curfle->file, tdata->toreq->hostname);
1369 }
1370
1371
1372 void
1373 gftpui_common_cancel_file_transfer (gftp_transfer * tdata)
1374 {
1375 g_static_mutex_lock (&tdata->structmutex);
1376
1377 if (tdata->started)
1378 {
1379 tdata->cancel = 1;
1380 tdata->fromreq->cancel = 1;
1381 tdata->toreq->cancel = 1;
1382 tdata->skip_file = 0;
1383 }
1384 else
1385 tdata->done = 1;
1386
1387 tdata->fromreq->stopable = 0;
1388 tdata->toreq->stopable = 0;
1389
1390 g_static_mutex_unlock (&tdata->structmutex);
1391
1392 tdata->fromreq->logging_function (gftp_logging_misc, tdata->fromreq,
1393 _("Stopping the transfer on host %s\n"),
1394 tdata->toreq->hostname);
1395 }
1396
1397
1344 int 1398 int
1345 gftpui_common_transfer_files (gftp_transfer * tdata) 1399 gftpui_common_transfer_files (gftp_transfer * tdata)
1346 { 1400 {
1347 intptr_t preserve_permissions, preserve_time; 1401 intptr_t preserve_permissions, preserve_time;
1348 gftp_file * curfle; 1402 gftp_file * curfle;