changeset 50:d433c1417d7d

2002-11-5 Brian Masney <masneyb@gftp.org> * src/gtk/dnd.c - some code cleanups. Also, add the file transfer with the function add_file_transfer() * src/gtk/misc-gtk.c - remove several unneeded calls to fix_display() * src/gtk/gftp-gtk.c (list_dblclick) - add a note about the double click stuff not working properly
author masneyb
date Wed, 06 Nov 2002 04:10:45 +0000
parents 0fec02fb9e54
children 33a0ba7f52d1
files ChangeLog src/gtk/dnd.c src/gtk/gftp-gtk.c src/gtk/misc-gtk.c
diffstat 4 files changed, 33 insertions(+), 68 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Nov 06 02:46:12 2002 +0000
+++ b/ChangeLog	Wed Nov 06 04:10:45 2002 +0000
@@ -1,3 +1,12 @@
+2002-11-5 Brian Masney <masneyb@gftp.org>
+	* src/gtk/dnd.c - some code cleanups. Also, add the file transfer with
+	the function add_file_transfer()
+
+	* src/gtk/misc-gtk.c - remove several unneeded calls to fix_display()
+
+	* src/gtk/gftp-gtk.c (list_dblclick) - add a note about the double
+	click stuff not working properly
+
 2002-11-5 Brian Masney <masneyb@gftp.org>
 	* src/gtk/transfer.c - use stock icons in GTK+ 2.0 port
 
@@ -154,7 +163,7 @@
 
 	* cvsclean - added this script
 
-	* *.[ch] - added $Id: ChangeLog,v 1.27 2002/11/06 02:46:11 masneyb Exp $ tags
+	* *.[ch] - added $Id: ChangeLog,v 1.28 2002/11/06 04:10:45 masneyb Exp $ tags
 
 	* debian/* - updated files from Debian maintainer
 
--- a/src/gtk/dnd.c	Wed Nov 06 02:46:12 2002 +0000
+++ b/src/gtk/dnd.c	Wed Nov 06 04:10:45 2002 +0000
@@ -22,16 +22,15 @@
 
 
 static int
-dnd_remote_file (char *url, GList ** transfers, gftp_window_data * wdata)
+dnd_remote_file (char *url, gftp_window_data * wdata)
 {
   gftp_request * current_ftpdata;
-  gftp_window_data * fromwdata;
-  gftp_transfer * tdata;
   gftp_file * newfle;
-  GList * templist;
   char *str, *pos;
+  GList templist;
   int i;
 
+  printf ("FIXME - in dnd_remote file\n");
   newfle = g_malloc0 (sizeof (*newfle));
   newfle->shown = 1;
   if (url[strlen (url) - 1] == '/') 
@@ -67,7 +66,10 @@
     }
 
   if (compare_request (current_ftpdata, wdata->request, 1))
-    return (0);
+    {
+      gftp_request_destroy (current_ftpdata);
+      return (0);
+    }
 
   if (i)
     {
@@ -87,36 +89,11 @@
   newfle->ascii = gftp_get_file_transfer_mode (newfle->file, 
                                 wdata->request->data_type) == GFTP_TYPE_ASCII;
 
-  tdata = NULL;
-  templist = *transfers;
-  while (templist != NULL) 
-    {
-      tdata = templist->data;
-      if (compare_request (tdata->fromreq, current_ftpdata, 1))
-        break;
-      templist = templist->next;
-    }
-
-  if (tdata == NULL) 
-    {
-      tdata = g_malloc0 (sizeof (*tdata));
-      tdata->towdata = wdata == &window1 ? &window1 : &window2;
-      fromwdata = wdata == &window1 ? &window2 : &window1;
-      if (fromwdata->request != NULL &&
-          compare_request (fromwdata->request, current_ftpdata, 1))
-        {
-          if (fromwdata->request->password != NULL)
-            gftp_set_password (current_ftpdata, fromwdata->request->password);
-          tdata->fromwdata = fromwdata;
-        }
-      tdata->fromreq = current_ftpdata;
-      tdata->toreq = gftp_request_new ();
-      tdata->toreq->logging_function = ftp_log;
-      tdata->toreq = copy_request (wdata->request);
-      *transfers = g_list_append (*transfers, tdata);
-    }
-  else
-    gftp_request_destroy (current_ftpdata);
+  templist.data = newfle;
+  templist.next = NULL;
+  add_file_transfer (current_ftpdata, wdata->request, NULL,
+                     wdata, &templist, 1);
+  gftp_request_destroy (current_ftpdata);
 
   if (newfle->isdir)
     {
@@ -127,12 +104,6 @@
 			    tdata->fromhdata->ftpdata);
 */
     }
