diff src/gtk/gtkui_transfer.c @ 378:712d3810f4e1

2003-1-27 Brian Masney <masneyb@gftp.org> * lib/gftp.h lib/misc.c src/gtk/gtkui_transfer.c src/text/textui.c - added gftp_get_transfer_action(). When a file is to be transfered and already exists, this will return the default action that should be taken. * src/text/textui.c (gftpui_ask_transfer) - implemented this function so that whenever a file exists and is to be transfered, the user will be prompted on whether or not to overwrite/skip/resume * src/text/gftp-text.c (gftp_text_ask_question) - fixups for inputing a single character
author masneyb
date Tue, 27 Jan 2004 23:48:26 +0000
parents 14da115b149b
children 14ef37b62c20
line wrap: on
line diff
--- a/src/gtk/gtkui_transfer.c	Sat Jan 24 11:45:11 2004 +0000
+++ b/src/gtk/gtkui_transfer.c	Tue Jan 27 23:48:26 2004 +0000
@@ -208,7 +208,6 @@
   char *dltitles[4], *add_data[4] = { NULL, NULL, NULL, NULL },
        tempstr[50], temp1str[50], *pos;
   GtkWidget * dialog, * tempwid, * scroll, * hbox;
-  intptr_t overwrite_default;
   gftp_file * tempfle;
   GList * templist;
   size_t len;
@@ -276,9 +275,6 @@
   gtk_widget_show (tdata->clist);
   gtk_widget_show (scroll);
 
-  gftp_lookup_request_option (tdata->fromreq, "overwrite_default",
-                              &overwrite_default);
-
   for (templist = tdata->files; templist != NULL; 
        templist = templist->next)
     {
@@ -296,25 +292,21 @@
         pos = tempfle->destfile + len + 1;
       add_data[0] = pos;
 
-      if (overwrite_default)
-        {
-          add_data[3] = _("Overwrite");
-          tempfle->transfer_action = GFTP_TRANS_ACTION_OVERWRITE;
-        }
-      else if (tempfle->startsize == tempfle->size)
+      gftp_get_transfer_action (tdata->fromreq, tempfle);
+      switch (tempfle->transfer_action)
         {
-          add_data[3] = _("Skip");
-          tempfle->transfer_action = GFTP_TRANS_ACTION_SKIP;
-        }
-      else if (tempfle->startsize > tempfle->size)
-        {
-          add_data[3] = _("Overwrite");
-          tempfle->transfer_action = GFTP_TRANS_ACTION_OVERWRITE;
-        }
-      else
-        {
-          add_data[3] = _("Resume");
-          tempfle->transfer_action = GFTP_TRANS_ACTION_RESUME;
+          case GFTP_TRANS_ACTION_OVERWRITE:
+            add_data[3] = _("Overwrite");
+            break;
+          case GFTP_TRANS_ACTION_SKIP:
+            add_data[3] = _("Skip");
+            break;
+          case GFTP_TRANS_ACTION_RESUME:
+            add_data[3] = _("Resume");
+            break;
+          default:
+            add_data[3] = _("Error");
+            break;
         }
 
       add_data[1] = insert_commas (tempfle->size, tempstr, sizeof (tempstr));