Mercurial > gftp.yaz
changeset 305:6d180e6a8ba5
2003-11-3 Brian Masney <masneyb@gftp.org>
* lib/gftp.h src/gtk/transfer.c src/gtk/delete_dialog.c - removed
transfer_direction variable from gftp_transfer structure. Cleaned
up the code that did checks based on the value of this variable.
* lib/rfc959.c (rfc959_syst) - added a check for Novell FTP servers
* src/gtk/transfer.c (add_file_transfer) - check the value of the option
one_transfer and if that is disabled, do not append the file transfers.
(transfer_done) - refresh the destination window correctly after a
transfer is completed.
author | masneyb |
---|---|
date | Tue, 04 Nov 2003 02:53:17 +0000 |
parents | 95bcb77d62c1 |
children | 8978792d0855 |
files | ChangeLog lib/gftp.h lib/rfc959.c src/gtk/delete_dialog.c src/gtk/transfer.c |
diffstat | 5 files changed, 70 insertions(+), 78 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Mon Nov 03 02:35:18 2003 +0000 +++ b/ChangeLog Tue Nov 04 02:53:17 2003 +0000 @@ -1,3 +1,15 @@ +2003-11-3 Brian Masney <masneyb@gftp.org> + * lib/gftp.h src/gtk/transfer.c src/gtk/delete_dialog.c - removed + transfer_direction variable from gftp_transfer structure. Cleaned + up the code that did checks based on the value of this variable. + + * lib/rfc959.c (rfc959_syst) - added a check for Novell FTP servers + + * src/gtk/transfer.c (add_file_transfer) - check the value of the option + one_transfer and if that is disabled, do not append the file transfers. + (transfer_done) - refresh the destination window correctly after a + transfer is completed. + 2003-11-2 Brian Masney <masneyb@gftp.org> * lib/rfc2068.c (rfc2068_get_file) - if there is any data in the current read buffer, grab that data first. Otherwise, read from the socket. @@ -1675,7 +1687,7 @@ * cvsclean - added this script - * *.[ch] - added $Id: ChangeLog,v 1.165 2003/11/03 02:35:18 masneyb Exp $ tags + * *.[ch] - added $Id: ChangeLog,v 1.166 2003/11/04 02:53:16 masneyb Exp $ tags * debian/* - updated files from Debian maintainer
--- a/lib/gftp.h Mon Nov 03 02:35:18 2003 +0000 +++ b/lib/gftp.h Tue Nov 04 02:53:17 2003 +0000 @@ -163,9 +163,6 @@ #define GFTP_TRANS_ACTION_RESUME 2 #define GFTP_TRANS_ACTION_SKIP 3 -#define GFTP_DIRECTION_DOWNLOAD 0 -#define GFTP_DIRECTION_UPLOAD 1 - #define GFTP_SORT_COL_FILE 1 #define GFTP_SORT_COL_SIZE 2 #define GFTP_SORT_COL_USER 3 @@ -438,8 +435,7 @@ gftp_request * fromreq, * toreq; - unsigned int transfer_direction : 1, /* FIXME - take out */ - cancel : 1, + unsigned int cancel : 1, ready : 1, started : 1, done : 1,
--- a/lib/rfc959.c Mon Nov 03 02:35:18 2003 +0000 +++ b/lib/rfc959.c Tue Nov 04 02:53:17 2003 +0000 @@ -420,6 +420,8 @@ request->server_type = GFTP_DIRTYPE_UNIX; else if (strcmp (stpos, "VMS") == 0) request->server_type = GFTP_DIRTYPE_VMS; + else if (strcmp (stpos, "NETWARE") == 0) + request->server_type = GFTP_DIRTYPE_NOVELL; else if (strcmp (stpos, "CRAY") == 0) request->server_type = GFTP_DIRTYPE_CRAY; else
--- a/src/gtk/delete_dialog.c Mon Nov 03 02:35:18 2003 +0000 +++ b/src/gtk/delete_dialog.c Tue Nov 04 02:53:17 2003 +0000 @@ -179,7 +179,6 @@ transfer = g_malloc0 (sizeof (*transfer)); transfer->fromreq = copy_request (wdata->request, 0); transfer->fromwdata = wdata; - transfer->transfer_direction = GFTP_DIRECTION_DOWNLOAD; num = 0; templist = GTK_CLIST (wdata->listbox)->selection;
--- a/src/gtk/transfer.c Mon Nov 03 02:35:18 2003 +0000 +++ b/src/gtk/transfer.c Tue Nov 04 02:53:17 2003 +0000 @@ -432,8 +432,6 @@ transfer = g_malloc0 (sizeof (*transfer)); transfer->fromreq = copy_request (fromwdata->request, 0); transfer->toreq = copy_request (towdata->request, 0); - transfer->transfer_direction = fromwdata == &window2 ? - GFTP_DIRECTION_DOWNLOAD : GFTP_DIRECTION_UPLOAD; transfer->fromwdata = fromwdata; transfer->towdata = towdata; @@ -549,6 +547,36 @@ } +static void +_gftp_setup_fds (gftp_transfer * tdata, gftp_file * curfle, + int *fromfd, int *tofd) +{ + *tofd = -1; + *fromfd = -1; + + if (curfle->is_fd) + { + if (tdata->toreq->protonum == GFTP_LOCAL_NUM) + *tofd = curfle->fd; + else if (tdata->fromreq->protonum == GFTP_LOCAL_NUM) + *fromfd = curfle->fd; + } +} + + +static void +_gftp_done_with_fds (gftp_transfer * tdata, gftp_file * curfle) +{ + if (curfle->is_fd) + { + if (tdata->toreq->protonum == GFTP_LOCAL_NUM) + tdata->toreq->datafd = -1; + else + tdata->fromreq->datafd = -1; + } +} + + void * gftp_gtk_transfer_files (void *data) { @@ -606,24 +634,7 @@ continue; } - if (curfle->is_fd) - { - if (transfer->transfer_direction == GFTP_DIRECTION_DOWNLOAD) - { - tofd = curfle->fd; - fromfd = -1; - } - else - { - tofd = -1; - fromfd = curfle->fd; - } - } - else - { - tofd = -1; - fromfd = -1; - } + _gftp_setup_fds (transfer, curfle, &fromfd, &tofd); if (curfle->size == 0) { @@ -653,14 +664,6 @@ } else if (fromsize < 0) { - if (curfle->is_fd) - { - if (transfer->transfer_direction == GFTP_DIRECTION_DOWNLOAD) - transfer->toreq->datafd = -1; - else - transfer->fromreq->datafd = -1; - } - g_static_mutex_lock (&transfer->structmutex); curfle->transfer_action = GFTP_TRANS_ACTION_SKIP; transfer->next_file = 1; @@ -717,14 +720,7 @@ } else { - if (curfle->is_fd) - { - if (transfer->transfer_direction == GFTP_DIRECTION_DOWNLOAD) - transfer->toreq->datafd = -1; - else - transfer->fromreq->datafd = -1; - } - + _gftp_done_with_fds (transfer, curfle); if (gftp_end_transfer (transfer->fromreq) != 0) { if (gftp_get_transfer_status (transfer, -1) == GFTP_ERETRYABLE) @@ -777,7 +773,7 @@ gftp_window_data * fromwdata, gftp_window_data * towdata, GList * files, int copy_req) { - int dialog, append_transfers; + int dialog, append_transfers, one_transfer; gftp_curtrans_data * transdata; GList * templist, *curfle; gftp_transfer * tdata; @@ -794,9 +790,11 @@ gftp_lookup_request_option (fromreq, "append_transfers", &append_transfers); + gftp_lookup_request_option (fromreq, "one_transfer", + &one_transfer); tdata = NULL; - if (append_transfers) + if (append_transfers && one_transfer) { pthread_mutex_lock (&transfer_mutex); for (templist = gftp_file_transfers; templist != NULL; templist = templist->next) @@ -883,8 +881,7 @@ tdata->fromreq = fromreq; tdata->toreq = toreq; } - tdata->transfer_direction = fromwdata && fromwdata == &window1 ? - GFTP_DIRECTION_UPLOAD : GFTP_DIRECTION_DOWNLOAD; + tdata->fromwdata = fromwdata; tdata->towdata = towdata; if (!dialog) @@ -1230,24 +1227,22 @@ if (GFTP_IS_SAME_HOST_STOP_TRANS ((gftp_window_data *) tdata->fromwdata, tdata->fromreq)) - { - gftp_swap_socks (((gftp_window_data *) tdata->fromwdata)->request, - tdata->fromreq); - refresh (tdata->fromwdata); - } + gftp_swap_socks (((gftp_window_data *) tdata->fromwdata)->request, + tdata->fromreq); else gftp_disconnect (tdata->fromreq); if (GFTP_IS_SAME_HOST_STOP_TRANS ((gftp_window_data *) tdata->towdata, tdata->toreq)) - { - gftp_swap_socks (((gftp_window_data *) tdata->towdata)->request, - tdata->toreq); - refresh (tdata->towdata); - } + gftp_swap_socks (((gftp_window_data *) tdata->towdata)->request, + tdata->toreq); else gftp_disconnect (tdata->toreq); + if (tdata->towdata != NULL && compare_request (tdata->toreq, + ((gftp_window_data *) tdata->towdata)->request, 1)) + refresh (tdata->towdata); + num_transfers_in_progress--; } @@ -1900,7 +1895,7 @@ gftp_gtk_ask_transfer (gftp_transfer * tdata) { char *dltitles[4], *add_data[4] = { NULL, NULL, NULL, NULL }, - tempstr[50], temp1str[50], *pos, *title; + tempstr[50], temp1str[50], *pos; GtkWidget * tempwid, * scroll, * hbox; int i, overwrite_default; gftp_file * tempfle; @@ -1908,16 +1903,14 @@ size_t len; dltitles[0] = _("Filename"); - dltitles[1] = _("Local Size"); - dltitles[2] = _("Remote Size"); + dltitles[1] = tdata->fromreq->hostname; + dltitles[2] = tdata->toreq->hostname; dltitles[3] = _("Action"); - title = tdata->transfer_direction == GFTP_DIRECTION_DOWNLOAD ? - _("Download Files") : _("Upload Files"); #if GTK_MAJOR_VERSION == 1 dialog = gtk_dialog_new (); gtk_grab_add (dialog); - gtk_window_set_title (GTK_WINDOW (dialog), title); + gtk_window_set_title (GTK_WINDOW (dialog), _("Transfer Files")); gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 5); gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->action_area), 35); gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dialog)->action_area), TRUE); @@ -1926,7 +1919,7 @@ GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_OBJECT (dialog)); #else - dialog = gtk_dialog_new_with_buttons (title, NULL, 0, + dialog = gtk_dialog_new_with_buttons (_("Transfer Files"), NULL, 0, GTK_STOCK_OK, GTK_RESPONSE_OK, GTK_STOCK_CANCEL, @@ -2007,20 +2000,10 @@ } } - if (tdata->transfer_direction == GFTP_DIRECTION_DOWNLOAD) - { - add_data[2] = insert_commas (tempfle->size, tempstr, - sizeof (tempstr)); - add_data[1] = insert_commas (tempfle->startsize, temp1str, - sizeof (temp1str)); - } - else - { - add_data[1] = insert_commas (tempfle->size, tempstr, - sizeof (tempstr)); - add_data[2] = insert_commas (tempfle->startsize, temp1str, - sizeof (temp1str)); - } + add_data[1] = insert_commas (tempfle->size, tempstr, sizeof (tempstr)); + add_data[2] = insert_commas (tempfle->startsize, temp1str, + sizeof (temp1str)); + i = gtk_clist_append (GTK_CLIST (tdata->clist), add_data); gtk_clist_set_row_data (GTK_CLIST (tdata->clist), i, tempfle); }