-  else
-    {
-      tdata->files = g_list_append (tdata->files, newfle);
-      if (tdata->curfle == NULL) 
-	tdata->curfle = tdata->files;
-    }
   return (1);
 }
 
@@ -253,28 +224,26 @@
 		       gint y, GtkSelectionData * selection_data, guint info,
 		       guint32 clk_time, gpointer data)
 {
-  GList * new_file_transfers, * templist;
   char *newpos, *oldpos, tempchar;
   gftp_window_data * wdata;
-  gftp_transfer * tdata;
   int finish_drag;
 
   wdata = data;   
   if (!check_status (_("Drag-N-Drop"), wdata, 1, 0, 0, 1)) 
     return;
 
-  new_file_transfers = NULL;
   finish_drag = 0;
   if ((selection_data->length >= 0) && (selection_data->format == 8)) 
     {
       oldpos = (char *) selection_data->data;
-      while ((newpos = strchr (oldpos, '\n')) 
-             || (newpos = strchr (oldpos, '\0'))) 
+      printf ("FIXME - got data %s\n", oldpos);
+      while ((newpos = strchr (oldpos, '\n')) || 
+             (newpos = strchr (oldpos, '\0'))) 
         {
           tempchar = *newpos;
           *newpos = '\0';
           ftp_log (gftp_logging_misc, NULL, _("Received URL %s\n"), oldpos);
-          if (dnd_remote_file (oldpos, &new_file_transfers, wdata))
+          if (dnd_remote_file (oldpos, wdata))
             finish_drag = 1;
          
           if (*newpos == '\0') 
@@ -283,17 +252,6 @@
         }
     }
 
-  if (finish_drag) 
-    {
-      for (templist = new_file_transfers; templist != NULL; 
-           templist = templist->next)
-        {
-          tdata = templist->data;
-	  if (tdata->files != NULL)
-            add_file_transfer (tdata->fromreq, tdata->toreq, tdata->fromwdata,
-                               tdata->towdata, tdata->files, 0);
-        }
-    }
   gtk_drag_finish (context, finish_drag, FALSE, clk_time);
 }
 
--- a/src/gtk/gftp-gtk.c	Wed Nov 06 02:46:12 2002 +0000
+++ b/src/gtk/gftp-gtk.c	Wed Nov 06 04:10:45 2002 +0000
@@ -527,10 +527,13 @@
     }
   return (TRUE);
 #else
-  /* If we're using GTK 2.0, if I connect to the button_press_event signal,
-     whenever I get the GDK_2BUTTON_PRESS event, nothing is selected inside
-     the clist. But if I connect_after to the button_release_event, it seems
-     to only get called when we double click */
+  /* FIXME - If we're using GTK 2.0, if I connect to the button_press_event 
+     signal, whenever I get the GDK_2BUTTON_PRESS event, nothing is selected 
+     inside the clist. But if I connect_after to the button_release_event, it 
+     seems to only get called when we double click */
+
+  /* This is also causing a bug where the file transfer is being added twice */
+
   if (event->button == 1)
     {
       list_doaction (wdata);
--- a/src/gtk/misc-gtk.c	Wed Nov 06 02:46:12 2002 +0000
+++ b/src/gtk/misc-gtk.c	Wed Nov 06 04:10:45 2002 +0000
@@ -222,9 +222,6 @@
 
   if (free_logstr)
     g_free (logstr);
-
-  if (ptr == NULL) 
-    fix_display ();
 }
 
 
@@ -238,7 +235,6 @@
   gftp_delete_cache_entry (wdata->request, 0);
   ftp_list_files (wdata, 0);
   gtk_clist_thaw (GTK_CLIST (wdata->listbox));
-  fix_display ();
 }
 
 
@@ -379,7 +375,6 @@
   set_menu_sensitive (wdata, menus[start + 19].path, connected &&
                       wdata->request->get_file != NULL);
   set_menu_sensitive (wdata, menus[start + 20].path, connected);
-  fix_display ();
 }