annotate src/gtk/transfer.c @ 303:3b9d5797050f

2003-11-2 Brian Masney <masneyb@gftp.org> * lib/rfc2068.c (rfc2068_chunked_read) - more improvements to this function so that it will parse more chunked file transfers correctly. * lib/misc.c lib/gftp.h lib/rfc2068.c src/gtk/bookmarks.c src/gtk/dnd.c - removed remove_double_slashes(). Call gftp_build_path() to build the paths. This now allows Novell directory listings with //server * lib/protocols.c src/gtk/transfer.c lib/gftp.h - added variable conn_error_no_timeout to gftp_transfer structure. If this is enabled, if the remote connection to the server timed out, don't wait and immediately reconnect. So far, the only time this is used is when the user was editing a file and it is to be uploaded back to the server. * src/gtk/gftp-gtk.h src/gtk/transfer.c - add_file_transfer() now returns the struct gftp_transfer that was just added. * src/gtk/misc-gtk.c (update_directory_download_progress) - don't make the window a popup and remove the window decorations * src/text/gftp-text.c - don't populate the transfer_direction variable in struct gftp_transfer. This is only needed by the GTK+ port and will hopefully be taken out soon. * lib/gftp.h - remove gftp_transfer_type enum. It wasn't used anymore.
author masneyb
date Mon, 03 Nov 2003 02:14:05 +0000
parents 6d088dfece0b
children 6d180e6a8ba5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1 /*****************************************************************************/
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2 /* transfer.c - functions to handle transfering files */
255
2ad324cf4930 2003-8-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 246
diff changeset
3 /* Copyright (C) 1998-2003 Brian Masney <masneyb@gftp.org> */
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
4 /* */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
5 /* This program is free software; you can redistribute it and/or modify */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
6 /* it under the terms of the GNU General Public License as published by */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
7 /* the Free Software Foundation; either version 2 of the License, or */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
8 /* (at your option) any later version. */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
9 /* */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
10 /* This program is distributed in the hope that it will be useful, */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
11 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
12 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
13 /* GNU General Public License for more details. */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
14 /* */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
15 /* You should have received a copy of the GNU General Public License */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
16 /* along with this program; if not, write to the Free Software */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
17 /* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
18 /*****************************************************************************/
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
19
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
20 #include <gftp-gtk.h>
33
c8ec7877432e 2002-10-06 Brian Masney <masneyb@gftp.org>
masneyb
parents: 31
diff changeset
21 static const char cvsid[] = "$Id$";
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
22
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
23 static GtkWidget * dialog;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
24 static int num_transfers_in_progress = 0;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
25
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
26 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
27 wakeup_main_thread (gpointer data, gint source, GdkInputCondition condition)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
28 {
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
29 gftp_request * request;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
30 char c;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
31
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
32 request = data;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
33 if (request->wakeup_main_thread[0] > 0)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
34 read (request->wakeup_main_thread[0], &c, 1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
35 }
33
c8ec7877432e 2002-10-06 Brian Masney <masneyb@gftp.org>
masneyb
parents: 31
diff changeset
36
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
37
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
38 static gint
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
39 setup_wakeup_main_thread (gftp_request * request)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
40 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
41 gint handler;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
42
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
43 if (socketpair (AF_UNIX, SOCK_STREAM, 0, request->wakeup_main_thread) == 0)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
44 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
45 handler = gdk_input_add (request->wakeup_main_thread[0],
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
46 GDK_INPUT_READ, wakeup_main_thread, request);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
47 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
48 else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
49 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
50 request->wakeup_main_thread[0] = 0;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
51 request->wakeup_main_thread[1] = 0;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
52 handler = 0;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
53 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
54 return (handler);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
55 }
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
56
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
57
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
58 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
59 teardown_wakeup_main_thread (gftp_request * request, gint handler)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
60 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
61 if (request->wakeup_main_thread[0] > 0 && request->wakeup_main_thread[1] > 0)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
62 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
63 gdk_input_remove (handler);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
64 close (request->wakeup_main_thread[0]);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
65 close (request->wakeup_main_thread[1]);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
66 request->wakeup_main_thread[0] = 0;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
67 request->wakeup_main_thread[1] = 0;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
68 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
69 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
70
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
71
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
72 static void *
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
73 getdir_thread (void * data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
74 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
75 int sj, havedotdot, got;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
76 gftp_request * request;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
77 gftp_file * fle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
78 GList * files;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
79
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
80 request = data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
81
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
82 if (request->use_threads)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
83 {
42
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 41
diff changeset
84 sj = sigsetjmp (jmp_environment, 1);
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 41
diff changeset
85 use_jmp_environment = 1;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
86 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
87 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
88 sj = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
89
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
90 files = NULL;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
91 if (sj == 0 || sj == 2)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
92 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
93 if (gftp_list_files (request) != 0 || !GFTP_IS_CONNECTED (request))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
94 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
95 if (request->use_threads)
42
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 41
diff changeset
96 use_jmp_environment = 0;
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 41
diff changeset
97
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
98 request->stopable = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
99 if (request->wakeup_main_thread[1] > 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
100 write (request->wakeup_main_thread[1], " ", 1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
101 return (NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
102 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
103
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
104 request->gotbytes = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
105 havedotdot = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
106 fle = g_malloc0 (sizeof (*fle));
274
4610d25d4abb 2003-9-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 255
diff changeset
107 while ((got = gftp_get_next_file (request, NULL, fle)) > 0 ||
4610d25d4abb 2003-9-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 255
diff changeset
108 got == GFTP_ERETRYABLE)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
109 {
274
4610d25d4abb 2003-9-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 255
diff changeset
110 if (got < 0)
4610d25d4abb 2003-9-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 255
diff changeset
111 {
4610d25d4abb 2003-9-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 255
diff changeset
112 gftp_file_destroy (fle);
4610d25d4abb 2003-9-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 255
diff changeset
113 continue;
4610d25d4abb 2003-9-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 255
diff changeset
114 }
4610d25d4abb 2003-9-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 255
diff changeset
115
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
116 request->gotbytes += got;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
117 if (strcmp (fle->file, ".") == 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
118 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
119 gftp_file_destroy (fle);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
120 continue;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
121 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
122 else if (strcmp (fle->file, "..") == 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
123 havedotdot = 1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
124
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
125 files = g_list_append (files, fle);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
126 fle = g_malloc0 (sizeof (*fle));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
127 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
128 g_free (fle);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
129
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
130 if (!GFTP_IS_CONNECTED (request))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
131 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
132 if (request->use_threads)
42
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 41
diff changeset
133 use_jmp_environment = 0;
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 41
diff changeset
134
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
135 request->stopable = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
136 if (request->wakeup_main_thread[1] > 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
137 write (request->wakeup_main_thread[1], " ", 1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
138 return (NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
139 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
140
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
141 gftp_end_transfer (request);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
142 request->gotbytes = -1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
143
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
144 if (!havedotdot)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
145 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
146 fle = g_malloc0 (sizeof (*fle));
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
147 fle->file = g_strdup ("..");
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
148 fle->user = g_malloc0 (1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
149 fle->group = g_malloc0 (1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
150 fle->attribs = g_malloc0 (1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
151 *fle->attribs = '\0';
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
152 fle->isdir = 1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
153 files = g_list_prepend (files, fle);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
154 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
155 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
156
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
157 if (request->use_threads)
43
36e2868ce8b7 2002-10-30 Brian Masney <masneyb@gftp.org>
masneyb
parents: 42
diff changeset
158 use_jmp_environment = 0;
42
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 41
diff changeset
159
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
160 request->stopable = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
161 if (request->wakeup_main_thread[1] > 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
162 write (request->wakeup_main_thread[1], " ", 1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
163 return (files);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
164 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
165
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
166
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
167 int
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
168 ftp_list_files (gftp_window_data * wdata, int usecache)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
169 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
170 guint handler;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
171 void *success;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
172
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
173 gtk_label_set (GTK_LABEL (wdata->hoststxt), _("Receiving file names..."));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
174
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
175 wdata->show_selected = 0;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
176 if (wdata->files == NULL)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
177 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
178 if (check_reconnect (wdata) < 0)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
179 return (0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
180
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
181 gtk_clist_freeze (GTK_CLIST (wdata->listbox));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
182 wdata->request->stopable = 1;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
183 if (wdata->request->use_threads)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
184 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
185 gtk_widget_set_sensitive (stop_btn, 1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
186
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
187 handler = setup_wakeup_main_thread (wdata->request);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
188 pthread_create (&wdata->tid, NULL, getdir_thread, wdata->request);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
189 while (wdata->request->stopable)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
190 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
191 GDK_THREADS_LEAVE ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
192 #if GTK_MAJOR_VERSION == 1
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
193 g_main_iteration (TRUE);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
194 #else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
195 g_main_context_iteration (NULL, TRUE);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
196 #endif
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
197 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
198 teardown_wakeup_main_thread (wdata->request, handler);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
199
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
200 pthread_join (wdata->tid, &success);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
201 gtk_widget_set_sensitive (stop_btn, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
202 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
203 else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
204 success = getdir_thread (wdata->request);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
205 wdata->files = success;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
206 gtk_clist_thaw (GTK_CLIST (wdata->listbox));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
207 memset (&wdata->tid, 0, sizeof (wdata->tid));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
208 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
209
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
210 if (wdata->files == NULL || !GFTP_IS_CONNECTED (wdata->request))
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
211 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
212 disconnect (wdata);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
213 return (0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
214 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
215
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
216 wdata->sorted = 0;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
217 sortrows (GTK_CLIST (wdata->listbox), -1, (gpointer) wdata);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
218 if (IS_NONE_SELECTED (wdata))
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
219 gtk_clist_select_row (GTK_CLIST (wdata->listbox), 0, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
220 return (1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
221 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
222
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
223
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
224 static void
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
225 try_connect_again (gftp_request * request, gftp_dialog_data * ddata)
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
226 {
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
227 gftp_set_password (request, gtk_entry_get_text (GTK_ENTRY (ddata->edit)));
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
228 request->stopable = 0;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
229 }
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
230
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
231
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
232 static void
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
233 dont_connect_again (gftp_request * request, gftp_dialog_data * ddata)
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
234 {
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
235 request->stopable = 0;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
236 }
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
237
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
238
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
239 static void *
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
240 connect_thread (void *data)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
241 {
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
242 int ret, sj, retries, sleep_time, network_timeout;
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
243 static int conn_num;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
244 gftp_request * request;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
245
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
246 request = data;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
247
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
248 gftp_lookup_request_option (request, "retries", &retries);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
249 gftp_lookup_request_option (request, "sleep_time", &sleep_time);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
250 gftp_lookup_request_option (request, "network_timeout", &network_timeout);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
251
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
252 conn_num = 0;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
253 if (request->use_threads)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
254 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
255 sj = sigsetjmp (jmp_environment, 1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
256 use_jmp_environment = 1;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
257 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
258 else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
259 sj = 0;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
260
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
261 ret = 0;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
262 if (sj != 0)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
263 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
264 ret = 0;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
265 gftp_disconnect (request);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
266 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
267
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
268 while (sj != 1 && (retries == 0 || conn_num < retries))
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
269 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
270 conn_num++;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
271 if (network_timeout > 0)
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
272 alarm (network_timeout);
84
7ef60ce2bdb2 2002-12-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 76
diff changeset
273 ret = gftp_connect (request);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
274 alarm (0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
275
84
7ef60ce2bdb2 2002-12-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 76
diff changeset
276 if (ret == GFTP_EFATAL)
7ef60ce2bdb2 2002-12-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 76
diff changeset
277 {
7ef60ce2bdb2 2002-12-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 76
diff changeset
278 ret = 0;
7ef60ce2bdb2 2002-12-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 76
diff changeset
279 break;
7ef60ce2bdb2 2002-12-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 76
diff changeset
280 }
7ef60ce2bdb2 2002-12-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 76
diff changeset
281 else if (ret == 0)
7ef60ce2bdb2 2002-12-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 76
diff changeset
282 {
7ef60ce2bdb2 2002-12-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 76
diff changeset
283 ret = 1;
7ef60ce2bdb2 2002-12-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 76
diff changeset
284 break;
7ef60ce2bdb2 2002-12-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 76
diff changeset
285 }
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
286 else if (retries == 0 || conn_num < retries)
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
287 {
186
13ca1defdc75 2003-6-16 Brian Masney <masneyb@gftp.org>
masneyb
parents: 182
diff changeset
288 request->logging_function (gftp_logging_misc, request,
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
289 _("Waiting %d seconds until trying to connect again\n"),
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
290 sleep_time);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
291 alarm (sleep_time);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
292 pause ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
293 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
294 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
295
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
296 if (request->use_threads)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
297 use_jmp_environment = 0;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
298
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
299 request->stopable = 0;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
300 if (request->wakeup_main_thread[1] > 0)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
301 write (request->wakeup_main_thread[1], " ", 1);
195
3fa7b4f4ab78 2003-6-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 186
diff changeset
302 return (GINT_TO_POINTER (ret));
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
303 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
304
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
305
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
306 int
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
307 ftp_connect (gftp_window_data * wdata, gftp_request * request, int getdir)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
308 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
309 int success;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
310 guint handler;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
311 void *ret;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
312
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
313 ret = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
314 if (wdata->request == request)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
315 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
316 gtk_label_set (GTK_LABEL (wdata->hoststxt), _("Connecting..."));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
317 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
318
7
5551ab2301fe * Fixed a DND crash
masneyb
parents: 2
diff changeset
319 if (request->need_userpass && request->username != NULL &&
5551ab2301fe * Fixed a DND crash
masneyb
parents: 2
diff changeset
320 *request->username != '\0' &&
5551ab2301fe * Fixed a DND crash
masneyb
parents: 2
diff changeset
321 (request->password == NULL || *request->password == '\0'))
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
322 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
323 if (wdata && wdata->request == request)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
324 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
325 request->stopable = 1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
326 MakeEditDialog (_("Enter Password"),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
327 _("Please enter your password for this site"), NULL,
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
328 0, NULL, gftp_dialog_button_connect,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
329 try_connect_again, request,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
330 dont_connect_again, request);
31
d930e06af9ae 2002-10-03 Brian Masney <masneyb@gftp.org>
masneyb
parents: 19
diff changeset
331
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
332 while (request->stopable)
31
d930e06af9ae 2002-10-03 Brian Masney <masneyb@gftp.org>
masneyb
parents: 19
diff changeset
333 {
33
c8ec7877432e 2002-10-06 Brian Masney <masneyb@gftp.org>
masneyb
parents: 31
diff changeset
334 GDK_THREADS_LEAVE ();
45
311e29c40ed6 2002-10-31 Brian Masney <masneyb@gftp.org>
masneyb
parents: 43
diff changeset
335 #if GTK_MAJOR_VERSION == 1
31
d930e06af9ae 2002-10-03 Brian Masney <masneyb@gftp.org>
masneyb
parents: 19
diff changeset
336 g_main_iteration (TRUE);
41
4bcfaf6307b5 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 40
diff changeset
337 #else
4bcfaf6307b5 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 40
diff changeset
338 g_main_context_iteration (NULL, TRUE);
4bcfaf6307b5 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 40
diff changeset
339 #endif
31
d930e06af9ae 2002-10-03 Brian Masney <masneyb@gftp.org>
masneyb
parents: 19
diff changeset
340 }
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
341
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
342 if (request->password == NULL || *request->password == '\0')
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
343 return (0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
344 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
345 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
346 gftp_set_password (request, "");
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
347 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
348
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
349 if (wdata && wdata->request == request && request->use_threads)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
350 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
351 request->stopable = 1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
352 if (wdata)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
353 gtk_clist_freeze (GTK_CLIST (wdata->listbox));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
354 gtk_widget_set_sensitive (stop_btn, 1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
355 pthread_create (&wdata->tid, NULL, connect_thread, request);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
356
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
357 handler = setup_wakeup_main_thread (wdata->request);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
358 while (request->stopable)
31
d930e06af9ae 2002-10-03 Brian Masney <masneyb@gftp.org>
masneyb
parents: 19
diff changeset
359 {
33
c8ec7877432e 2002-10-06 Brian Masney <masneyb@gftp.org>
masneyb
parents: 31
diff changeset
360 GDK_THREADS_LEAVE ();
45
311e29c40ed6 2002-10-31 Brian Masney <masneyb@gftp.org>
masneyb
parents: 43
diff changeset
361 #if GTK_MAJOR_VERSION == 1
31
d930e06af9ae 2002-10-03 Brian Masney <masneyb@gftp.org>
masneyb
parents: 19
diff changeset
362 g_main_iteration (TRUE);
41
4bcfaf6307b5 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 40
diff changeset
363 #else
4bcfaf6307b5 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 40
diff changeset
364 g_main_context_iteration (NULL, TRUE);
4bcfaf6307b5 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 40
diff changeset
365 #endif
31
d930e06af9ae 2002-10-03 Brian Masney <masneyb@gftp.org>
masneyb
parents: 19
diff changeset
366 }
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
367 pthread_join (wdata->tid, &ret);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
368 teardown_wakeup_main_thread (wdata->request, handler);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
369
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
370 gtk_widget_set_sensitive (stop_btn, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
371 if (wdata)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
372 gtk_clist_thaw (GTK_CLIST (wdata->listbox));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
373 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
374 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
375 ret = connect_thread (request);
195
3fa7b4f4ab78 2003-6-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 186
diff changeset
376
3fa7b4f4ab78 2003-6-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 186
diff changeset
377 success = GPOINTER_TO_INT (ret);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
378 memset (&wdata->tid, 0, sizeof (wdata->tid));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
379
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
380 if (!GFTP_IS_CONNECTED (wdata->request))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
381 disconnect (wdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
382 else if (success)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
383 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
384 ftp_list_files (wdata, 1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
385 if (!GFTP_IS_CONNECTED (wdata->request))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
386 disconnect (wdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
387 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
388
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
389 return (success);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
390 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
391
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
392
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
393 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
394 get_files (gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
395 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
396 transfer_window_files (&window2, &window1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
397 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
398
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
399
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
400 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
401 put_files (gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
402 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
403 transfer_window_files (&window1, &window2);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
404 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
405
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
406
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
407 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
408 transfer_window_files (gftp_window_data * fromwdata, gftp_window_data * towdata)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
409 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
410 gftp_file * tempfle, * newfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
411 GList * templist, * filelist;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
412 gftp_transfer * transfer;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
413 guint timeout_num;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
414 void *ret;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
415 int num;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
416
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
417 if (!check_status (_("Transfer Files"), fromwdata, 1, 0, 1,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
418 towdata->request->put_file != NULL && fromwdata->request->get_file != NULL))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
419 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
420
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
421 if (!GFTP_IS_CONNECTED (fromwdata->request) ||
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
422 !GFTP_IS_CONNECTED (towdata->request))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
423 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
424 ftp_log (gftp_logging_misc, NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
425 _("Retrieve Files: Not connected to a remote site\n"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
426 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
427 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
428
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
429 if (check_reconnect (fromwdata) < 0 || check_reconnect (towdata) < 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
430 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
431
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
432 transfer = g_malloc0 (sizeof (*transfer));
151
2f15b3000dbc 2003-4-27 Brian Masney <masneyb@gftp.org>
masneyb
parents: 143
diff changeset
433 transfer->fromreq = copy_request (fromwdata->request, 0);
2f15b3000dbc 2003-4-27 Brian Masney <masneyb@gftp.org>
masneyb
parents: 143
diff changeset
434 transfer->toreq = copy_request (towdata->request, 0);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
435 transfer->transfer_direction = fromwdata == &window2 ?
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
436 GFTP_DIRECTION_DOWNLOAD : GFTP_DIRECTION_UPLOAD;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
437 transfer->fromwdata = fromwdata;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
438 transfer->towdata = towdata;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
439
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
440 num = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
441 templist = GTK_CLIST (fromwdata->listbox)->selection;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
442 filelist = fromwdata->files;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
443 while (templist != NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
444 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
445 templist = get_next_selection (templist, &filelist, &num);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
446 tempfle = filelist->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
447 if (strcmp (tempfle->file, "..") != 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
448 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
449 newfle = copy_fdata (tempfle);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
450 transfer->files = g_list_append (transfer->files, newfle);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
451 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
452 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
453
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
454 if (transfer->files != NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
455 {
63
41b71c4e5076 2002-11-2333 Brian Masney <masneyb@gftp.org>
masneyb
parents: 59
diff changeset
456 gftp_swap_socks (transfer->fromreq, fromwdata->request);
41b71c4e5076 2002-11-2333 Brian Masney <masneyb@gftp.org>
masneyb
parents: 59
diff changeset
457 gftp_swap_socks (transfer->toreq, towdata->request);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
458
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
459 if (transfer->fromreq->use_threads ||
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
460 (transfer->toreq && transfer->toreq->use_threads))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
461 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
462 transfer->fromreq->stopable = 1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
463 pthread_create (&fromwdata->tid, NULL, do_getdir_thread, transfer);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
464
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
465 timeout_num = gtk_timeout_add (100, progress_timeout, transfer);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
466
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
467 while (transfer->fromreq->stopable)
31
d930e06af9ae 2002-10-03 Brian Masney <masneyb@gftp.org>
masneyb
parents: 19
diff changeset
468 {
33
c8ec7877432e 2002-10-06 Brian Masney <masneyb@gftp.org>
masneyb
parents: 31
diff changeset
469 GDK_THREADS_LEAVE ();
45
311e29c40ed6 2002-10-31 Brian Masney <masneyb@gftp.org>
masneyb
parents: 43
diff changeset
470 #if GTK_MAJOR_VERSION == 1
31
d930e06af9ae 2002-10-03 Brian Masney <masneyb@gftp.org>
masneyb
parents: 19
diff changeset
471 g_main_iteration (TRUE);
41
4bcfaf6307b5 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 40
diff changeset
472 #else
4bcfaf6307b5 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 40
diff changeset
473 g_main_context_iteration (NULL, TRUE);
4bcfaf6307b5 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 40
diff changeset
474 #endif
31
d930e06af9ae 2002-10-03 Brian Masney <masneyb@gftp.org>
masneyb
parents: 19
diff changeset
475 }
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
476
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
477 gtk_timeout_remove (timeout_num);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
478 transfer->numfiles = transfer->numdirs = -1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
479 update_directory_download_progress (transfer);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
480
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
481 pthread_join (fromwdata->tid, &ret);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
482 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
483 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
484 ret = do_getdir_thread (transfer);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
485
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
486 if (!GFTP_IS_CONNECTED (transfer->fromreq))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
487 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
488 disconnect (fromwdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
489 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
490 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
491
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
492 if (!GFTP_IS_CONNECTED (transfer->toreq))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
493 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
494 disconnect (towdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
495 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
496 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
497
63
41b71c4e5076 2002-11-2333 Brian Masney <masneyb@gftp.org>
masneyb
parents: 59
diff changeset
498 gftp_swap_socks (fromwdata->request, transfer->fromreq);
41b71c4e5076 2002-11-2333 Brian Masney <masneyb@gftp.org>
masneyb
parents: 59
diff changeset
499 gftp_swap_socks (towdata->request, transfer->toreq);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
500 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
501
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
502 if (transfer->files != NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
503 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
504 add_file_transfer (transfer->fromreq, transfer->toreq,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
505 transfer->fromwdata, transfer->towdata,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
506 transfer->files, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
507 g_free (transfer);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
508 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
509 else
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
510 free_tdata (transfer);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
511 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
512
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
513 void *
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
514 do_getdir_thread (void * data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
515 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
516 gftp_transfer * transfer;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
517 int success, sj;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
518
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
519 transfer = data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
520
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
521 if (transfer->fromreq->use_threads ||
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
522 (transfer->toreq && transfer->toreq->use_threads))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
523 {
42
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 41
diff changeset
524 sj = sigsetjmp (jmp_environment, 1);
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 41
diff changeset
525 use_jmp_environment = 1;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
526 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
527 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
528 sj = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
529
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
530 success = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
531 if (sj == 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
532 success = gftp_get_all_subdirs (transfer, NULL) == 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
533 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
534 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
535 gftp_disconnect (transfer->fromreq);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
536 if (transfer->toreq)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
537 gftp_disconnect (transfer->toreq);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
538 transfer->fromreq->logging_function (gftp_logging_error,
186
13ca1defdc75 2003-6-16 Brian Masney <masneyb@gftp.org>
masneyb
parents: 182
diff changeset
539 transfer->fromreq,
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
540 _("Operation canceled\n"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
541 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
542
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
543 if (transfer->fromreq->use_threads ||
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
544 (transfer->toreq && transfer->toreq->use_threads))
42
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 41
diff changeset
545 use_jmp_environment = 0;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
546
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
547 transfer->fromreq->stopable = 0;
195
3fa7b4f4ab78 2003-6-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 186
diff changeset
548 return (GINT_TO_POINTER (success));
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
549 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
550
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
551
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
552 void *
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
553 gftp_gtk_transfer_files (void *data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
554 {
182
33b394ebba68 2003-6-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 169
diff changeset
555 int i, mode, tofd, fromfd, preserve_permissions;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
556 gftp_transfer * transfer;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
557 char buf[8192];
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
558 off_t fromsize, total;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
559 gftp_file * curfle;
86
759c7d019a89 2002-12-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 84
diff changeset
560 ssize_t num_read, ret;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
561
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
562 pthread_detach (pthread_self ());
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
563 transfer = data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
564 transfer->curfle = transfer->files;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
565 gettimeofday (&transfer->starttime, NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
566 memcpy (&transfer->lasttime, &transfer->starttime,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
567 sizeof (transfer->lasttime));
76
fe308e435ed5 2002-12-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 74
diff changeset
568
182
33b394ebba68 2003-6-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 169
diff changeset
569 gftp_lookup_request_option (transfer->fromreq, "preserve_permissions",
33b394ebba68 2003-6-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 169
diff changeset
570 &preserve_permissions);
33b394ebba68 2003-6-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 169
diff changeset
571
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
572 while (transfer->curfle != NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
573 {
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
574 num_read = -1;
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
575 g_static_mutex_lock (&transfer->structmutex);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
576 curfle = transfer->curfle->data;
76
fe308e435ed5 2002-12-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 74
diff changeset
577 transfer->current_file_number++;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
578 g_static_mutex_unlock (&transfer->structmutex);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
579
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
580 if (curfle->transfer_action == GFTP_TRANS_ACTION_SKIP)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
581 {
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
582 g_static_mutex_lock (&transfer->structmutex);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
583 transfer->next_file = 1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
584 transfer->curfle = transfer->curfle->next;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
585 g_static_mutex_unlock (&transfer->structmutex);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
586 continue;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
587 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
588
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
589 fromsize = -1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
590 if (gftp_connect (transfer->fromreq) == 0 &&
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
591 gftp_connect (transfer->toreq) == 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
592 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
593 if (curfle->isdir)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
594 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
595 if (transfer->toreq->mkdir != NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
596 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
597 transfer->toreq->mkdir (transfer->toreq, curfle->destfile);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
598 if (!GFTP_IS_CONNECTED (transfer->toreq))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
599 break;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
600 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
601
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
602 g_static_mutex_lock (&transfer->structmutex);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
603 transfer->next_file = 1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
604 transfer->curfle = transfer->curfle->next;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
605 g_static_mutex_unlock (&transfer->structmutex);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
606 continue;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
607 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
608
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
609 if (curfle->is_fd)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
610 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
611 if (transfer->transfer_direction == GFTP_DIRECTION_DOWNLOAD)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
612 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
613 tofd = curfle->fd;
58
c01d91c10f6c 2002-11-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
614 fromfd = -1;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
615 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
616 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
617 {
58
c01d91c10f6c 2002-11-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
618 tofd = -1;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
619 fromfd = curfle->fd;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
620 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
621 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
622 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
623 {
58
c01d91c10f6c 2002-11-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
624 tofd = -1;
c01d91c10f6c 2002-11-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
625 fromfd = -1;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
626 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
627
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
628 if (curfle->size == 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
629 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
630 curfle->size = gftp_get_file_size (transfer->fromreq, curfle->file);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
631 transfer->total_bytes += curfle->size;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
632 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
633
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
634 if (GFTP_IS_CONNECTED (transfer->fromreq) &&
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
635 GFTP_IS_CONNECTED (transfer->toreq))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
636 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
637 fromsize = gftp_transfer_file (transfer->fromreq, curfle->file,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
638 fromfd,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
639 curfle->transfer_action == GFTP_TRANS_ACTION_RESUME ?
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
640 curfle->startsize : 0,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
641 transfer->toreq, curfle->destfile, tofd,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
642 curfle->transfer_action == GFTP_TRANS_ACTION_RESUME ?
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
643 curfle->startsize : 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
644 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
645 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
646
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
647 if (!GFTP_IS_CONNECTED (transfer->fromreq) ||
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
648 !GFTP_IS_CONNECTED (transfer->toreq))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
649 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
650 transfer->fromreq->logging_function (gftp_logging_misc,
186
13ca1defdc75 2003-6-16 Brian Masney <masneyb@gftp.org>
masneyb
parents: 182
diff changeset
651 transfer->fromreq,
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
652 _("Error: Remote site disconnected after trying to transfer file\n"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
653 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
654 else if (fromsize < 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
655 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
656 if (curfle->is_fd)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
657 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
658 if (transfer->transfer_direction == GFTP_DIRECTION_DOWNLOAD)
58
c01d91c10f6c 2002-11-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
659 transfer->toreq->datafd = -1;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
660 else
58
c01d91c10f6c 2002-11-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
661 transfer->fromreq->datafd = -1;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
662 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
663
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
664 g_static_mutex_lock (&transfer->structmutex);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
665 curfle->transfer_action = GFTP_TRANS_ACTION_SKIP;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
666 transfer->next_file = 1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
667 transfer->curfle = transfer->curfle->next;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
668 g_static_mutex_unlock (&transfer->structmutex);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
669 continue;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
670 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
671 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
672 {
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
673 g_static_mutex_lock (&transfer->structmutex);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
674 transfer->curtrans = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
675 transfer->curresumed = curfle->transfer_action == GFTP_TRANS_ACTION_RESUME ? curfle->startsize : 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
676 transfer->resumed_bytes += transfer->curresumed;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
677 g_static_mutex_unlock (&transfer->structmutex);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
678
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
679 total = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
680 i = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
681 while (!transfer->cancel &&
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
682 (num_read = gftp_get_next_file_chunk (transfer->fromreq,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
683 buf, sizeof (buf))) > 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
684 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
685 total += num_read;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
686 gftp_calc_kbs (transfer, num_read);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
687
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
688 if ((ret = gftp_put_next_file_chunk (transfer->toreq, buf,
86
759c7d019a89 2002-12-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 84
diff changeset
689 num_read)) < 0)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
690 {
86
759c7d019a89 2002-12-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 84
diff changeset
691 num_read = (int) ret;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
692 break;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
693 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
694 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
695 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
696
40
66c064fd05bc 2002-10-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 37
diff changeset
697 if (transfer->cancel)
66c064fd05bc 2002-10-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 37
diff changeset
698 {
66c064fd05bc 2002-10-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 37
diff changeset
699 if (gftp_abort_transfer (transfer->fromreq) != 0)
66c064fd05bc 2002-10-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 37
diff changeset
700 gftp_disconnect (transfer->fromreq);
66c064fd05bc 2002-10-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 37
diff changeset
701
66c064fd05bc 2002-10-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 37
diff changeset
702 if (gftp_abort_transfer (transfer->toreq) != 0)
66c064fd05bc 2002-10-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 37
diff changeset
703 gftp_disconnect (transfer->toreq);
66c064fd05bc 2002-10-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 37
diff changeset
704 }
66c064fd05bc 2002-10-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 37
diff changeset
705 else if (num_read < 0)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
706 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
707 transfer->fromreq->logging_function (gftp_logging_misc,
186
13ca1defdc75 2003-6-16 Brian Masney <masneyb@gftp.org>
masneyb
parents: 182
diff changeset
708 transfer->fromreq,
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
709 _("Could not download %s from %s\n"),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
710 curfle->file,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
711 transfer->fromreq->hostname);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
712
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
713 if (gftp_get_transfer_status (transfer, num_read) == GFTP_ERETRYABLE)
40
66c064fd05bc 2002-10-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 37
diff changeset
714 continue;
66c064fd05bc 2002-10-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 37
diff changeset
715
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
716 break;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
717 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
718 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
719 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
720 if (curfle->is_fd)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
721 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
722 if (transfer->transfer_direction == GFTP_DIRECTION_DOWNLOAD)
58
c01d91c10f6c 2002-11-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
723 transfer->toreq->datafd = -1;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
724 else
58
c01d91c10f6c 2002-11-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
725 transfer->fromreq->datafd = -1;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
726 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
727
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
728 if (gftp_end_transfer (transfer->fromreq) != 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
729 {
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
730 if (gftp_get_transfer_status (transfer, -1) == GFTP_ERETRYABLE)
40
66c064fd05bc 2002-10-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 37
diff changeset
731 continue;
66c064fd05bc 2002-10-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 37
diff changeset
732
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
733 break;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
734 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
735 gftp_end_transfer (transfer->toreq);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
736
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
737 transfer->fromreq->logging_function (gftp_logging_misc,
186
13ca1defdc75 2003-6-16 Brian Masney <masneyb@gftp.org>
masneyb
parents: 182
diff changeset
738 transfer->fromreq,
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
739 _("Successfully transferred %s at %.2f KB/s\n"),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
740 curfle->file, transfer->kbs);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
741 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
742
182
33b394ebba68 2003-6-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 169
diff changeset
743 if (!curfle->is_fd && preserve_permissions)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
744 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
745 if (curfle->attribs)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
746 {
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
747 mode = gftp_parse_attribs (curfle->attribs);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
748 if (mode != 0)
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
749 gftp_chmod (transfer->toreq, curfle->destfile, mode);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
750 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
751
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
752 if (curfle->datetime != 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
753 gftp_set_file_time (transfer->toreq, curfle->destfile,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
754 curfle->datetime);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
755 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
756
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
757 g_static_mutex_lock (&transfer->structmutex);
278
3bc63e3dbe12 2003-10-2 Brian Masney <masneyb@gftp.org>
masneyb
parents: 274
diff changeset
758 transfer->curtrans = 0;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
759 transfer->next_file = 1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
760 curfle->transfer_done = 1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
761 transfer->curfle = transfer->curfle->next;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
762 g_static_mutex_unlock (&transfer->structmutex);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
763
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
764 if (transfer->cancel && !transfer->skip_file)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
765 break;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
766 transfer->cancel = 0;
42
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 41
diff changeset
767 transfer->fromreq->cancel = 0;
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 41
diff changeset
768 transfer->toreq->cancel = 0;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
769 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
770 transfer->done = 1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
771 return (NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
772 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
773
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
774
303
3b9d5797050f 2003-11-2 Brian Masney <masneyb@gftp.org>
masneyb
parents: 297
diff changeset
775 gftp_transfer *
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
776 add_file_transfer (gftp_request * fromreq, gftp_request * toreq,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
777 gftp_window_data * fromwdata, gftp_window_data * towdata,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
778 GList * files, int copy_req)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
779 {
143
5c952c5cb438 2003-4-23 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
780 int dialog, append_transfers;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
781 gftp_curtrans_data * transdata;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
782 GList * templist, *curfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
783 gftp_transfer * tdata;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
784 gftp_file * tempfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
785 char *pos, *text[2];
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
786
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
787 for (templist = files; templist != NULL; templist = templist->next)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
788 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
789 tempfle = templist->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
790 if (tempfle->startsize > 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
791 break;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
792 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
793 dialog = templist != NULL;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
794
143
5c952c5cb438 2003-4-23 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
795 gftp_lookup_request_option (fromreq, "append_transfers",
5c952c5cb438 2003-4-23 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
796 &append_transfers);
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
797
303
3b9d5797050f 2003-11-2 Brian Masney <masneyb@gftp.org>
masneyb
parents: 297
diff changeset
798 tdata = NULL;
143
5c952c5cb438 2003-4-23 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
799 if (append_transfers)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
800 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
801 pthread_mutex_lock (&transfer_mutex);
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
802 for (templist = gftp_file_transfers; templist != NULL; templist = templist->next)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
803 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
804 tdata = templist->data;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
805 g_static_mutex_lock (&tdata->structmutex);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
806 if (compare_request (tdata->fromreq, fromreq, 0) &&
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
807 compare_request (tdata->toreq, toreq, 0) &&
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
808 tdata->curfle != NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
809 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
810 if (!copy_req)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
811 {
67
aa971a4bb16f 2002-11-27 Brian Masney <masneyb@gftp.org>
masneyb
parents: 66
diff changeset
812 gftp_request_destroy (fromreq, 1);
aa971a4bb16f 2002-11-27 Brian Masney <masneyb@gftp.org>
masneyb
parents: 66
diff changeset
813 gftp_request_destroy (toreq, 1);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
814 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
815 fromreq = NULL;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
816 toreq = NULL;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
817
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
818 for (curfle = tdata->curfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
819 curfle != NULL && curfle->next != NULL;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
820 curfle = curfle->next);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
821 if (curfle == NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
822 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
823 curfle = files;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
824 files->prev = NULL;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
825 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
826 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
827 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
828 curfle->next = files;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
829 files->prev = curfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
830 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
831
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
832 for (curfle = files; curfle != NULL; curfle = curfle->next)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
833 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
834 tempfle = curfle->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
835 if (tempfle->isdir)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
836 tdata->numdirs++;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
837 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
838 tdata->numfiles++;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
839 if ((pos = strrchr (tempfle->file, '/')) == NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
840 pos = tempfle->file;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
841 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
842 pos++;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
843
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
844 text[0] = pos;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
845 if (tempfle->transfer_action == GFTP_TRANS_ACTION_SKIP)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
846 text[1] = _("Skipped");
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
847 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
848 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
849 tdata->total_bytes += tempfle->size;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
850 text[1] = _("Waiting...");
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
851 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
852
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
853 tempfle->user_data = gtk_ctree_insert_node (GTK_CTREE (dlwdw),
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
854 tdata->user_data, NULL, text, 5,
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
855 NULL, NULL, NULL, NULL,
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
856 FALSE, FALSE);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
857 transdata = g_malloc (sizeof (*transdata));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
858 transdata->transfer = tdata;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
859 transdata->curfle = curfle;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
860 gtk_ctree_node_set_row_data (GTK_CTREE (dlwdw), tempfle->user_data,
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
861 transdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
862 }
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
863 g_static_mutex_unlock (&tdata->structmutex);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
864 break;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
865 }
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
866 g_static_mutex_unlock (&tdata->structmutex);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
867 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
868 pthread_mutex_unlock (&transfer_mutex);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
869 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
870 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
871 templist = NULL;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
872
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
873 if (templist == NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
874 {
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
875 tdata = gftp_tdata_new ();
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
876 if (copy_req)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
877 {
151
2f15b3000dbc 2003-4-27 Brian Masney <masneyb@gftp.org>
masneyb
parents: 143
diff changeset
878 tdata->fromreq = copy_request (fromreq, 0);
2f15b3000dbc 2003-4-27 Brian Masney <masneyb@gftp.org>
masneyb
parents: 143
diff changeset
879 tdata->toreq = copy_request (toreq, 0);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
880 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
881 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
882 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
883 tdata->fromreq = fromreq;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
884 tdata->toreq = toreq;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
885 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
886 tdata->transfer_direction = fromwdata && fromwdata == &window1 ?
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
887 GFTP_DIRECTION_UPLOAD : GFTP_DIRECTION_DOWNLOAD;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
888 tdata->fromwdata = fromwdata;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
889 tdata->towdata = towdata;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
890 if (!dialog)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
891 tdata->show = tdata->ready = 1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
892 tdata->files = files;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
893 for (curfle = files; curfle != NULL; curfle = curfle->next)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
894 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
895 tempfle = curfle->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
896 if (tempfle->isdir)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
897 tdata->numdirs++;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
898 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
899 tdata->numfiles++;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
900 }
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
901
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
902 pthread_mutex_lock (&transfer_mutex);
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
903 gftp_file_transfers = g_list_append (gftp_file_transfers, tdata);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
904 pthread_mutex_unlock (&transfer_mutex);
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
905
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
906 if (dialog)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
907 gftp_gtk_ask_transfer (tdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
908 }
303
3b9d5797050f 2003-11-2 Brian Masney <masneyb@gftp.org>
masneyb
parents: 297
diff changeset
909
3b9d5797050f 2003-11-2 Brian Masney <masneyb@gftp.org>
masneyb
parents: 297
diff changeset
910 return (tdata);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
911 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
912
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
913
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
914 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
915 remove_file (char *filename)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
916 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
917 if (unlink (filename) == 0)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
918 ftp_log (gftp_logging_misc, NULL, _("Successfully removed %s\n"),
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
919 filename);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
920 else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
921 ftp_log (gftp_logging_error, NULL,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
922 _("Error: Could not remove file %s: %s\n"), filename,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
923 g_strerror (errno));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
924 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
925
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
926
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
927 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
928 free_edit_data (gftp_viewedit_data * ve_proc)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
929 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
930 int i;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
931
294
4747f621b79b 2003-10-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 278
diff changeset
932 if (ve_proc->torequest)
4747f621b79b 2003-10-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 278
diff changeset
933 gftp_request_destroy (ve_proc->torequest, 1);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
934 if (ve_proc->filename)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
935 g_free (ve_proc->filename);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
936 if (ve_proc->remote_filename)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
937 g_free (ve_proc->remote_filename);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
938 for (i = 0; ve_proc->argv[i] != NULL; i++)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
939 g_free (ve_proc->argv[i]);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
940 g_free (ve_proc->argv);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
941 g_free (ve_proc);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
942 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
943
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
944
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
945 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
946 dont_upload (gftp_viewedit_data * ve_proc, gftp_dialog_data * ddata)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
947 {
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
948 remove_file (ve_proc->filename);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
949 free_edit_data (ve_proc);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
950 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
951
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
952
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
953 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
954 do_upload (gftp_viewedit_data * ve_proc, gftp_dialog_data * ddata)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
955 {
303
3b9d5797050f 2003-11-2 Brian Masney <masneyb@gftp.org>
masneyb
parents: 297
diff changeset
956 gftp_transfer * tdata;
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
957 gftp_file * tempfle;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
958 GList * newfile;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
959
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
960 tempfle = g_malloc0 (sizeof (*tempfle));
294
4747f621b79b 2003-10-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 278
diff changeset
961 tempfle->destfile = gftp_build_path (ve_proc->torequest->directory,
4747f621b79b 2003-10-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 278
diff changeset
962 ve_proc->remote_filename, NULL);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
963 ve_proc->remote_filename = NULL;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
964 tempfle->file = ve_proc->filename;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
965 ve_proc->filename = NULL;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
966 tempfle->done_rm = 1;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
967 newfile = g_list_append (NULL, tempfle);
303
3b9d5797050f 2003-11-2 Brian Masney <masneyb@gftp.org>
masneyb
parents: 297
diff changeset
968 tdata = add_file_transfer (ve_proc->fromwdata->request, ve_proc->torequest,
3b9d5797050f 2003-11-2 Brian Masney <masneyb@gftp.org>
masneyb
parents: 297
diff changeset
969 ve_proc->fromwdata, ve_proc->towdata, newfile, 1);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
970 free_edit_data (ve_proc);
303
3b9d5797050f 2003-11-2 Brian Masney <masneyb@gftp.org>
masneyb
parents: 297
diff changeset
971
3b9d5797050f 2003-11-2 Brian Masney <masneyb@gftp.org>
masneyb
parents: 297
diff changeset
972 if (tdata != NULL)
3b9d5797050f 2003-11-2 Brian Masney <masneyb@gftp.org>
masneyb
parents: 297
diff changeset
973 tdata->conn_error_no_timeout = 1;
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
974 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
975
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
976
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
977 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
978 check_done_process (void)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
979 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
980 gftp_viewedit_data * ve_proc;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
981 GList * curdata, *deldata;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
982 struct stat st;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
983 int ret;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
984 char *str;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
985 pid_t pid;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
986
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
987 viewedit_process_done = 0;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
988 while ((pid = waitpid (-1, &ret, WNOHANG)) > 0)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
989 {
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
990 curdata = viewedit_processes;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
991 while (curdata != NULL)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
992 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
993 ve_proc = curdata->data;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
994 deldata = curdata;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
995 curdata = curdata->next;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
996 if (ve_proc->pid == pid)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
997 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
998 viewedit_processes = g_list_remove_link (viewedit_processes,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
999 deldata);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1000 if (ret != 0)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1001 ftp_log (gftp_logging_error, NULL,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1002 _("Error: Child %d returned %d\n"), pid, ret);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1003 else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1004 ftp_log (gftp_logging_misc, NULL,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1005 _("Child %d returned successfully\n"), pid);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1006
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1007 if (!ve_proc->view && !ve_proc->dontupload)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1008 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1009 /* We was editing the file. Upload it */
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1010 if (stat (ve_proc->filename, &st) == -1)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1011 ftp_log (gftp_logging_error, NULL,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1012 _("Error: Cannot get information about file %s: %s\n"),
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1013 ve_proc->filename, g_strerror (errno));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1014 else if (st.st_mtime == ve_proc->st.st_mtime)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1015 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1016 ftp_log (gftp_logging_misc, NULL,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1017 _("File %s was not changed\n"),
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1018 ve_proc->filename);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1019 remove_file (ve_proc->filename);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1020 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1021 else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1022 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1023 memcpy (&ve_proc->st, &st, sizeof (ve_proc->st));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1024 str = g_strdup_printf (
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1025 _("File %s has changed.\nWould you like to upload it?"),
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1026 ve_proc->remote_filename);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1027
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1028 MakeYesNoDialog (_("Edit File"), str,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1029 do_upload, ve_proc,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1030 dont_upload, ve_proc);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1031 g_free (str);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1032 continue;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1033 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1034 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1035
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1036 free_edit_data (ve_proc);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1037 continue;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1038 }
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1039 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1040 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1041 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1042
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1043
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1044 static void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1045 on_next_transfer (gftp_transfer * tdata)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1046 {
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1047 int fd, refresh_files;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1048 gftp_file * tempfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1049
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1050 tdata->next_file = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1051 for (; tdata->updfle != tdata->curfle; tdata->updfle = tdata->updfle->next)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1052 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1053 tempfle = tdata->updfle->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1054
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1055 if (tempfle->is_fd)
58
c01d91c10f6c 2002-11-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
1056 fd = tempfle->fd;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1057 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1058 fd = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1059
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1060 if (tempfle->done_view)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1061 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1062 if (tempfle->transfer_action != GFTP_TRANS_ACTION_SKIP)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1063 view_file (tempfle->destfile, fd, 1, tempfle->done_rm, 1, 0,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1064 tempfle->file, NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1065
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1066 if (tempfle->is_fd)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1067 {
58
c01d91c10f6c 2002-11-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
1068 close (tempfle->fd);
c01d91c10f6c 2002-11-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
1069 tempfle->fd = -1;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1070 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1071 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1072 else if (tempfle->done_edit)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1073 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1074 if (tempfle->transfer_action != GFTP_TRANS_ACTION_SKIP)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1075 view_file (tempfle->destfile, fd, 0, tempfle->done_rm, 1, 0,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1076 tempfle->file, NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1077
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1078 if (tempfle->is_fd)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1079 {
58
c01d91c10f6c 2002-11-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
1080 close (tempfle->fd);
c01d91c10f6c 2002-11-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
1081 tempfle->fd = -1;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1082 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1083 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1084 else if (tempfle->done_rm)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1085 tdata->fromreq->rmfile (tdata->fromreq, tempfle->file);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1086
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1087 if (tempfle->transfer_action == GFTP_TRANS_ACTION_SKIP)
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1088 gtk_ctree_node_set_text (GTK_CTREE (dlwdw), tempfle->user_data, 1,
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1089 _("Skipped"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1090 else
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1091 gtk_ctree_node_set_text (GTK_CTREE (dlwdw), tempfle->user_data, 1,
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1092 _("Finished"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1093 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1094
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1095 gftp_lookup_request_option (tdata->fromreq, "refresh_files", &refresh_files);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1096
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1097 if (refresh_files && tdata->curfle && tdata->curfle->next &&
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1098 compare_request (tdata->toreq,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1099 ((gftp_window_data *) tdata->towdata)->request, 1))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1100 refresh (tdata->towdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1101 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1102
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1103
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1104 static void
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
1105 get_trans_password (gftp_request * request, gftp_dialog_data * ddata)
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
1106 {
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
1107 gftp_set_password (request, gtk_entry_get_text (GTK_ENTRY (ddata->edit)));
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
1108 request->stopable = 0;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
1109 }
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
1110
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
1111
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
1112 static void
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
1113 cancel_get_trans_password (gftp_transfer * tdata, gftp_dialog_data * ddata)
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
1114 {
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
1115 if (tdata->fromreq->stopable == 0)
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
1116 return;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
1117
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1118 g_static_mutex_lock (&tdata->structmutex);
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
1119 if (tdata->started)
42
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 41
diff changeset
1120 {
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 41
diff changeset
1121 tdata->cancel = 1;
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 41
diff changeset
1122 tdata->fromreq->cancel = 1;
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 41
diff changeset
1123 tdata->toreq->cancel = 1;
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 41
diff changeset
1124 }
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
1125 else
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
1126 tdata->done = 1;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
1127
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
1128 tdata->fromreq->stopable = 0;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
1129 tdata->toreq->stopable = 0;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1130 g_static_mutex_unlock (&tdata->structmutex);
40
66c064fd05bc 2002-10-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 37
diff changeset
1131
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
1132 ftp_log (gftp_logging_misc, NULL, _("Stopping the transfer of %s\n"),
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
1133 ((gftp_file *) tdata->curfle->data)->file);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
1134 }
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
1135
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
1136
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
1137 static void
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1138 show_transfer (gftp_transfer * tdata)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1139 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1140 GdkPixmap * closedir_pixmap, * opendir_pixmap;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1141 GdkBitmap * closedir_bitmap, * opendir_bitmap;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1142 gftp_curtrans_data * transdata;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1143 gftp_file * tempfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1144 char *pos, *text[2];
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1145 GList * templist;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1146
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1147 gftp_get_pixmap (dlwdw, "open_dir.xpm", &opendir_pixmap, &opendir_bitmap);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1148 gftp_get_pixmap (dlwdw, "dir.xpm", &closedir_pixmap, &closedir_bitmap);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1149
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1150 text[0] = tdata->fromreq->hostname;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1151 text[1] = _("Waiting...");
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1152 tdata->user_data = gtk_ctree_insert_node (GTK_CTREE (dlwdw), NULL, NULL,
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1153 text, 5,
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1154 closedir_pixmap, closedir_bitmap,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1155 opendir_pixmap, opendir_bitmap,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1156 FALSE,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1157 tdata->numdirs + tdata->numfiles < 50);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1158 transdata = g_malloc (sizeof (*transdata));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1159 transdata->transfer = tdata;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1160 transdata->curfle = NULL;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1161 gtk_ctree_node_set_row_data (GTK_CTREE (dlwdw), tdata->user_data, transdata);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1162 tdata->show = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1163 tdata->curfle = tdata->updfle = tdata->files;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1164
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1165 tdata->total_bytes = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1166 for (templist = tdata->files; templist != NULL; templist = templist->next)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1167 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1168 tempfle = templist->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1169 if ((pos = strrchr (tempfle->file, '/')) == NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1170 pos = tempfle->file;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1171 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1172 pos++;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1173 text[0] = pos;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1174 if (tempfle->transfer_action == GFTP_TRANS_ACTION_SKIP)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1175 text[1] = _("Skipped");
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1176 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1177 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1178 tdata->total_bytes += tempfle->size;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1179 text[1] = _("Waiting...");
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1180 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1181
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1182 tempfle->user_data = gtk_ctree_insert_node (GTK_CTREE (dlwdw),
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1183 tdata->user_data,
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1184 NULL, text, 5, NULL, NULL, NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1185 NULL, FALSE, FALSE);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1186 transdata = g_malloc (sizeof (*transdata));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1187 transdata->transfer = tdata;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1188 transdata->curfle = templist;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1189 gtk_ctree_node_set_row_data (GTK_CTREE (dlwdw), tempfle->user_data,
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1190 transdata);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1191 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1192
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1193 if (!tdata->toreq->stopable && tdata->toreq->need_userpass &&
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1194 (tdata->toreq->password == NULL || *tdata->toreq->password == '\0'))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1195 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1196 tdata->toreq->stopable = 1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1197 MakeEditDialog (_("Enter Password"),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1198 _("Please enter your password for this site"), NULL, 0,
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
1199 NULL, gftp_dialog_button_connect,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
1200 get_trans_password, tdata->toreq,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
1201 cancel_get_trans_password, tdata);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1202 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1203
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1204 if (!tdata->fromreq->stopable && tdata->fromreq->need_userpass &&
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1205 (tdata->fromreq->password == NULL || *tdata->fromreq->password == '\0'))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1206 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1207 tdata->fromreq->stopable = 1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1208 MakeEditDialog (_("Enter Password"),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1209 _("Please enter your password for this site"), NULL, 0,
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
1210 NULL, gftp_dialog_button_connect,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
1211 get_trans_password, tdata->fromreq,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
1212 cancel_get_trans_password, tdata);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1213 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1214 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1215
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1216
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1217 static void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1218 transfer_done (GList * node)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1219 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1220 gftp_curtrans_data * transdata;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1221 gftp_request * fromreq;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1222 gftp_transfer * tdata;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1223 gftp_file * tempfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1224 GList * templist;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1225
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1226 tdata = node->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1227 if (tdata->started)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1228 {
56
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
1229 fromreq = tdata->fromwdata != NULL ? ((gftp_window_data *) tdata->fromwdata)->request : NULL;
297
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
1230
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
1231 if (GFTP_IS_SAME_HOST_STOP_TRANS ((gftp_window_data *) tdata->fromwdata,
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
1232 tdata->fromreq))
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
1233 {
63
41b71c4e5076 2002-11-2333 Brian Masney <masneyb@gftp.org>
masneyb
parents: 59
diff changeset
1234 gftp_swap_socks (((gftp_window_data *) tdata->fromwdata)->request,
41b71c4e5076 2002-11-2333 Brian Masney <masneyb@gftp.org>
masneyb
parents: 59
diff changeset
1235 tdata->fromreq);
297
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
1236 refresh (tdata->fromwdata);
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
1237 }
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1238 else
297
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
1239 gftp_disconnect (tdata->fromreq);
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
1240
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
1241 if (GFTP_IS_SAME_HOST_STOP_TRANS ((gftp_window_data *) tdata->towdata,
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
1242 tdata->toreq))
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1243 {
297
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
1244 gftp_swap_socks (((gftp_window_data *) tdata->towdata)->request,
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
1245 tdata->toreq);
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
1246 refresh (tdata->towdata);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1247 }
297
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
1248 else
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
1249 gftp_disconnect (tdata->toreq);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1250
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1251 num_transfers_in_progress--;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1252 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1253
2
a171df6764a7 * Fixed crash if you was already transfering a file, and you started another
masneyb
parents: 1
diff changeset
1254 if (!tdata->show && tdata->started)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1255 {
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1256 transdata = gtk_ctree_node_get_row_data (GTK_CTREE (dlwdw),
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1257 tdata->user_data);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1258 if (transdata != NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1259 g_free (transdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1260
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1261 for (templist = tdata->files; templist != NULL; templist = templist->next)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1262 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1263 tempfle = templist->data;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1264 transdata = gtk_ctree_node_get_row_data (GTK_CTREE (dlwdw),
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1265 tempfle->user_data);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1266 if (transdata != NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1267 g_free (transdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1268 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1269
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1270 gtk_ctree_remove_node (GTK_CTREE (dlwdw), tdata->user_data);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1271 }
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1272
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1273 pthread_mutex_lock (&transfer_mutex);
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1274 gftp_file_transfers = g_list_remove_link (gftp_file_transfers, node);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1275 pthread_mutex_unlock (&transfer_mutex);
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1276
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1277 free_tdata (tdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1278 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1279
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1280
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1281 static void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1282 create_transfer (gftp_transfer * tdata)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1283 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1284 pthread_t tid;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1285
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1286 if (!tdata->fromreq->stopable)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1287 {
297
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
1288 if (GFTP_IS_SAME_HOST_START_TRANS ((gftp_window_data *) tdata->fromwdata,
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
1289 tdata->fromreq))
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
1290 {
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
1291 gftp_swap_socks (tdata->fromreq,
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
1292 ((gftp_window_data *) tdata->fromwdata)->request);
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
1293 update_window (tdata->fromwdata);
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
1294 }
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
1295
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
1296 if (GFTP_IS_SAME_HOST_START_TRANS ((gftp_window_data *) tdata->towdata,
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
1297 tdata->toreq))
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
1298 {
63
41b71c4e5076 2002-11-2333 Brian Masney <masneyb@gftp.org>
masneyb
parents: 59
diff changeset
1299 gftp_swap_socks (tdata->toreq,
41b71c4e5076 2002-11-2333 Brian Masney <masneyb@gftp.org>
masneyb
parents: 59
diff changeset
1300 ((gftp_window_data *) tdata->towdata)->request);
297
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
1301 update_window (tdata->towdata);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1302 }
297
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
1303
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1304 num_transfers_in_progress++;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1305 tdata->started = 1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1306 tdata->stalled = 1;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1307 gtk_ctree_node_set_text (GTK_CTREE (dlwdw), tdata->user_data, 1,
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1308 _("Connecting..."));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1309 pthread_create (&tid, NULL, gftp_gtk_transfer_files, tdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1310 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1311 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1312
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1313
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1314 static void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1315 update_file_status (gftp_transfer * tdata)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1316 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1317 char totstr[100], dlstr[100], gotstr[50], ofstr[50];
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1318 int hours, mins, secs, pcent, st;
246
290d00853950 2003-8-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 234
diff changeset
1319 unsigned long remaining_secs, lkbs;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1320 gftp_file * tempfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1321 struct timeval tv;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1322
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1323 g_static_mutex_lock (&tdata->statmutex);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1324 tempfle = tdata->curfle->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1325
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1326 gettimeofday (&tv, NULL);
220
6de9a8280aa4 2003-7-10 Brian Masney <masneyb@gftp.org>
masneyb
parents: 207
diff changeset
1327
6de9a8280aa4 2003-7-10 Brian Masney <masneyb@gftp.org>
masneyb
parents: 207
diff changeset
1328 remaining_secs = (tdata->total_bytes - tdata->trans_bytes - tdata->resumed_bytes) / 1024;
246
290d00853950 2003-8-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 234
diff changeset
1329
290d00853950 2003-8-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 234
diff changeset
1330 lkbs = (unsigned long) tdata->kbs;
290d00853950 2003-8-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 234
diff changeset
1331 if (lkbs > 0)
290d00853950 2003-8-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 234
diff changeset
1332 remaining_secs /= lkbs;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1333
220
6de9a8280aa4 2003-7-10 Brian Masney <masneyb@gftp.org>
masneyb
parents: 207
diff changeset
1334 hours = remaining_secs / 3600;
6de9a8280aa4 2003-7-10 Brian Masney <masneyb@gftp.org>
masneyb
parents: 207
diff changeset
1335 remaining_secs -= hours * 3600;
6de9a8280aa4 2003-7-10 Brian Masney <masneyb@gftp.org>
masneyb
parents: 207
diff changeset
1336 mins = remaining_secs / 60;
6de9a8280aa4 2003-7-10 Brian Masney <masneyb@gftp.org>
masneyb
parents: 207
diff changeset
1337 remaining_secs -= mins * 60;
6de9a8280aa4 2003-7-10 Brian Masney <masneyb@gftp.org>
masneyb
parents: 207
diff changeset
1338 secs = remaining_secs;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1339
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1340 if (hours < 0 || mins < 0 || secs < 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1341 {
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1342 g_static_mutex_unlock (&tdata->statmutex);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1343 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1344 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1345
246
290d00853950 2003-8-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 234
diff changeset
1346 if ((double) tdata->total_bytes > 0)
290d00853950 2003-8-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 234
diff changeset
1347 pcent = (int) ((double) (tdata->trans_bytes + tdata->resumed_bytes) / (double) tdata->total_bytes * 100.0);
290d00853950 2003-8-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 234
diff changeset
1348 else
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1349 pcent = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1350
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1351 g_snprintf (totstr, sizeof (totstr),
14
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 7
diff changeset
1352 _("%d%% complete, %02d:%02d:%02d est. time remaining. (File %ld of %ld)"),
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1353 pcent, hours, mins, secs, tdata->current_file_number,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1354 tdata->numdirs + tdata->numfiles);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1355
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1356 *dlstr = '\0';
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1357 if (!tdata->stalled)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1358 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1359 insert_commas (tdata->curtrans + tdata->curresumed, gotstr, sizeof (gotstr));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1360 insert_commas (tempfle->size, ofstr, sizeof (ofstr));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1361 st = 1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1362 if (tv.tv_sec - tdata->lasttime.tv_sec <= 5)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1363 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1364 if (tdata->curfle->next != NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1365 {
220
6de9a8280aa4 2003-7-10 Brian Masney <masneyb@gftp.org>
masneyb
parents: 207
diff changeset
1366 remaining_secs = (tempfle->size - tdata->curtrans - tdata->curresumed) / 1024;
246
290d00853950 2003-8-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 234
diff changeset
1367
290d00853950 2003-8-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 234
diff changeset
1368 lkbs = (unsigned long) tdata->kbs;
290d00853950 2003-8-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 234
diff changeset
1369 if (lkbs > 0)
290d00853950 2003-8-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 234
diff changeset
1370 remaining_secs /= lkbs;
220
6de9a8280aa4 2003-7-10 Brian Masney <masneyb@gftp.org>
masneyb
parents: 207
diff changeset
1371
6de9a8280aa4 2003-7-10 Brian Masney <masneyb@gftp.org>
masneyb
parents: 207
diff changeset
1372 hours = remaining_secs / 3600;
6de9a8280aa4 2003-7-10 Brian Masney <masneyb@gftp.org>
masneyb
parents: 207
diff changeset
1373 remaining_secs -= hours * 3600;
6de9a8280aa4 2003-7-10 Brian Masney <masneyb@gftp.org>
masneyb
parents: 207
diff changeset
1374 mins = remaining_secs / 60;
6de9a8280aa4 2003-7-10 Brian Masney <masneyb@gftp.org>
masneyb
parents: 207
diff changeset
1375 remaining_secs -= mins * 60;
6de9a8280aa4 2003-7-10 Brian Masney <masneyb@gftp.org>
masneyb
parents: 207
diff changeset
1376 secs = remaining_secs;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1377 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1378
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1379 if (!(hours < 0 || mins < 0 || secs < 0))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1380 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1381 g_snprintf (dlstr, sizeof (dlstr),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1382 _("Recv %s of %s at %.2fKB/s, %02d:%02d:%02d est. time remaining"), gotstr, ofstr, tdata->kbs, hours, mins, secs);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1383 st = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1384 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1385 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1386
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1387 if (st)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1388 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1389 tdata->stalled = 1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1390 g_snprintf (dlstr, sizeof (dlstr),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1391 _("Recv %s of %s, transfer stalled, unknown time remaining"),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1392 gotstr, ofstr);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1393 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1394 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1395
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1396 g_static_mutex_unlock (&tdata->statmutex);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1397
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1398 gtk_ctree_node_set_text (GTK_CTREE (dlwdw), tdata->user_data, 1, totstr);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1399
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1400 if (*dlstr != '\0')
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1401 gtk_ctree_node_set_text (GTK_CTREE (dlwdw), tempfle->user_data, 1, dlstr);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1402 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1403
56
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
1404 static void
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
1405 update_window_transfer_bytes (gftp_window_data * wdata)
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
1406 {
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
1407 char *tempstr, *temp1str;
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
1408
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
1409 if (wdata->request->gotbytes == -1)
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
1410 {
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
1411 update_window_info ();
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
1412 wdata->request->gotbytes = 0;
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
1413 }
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
1414 else
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
1415 {
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
1416 tempstr = insert_commas (wdata->request->gotbytes, NULL, 0);
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
1417 temp1str = g_strdup_printf (_("Retrieving file names...%s bytes"),
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
1418 tempstr);
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
1419 gtk_label_set (GTK_LABEL (wdata->hoststxt), temp1str);
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
1420 g_free (tempstr);
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
1421 g_free (temp1str);
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
1422 }
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
1423 }
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
1424
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1425
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1426 gint
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1427 update_downloads (gpointer data)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1428 {
207
cf4098008615 2003-7-1 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1429 int do_one_transfer_at_a_time;
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1430 GList * templist, * next;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1431 gftp_transfer * tdata;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1432
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1433 if (gftp_file_transfer_logs != NULL)
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1434 display_cached_logs ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1435
56
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
1436 if (window1.request->gotbytes != 0)
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
1437 update_window_transfer_bytes (&window1);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1438 if (window2.request->gotbytes != 0)
56
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
1439 update_window_transfer_bytes (&window2);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1440
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1441 if (viewedit_process_done)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1442 check_done_process ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1443
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1444 for (templist = gftp_file_transfers; templist != NULL;)
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1445 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1446 tdata = templist->data;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1447 if (tdata->ready)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1448 {
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1449 g_static_mutex_lock (&tdata->structmutex);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1450
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1451 if (tdata->next_file)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1452 on_next_transfer (tdata);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1453 else if (tdata->show)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1454 show_transfer (tdata);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1455 else if (tdata->done)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1456 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1457 next = templist->next;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1458 g_static_mutex_unlock (&tdata->structmutex);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1459 transfer_done (templist);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1460 templist = next;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1461 continue;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1462 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1463
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1464 if (tdata->curfle != NULL)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1465 {
151
2f15b3000dbc 2003-4-27 Brian Masney <masneyb@gftp.org>
masneyb
parents: 143
diff changeset
1466 gftp_lookup_global_option ("one_transfer",
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1467 &do_one_transfer_at_a_time);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1468
207
cf4098008615 2003-7-1 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1469 if (!tdata->started &&
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1470 (num_transfers_in_progress == 0 || !do_one_transfer_at_a_time))
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1471 create_transfer (tdata);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1472
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1473 if (tdata->started)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1474 update_file_status (tdata);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1475 }
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1476 g_static_mutex_unlock (&tdata->structmutex);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1477 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1478 templist = templist->next;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1479 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1480
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1481 gtk_timeout_add (500, update_downloads, NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1482 return (0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1483 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1484
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1485
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1486 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1487 start_transfer (gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1488 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1489 gftp_curtrans_data * transdata;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1490 GtkCTreeNode * node;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1491
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1492 if (GTK_CLIST (dlwdw)->selection == NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1493 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1494 ftp_log (gftp_logging_misc, NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1495 _("There are no file transfers selected\n"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1496 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1497 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1498 node = GTK_CLIST (dlwdw)->selection->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1499 transdata = gtk_ctree_node_get_row_data (GTK_CTREE (dlwdw), node);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1500
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1501 g_static_mutex_lock (&transdata->transfer->structmutex);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1502 if (!transdata->transfer->started)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1503 create_transfer (transdata->transfer);
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1504 g_static_mutex_unlock (&transdata->transfer->structmutex);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1505 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1506
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1507
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1508 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1509 stop_transfer (gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1510 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1511 gftp_curtrans_data * transdata;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1512 GtkCTreeNode * node;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1513
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1514 if (GTK_CLIST (dlwdw)->selection == NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1515 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1516 ftp_log (gftp_logging_misc, NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1517 _("There are no file transfers selected\n"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1518 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1519 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1520 node = GTK_CLIST (dlwdw)->selection->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1521 transdata = gtk_ctree_node_get_row_data (GTK_CTREE (dlwdw), node);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1522
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1523 g_static_mutex_lock (&transdata->transfer->structmutex);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1524 if (transdata->transfer->started)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1525 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1526 transdata->transfer->cancel = 1;
42
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 41
diff changeset
1527 transdata->transfer->fromreq->cancel = 1;
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 41
diff changeset
1528 transdata->transfer->toreq->cancel = 1;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1529 transdata->transfer->skip_file = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1530 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1531 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1532 transdata->transfer->done = 1;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1533 g_static_mutex_unlock (&transdata->transfer->structmutex);
40
66c064fd05bc 2002-10-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 37
diff changeset
1534
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1535 ftp_log (gftp_logging_misc, NULL, _("Stopping the transfer on host %s\n"),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1536 transdata->transfer->fromreq->hostname);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1537 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1538
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1539
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1540 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1541 skip_transfer (gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1542 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1543 gftp_curtrans_data * transdata;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1544 GtkCTreeNode * node;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1545 gftp_file * curfle;
40
66c064fd05bc 2002-10-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 37
diff changeset
1546 char *file;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1547
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1548 if (GTK_CLIST (dlwdw)->selection == NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1549 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1550 ftp_log (gftp_logging_misc, NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1551 _("There are no file transfers selected\n"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1552 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1553 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1554 node = GTK_CLIST (dlwdw)->selection->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1555 transdata = gtk_ctree_node_get_row_data (GTK_CTREE (dlwdw), node);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1556
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1557 g_static_mutex_lock (&transdata->transfer->structmutex);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1558 if (transdata->transfer->curfle != NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1559 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1560 curfle = transdata->transfer->curfle->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1561 if (transdata->transfer->started)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1562 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1563 transdata->transfer->cancel = 1;
42
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 41
diff changeset
1564 transdata->transfer->fromreq->cancel = 1;
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 41
diff changeset
1565 transdata->transfer->toreq->cancel = 1;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1566 transdata->transfer->skip_file = 1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1567 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1568
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1569 curfle->transfer_action = GFTP_TRANS_ACTION_SKIP;
40
66c064fd05bc 2002-10-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 37
diff changeset
1570 file = curfle->file;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1571 }
40
66c064fd05bc 2002-10-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 37
diff changeset
1572 else
66c064fd05bc 2002-10-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 37
diff changeset
1573 file = NULL;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1574 g_static_mutex_unlock (&transdata->transfer->structmutex);
40
66c064fd05bc 2002-10-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 37
diff changeset
1575
66c064fd05bc 2002-10-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 37
diff changeset
1576 ftp_log (gftp_logging_misc, NULL, _("Skipping file %s on host %s\n"),
66c064fd05bc 2002-10-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 37
diff changeset
1577 file, transdata->transfer->fromreq->hostname);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1578 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1579
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1580
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1581 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1582 remove_file_transfer (gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1583 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1584 gftp_curtrans_data * transdata;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1585 GtkCTreeNode * node;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1586 gftp_file * curfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1587
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1588 if (GTK_CLIST (dlwdw)->selection == NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1589 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1590 ftp_log (gftp_logging_misc, NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1591 _("There are no file transfers selected\n"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1592 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1593 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1594
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1595 node = GTK_CLIST (dlwdw)->selection->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1596 transdata = gtk_ctree_node_get_row_data (GTK_CTREE (dlwdw), node);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1597
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1598
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1599 if (transdata->curfle == NULL || transdata->curfle->data == NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1600 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1601
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1602 curfle = transdata->curfle->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1603
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1604 if (curfle->transfer_action & GFTP_TRANS_ACTION_SKIP)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1605 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1606
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1607 g_static_mutex_lock (&transdata->transfer->structmutex);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1608
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1609 curfle->transfer_action = GFTP_TRANS_ACTION_SKIP;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1610
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1611 if (transdata->transfer->started &&
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1612 transdata->curfle == transdata->transfer->curfle)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1613 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1614 transdata->transfer->cancel = 1;
42
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 41
diff changeset
1615 transdata->transfer->fromreq->cancel = 1;
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 41
diff changeset
1616 transdata->transfer->toreq->cancel = 1;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1617 transdata->transfer->skip_file = 1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1618 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1619 else if (transdata->curfle != transdata->transfer->curfle &&
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1620 !curfle->transfer_done)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1621 {
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1622 gtk_ctree_node_set_text (GTK_CTREE (dlwdw), curfle->user_data, 1,
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1623 _("Skipped"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1624 transdata->transfer->total_bytes -= curfle->size;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1625 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1626
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1627 g_static_mutex_unlock (&transdata->transfer->structmutex);
40
66c064fd05bc 2002-10-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 37
diff changeset
1628
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1629 ftp_log (gftp_logging_misc, NULL, _("Skipping file %s on host %s\n"),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1630 curfle->file, transdata->transfer->fromreq->hostname);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1631 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1632
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1633
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1634 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1635 move_transfer_up (gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1636 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1637 GList * firstentry, * secentry, * lastentry;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1638 gftp_curtrans_data * transdata;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1639 GtkCTreeNode * node;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1640
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1641 if (GTK_CLIST (dlwdw)->selection == NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1642 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1643 ftp_log (gftp_logging_misc, NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1644 _("There are no file transfers selected\n"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1645 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1646 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1647 node = GTK_CLIST (dlwdw)->selection->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1648 transdata = gtk_ctree_node_get_row_data (GTK_CTREE (dlwdw), node);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1649
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1650 if (transdata->curfle == NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1651 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1652
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1653 g_static_mutex_lock (&transdata->transfer->structmutex);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1654 if (transdata->curfle->prev != NULL && (!transdata->transfer->started ||
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1655 (transdata->transfer->curfle != transdata->curfle &&
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1656 transdata->transfer->curfle != transdata->curfle->prev)))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1657 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1658 if (transdata->curfle->prev->prev == NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1659 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1660 firstentry = transdata->curfle->prev;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1661 lastentry = transdata->curfle->next;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1662 transdata->transfer->files = transdata->curfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1663 transdata->curfle->next = firstentry;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1664 transdata->transfer->files->prev = NULL;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1665 firstentry->prev = transdata->curfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1666 firstentry->next = lastentry;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1667 if (lastentry != NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1668 lastentry->prev = firstentry;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1669 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1670 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1671 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1672 firstentry = transdata->curfle->prev->prev;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1673 secentry = transdata->curfle->prev;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1674 lastentry = transdata->curfle->next;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1675 firstentry->next = transdata->curfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1676 transdata->curfle->prev = firstentry;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1677 transdata->curfle->next = secentry;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1678 secentry->prev = transdata->curfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1679 secentry->next = lastentry;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1680 if (lastentry != NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1681 lastentry->prev = secentry;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1682 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1683
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1684 gtk_ctree_move (GTK_CTREE (dlwdw),
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1685 ((gftp_file *) transdata->curfle->data)->user_data,
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1686 transdata->transfer->user_data,
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1687 transdata->curfle->next != NULL ?
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1688 ((gftp_file *) transdata->curfle->next->data)->user_data: NULL);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1689 }
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1690 g_static_mutex_unlock (&transdata->transfer->structmutex);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1691 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1692
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1693 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1694 move_transfer_down (gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1695 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1696 GList * firstentry, * secentry, * lastentry;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1697 gftp_curtrans_data * transdata;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1698 GtkCTreeNode * node;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1699
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1700 if (GTK_CLIST (dlwdw)->selection == NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1701 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1702 ftp_log (gftp_logging_misc, NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1703 _("There are no file transfers selected\n"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1704 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1705 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1706 node = GTK_CLIST (dlwdw)->selection->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1707 transdata = gtk_ctree_node_get_row_data (GTK_CTREE (dlwdw), node);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1708
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1709 if (transdata->curfle == NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1710 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1711
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1712 g_static_mutex_lock (&transdata->transfer->structmutex);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1713 if (transdata->curfle->next != NULL && (!transdata->transfer->started ||
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1714 (transdata->transfer->curfle != transdata->curfle &&
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1715 transdata->transfer->curfle != transdata->curfle->next)))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1716 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1717 if (transdata->curfle->prev == NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1718 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1719 firstentry = transdata->curfle->next;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1720 lastentry = transdata->curfle->next->next;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1721 transdata->transfer->files = firstentry;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1722 transdata->transfer->files->prev = NULL;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1723 transdata->transfer->files->next = transdata->curfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1724 transdata->curfle->prev = transdata->transfer->files;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1725 transdata->curfle->next = lastentry;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1726 if (lastentry != NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1727 lastentry->prev = transdata->curfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1728 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1729 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1730 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1731 firstentry = transdata->curfle->prev;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1732 secentry = transdata->curfle->next;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1733 lastentry = transdata->curfle->next->next;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1734 firstentry->next = secentry;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1735 secentry->prev = firstentry;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1736 secentry->next = transdata->curfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1737 transdata->curfle->prev = secentry;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1738 transdata->curfle->next = lastentry;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1739 if (lastentry != NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1740 lastentry->prev = transdata->curfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1741 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1742
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1743 gtk_ctree_move (GTK_CTREE (dlwdw),
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1744 ((gftp_file *) transdata->curfle->data)->user_data,
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1745 transdata->transfer->user_data,
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1746 transdata->curfle->next != NULL ?
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1747 ((gftp_file *) transdata->curfle->next->data)->user_data: NULL);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1748 }
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1749 g_static_mutex_unlock (&transdata->transfer->structmutex);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1750 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1751
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1752
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1753 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1754 trans_selectall (GtkWidget * widget, gpointer data)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1755 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1756 gftp_transfer * tdata;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1757 tdata = data;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1758
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1759 gtk_clist_select_all (GTK_CLIST (tdata->clist));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1760 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1761
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1762
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1763 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1764 trans_unselectall (GtkWidget * widget, gpointer data)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1765 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1766 gftp_transfer * tdata;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1767 tdata = data;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1768
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1769 gtk_clist_unselect_all (GTK_CLIST (tdata->clist));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1770 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1771
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1772
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1773 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1774 overwrite (GtkWidget * widget, gpointer data)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1775 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1776 GList * templist, * filelist;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1777 gftp_transfer * tdata;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1778 gftp_file * tempfle;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1779 int curpos;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1780
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1781 tdata = data;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1782 curpos = 0;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1783 filelist = tdata->files;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1784 templist = GTK_CLIST (tdata->clist)->selection;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1785 while (templist != NULL)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1786 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1787 templist = get_next_selection (templist, &filelist, &curpos);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1788 tempfle = filelist->data;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1789 tempfle->transfer_action = GFTP_TRANS_ACTION_OVERWRITE;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1790 gtk_clist_set_text (GTK_CLIST (tdata->clist), curpos, 3, _("Overwrite"));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1791 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1792 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1793
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1794
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1795 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1796 resume (GtkWidget * widget, gpointer data)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1797 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1798 GList * templist, * filelist;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1799 gftp_transfer * tdata;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1800 gftp_file * tempfle;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1801 int curpos;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1802
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1803 tdata = data;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1804 curpos = 0;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1805 filelist = tdata->files;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1806 templist = GTK_CLIST (tdata->clist)->selection;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1807 while (templist != NULL)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1808 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1809 templist = get_next_selection (templist, &filelist, &curpos);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1810 tempfle = filelist->data;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1811 tempfle->transfer_action = GFTP_TRANS_ACTION_RESUME;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1812 gtk_clist_set_text (GTK_CLIST (tdata->clist), curpos, 3, _("Resume"));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1813 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1814 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1815
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1816
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1817 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1818 skip (GtkWidget * widget, gpointer data)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1819 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1820 GList * templist, * filelist;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1821 gftp_transfer * tdata;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1822 gftp_file * tempfle;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1823 int curpos;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1824
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1825 tdata = data;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1826 curpos = 0;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1827 filelist = tdata->files;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1828 templist = GTK_CLIST (tdata->clist)->selection;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1829 while (templist != NULL)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1830 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1831 templist = get_next_selection (templist, &filelist, &curpos);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1832 tempfle = filelist->data;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1833 tempfle->transfer_action = GFTP_TRANS_ACTION_SKIP;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1834 gtk_clist_set_text (GTK_CLIST (tdata->clist), curpos, 3, _("Skip"));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1835 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1836 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1837
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1838
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1839 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1840 ok (GtkWidget * widget, gpointer data)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1841 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1842 gftp_transfer * tdata;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1843 gftp_file * tempfle;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1844 GList * templist;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1845
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1846 tdata = data;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1847 g_static_mutex_lock (&tdata->structmutex);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1848 for (templist = tdata->files; templist != NULL; templist = templist->next)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1849 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1850 tempfle = templist->data;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1851 if (tempfle->transfer_action != GFTP_TRANS_ACTION_SKIP)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1852 break;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1853 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1854
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1855 if (templist == NULL)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1856 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1857 tdata->show = 0;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1858 tdata->ready = tdata->done = 1;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1859 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1860 else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1861 tdata->show = tdata->ready = 1;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1862 g_static_mutex_unlock (&tdata->structmutex);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1863 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1864
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1865
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1866 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1867 cancel (GtkWidget * widget, gpointer data)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1868 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1869 gftp_transfer * tdata;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1870
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1871 tdata = data;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1872 g_static_mutex_lock (&tdata->structmutex);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1873 tdata->show = 0;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1874 tdata->done = tdata->ready = 1;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1875 g_static_mutex_unlock (&tdata->structmutex);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1876 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1877
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1878
49
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1879 #if GTK_MAJOR_VERSION > 1
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1880 static void
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1881 transfer_action (GtkWidget * widget, gint response, gpointer user_data)
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1882 {
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1883 switch (response)
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1884 {
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1885 case GTK_RESPONSE_OK:
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1886 ok (widget, user_data);
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1887 gtk_widget_destroy (widget);
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1888 break;
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1889 case GTK_RESPONSE_CANCEL:
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1890 cancel (widget, user_data);
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1891 /* no break */
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1892 default:
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1893 gtk_widget_destroy (widget);
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1894 }
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1895 }
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1896 #endif
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1897
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1898
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1899 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1900 gftp_gtk_ask_transfer (gftp_transfer * tdata)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1901 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1902 char *dltitles[4], *add_data[4] = { NULL, NULL, NULL, NULL },
49
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1903 tempstr[50], temp1str[50], *pos, *title;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1904 GtkWidget * tempwid, * scroll, * hbox;
234
251845fc1ef1 2003-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 220
diff changeset
1905 int i, overwrite_default;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1906 gftp_file * tempfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1907 GList * templist;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1908 size_t len;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1909
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1910 dltitles[0] = _("Filename");
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1911 dltitles[1] = _("Local Size");
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1912 dltitles[2] = _("Remote Size");
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1913 dltitles[3] = _("Action");
49
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1914 title = tdata->transfer_direction == GFTP_DIRECTION_DOWNLOAD ?
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1915 _("Download Files") : _("Upload Files");
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1916
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1917 #if GTK_MAJOR_VERSION == 1
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1918 dialog = gtk_dialog_new ();
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1919 gtk_grab_add (dialog);
49
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1920 gtk_window_set_title (GTK_WINDOW (dialog), title);
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1921 gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 5);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1922 gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->action_area), 35);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1923 gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dialog)->action_area), TRUE);
49
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1924
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1925 gtk_signal_connect_object (GTK_OBJECT (dialog), "delete_event",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1926 GTK_SIGNAL_FUNC (gtk_widget_destroy),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1927 GTK_OBJECT (dialog));
49
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1928 #else
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1929 dialog = gtk_dialog_new_with_buttons (title, NULL, 0,
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1930 GTK_STOCK_OK,
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1931 GTK_RESPONSE_OK,
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1932 GTK_STOCK_CANCEL,
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1933 GTK_RESPONSE_CANCEL,
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1934 NULL);
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1935 #endif
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1936 gtk_window_set_wmclass (GTK_WINDOW(dialog), "transfer", "gFTP");
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1937 gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1938 gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 10);
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
1939 gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 5);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1940
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1941 tempwid = gtk_label_new (_("The following file(s) exist on both the local and remote computer\nPlease select what you would like to do"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1942 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), tempwid, FALSE,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1943 FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1944 gtk_widget_show (tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1945
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1946 scroll = gtk_scrolled_window_new (NULL, NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1947 gtk_widget_set_size_request (scroll, 450, 200);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1948
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1949 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1950 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1951 tdata->clist = gtk_clist_new_with_titles (4, dltitles);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1952 gtk_container_add (GTK_CONTAINER (scroll), tdata->clist);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1953
45
311e29c40ed6 2002-10-31 Brian Masney <masneyb@gftp.org>
masneyb
parents: 43
diff changeset
1954 #if GTK_MAJOR_VERSION == 1
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1955 gtk_clist_set_selection_mode (GTK_CLIST (tdata->clist),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1956 GTK_SELECTION_EXTENDED);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1957 #else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1958 gtk_clist_set_selection_mode (GTK_CLIST (tdata->clist),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1959 GTK_SELECTION_MULTIPLE);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1960 #endif
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1961 gtk_clist_set_column_width (GTK_CLIST (tdata->clist), 0, 100);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1962 gtk_clist_set_column_justification (GTK_CLIST (tdata->clist), 1,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1963 GTK_JUSTIFY_RIGHT);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1964 gtk_clist_set_column_width (GTK_CLIST (tdata->clist), 1, 85);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1965 gtk_clist_set_column_justification (GTK_CLIST (tdata->clist), 2,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1966 GTK_JUSTIFY_RIGHT);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1967 gtk_clist_set_column_width (GTK_CLIST (tdata->clist), 2, 85);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1968 gtk_clist_set_column_width (GTK_CLIST (tdata->clist), 3, 85);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1969 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), scroll, TRUE, TRUE,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1970 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1971 gtk_widget_show (tdata->clist);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1972 gtk_widget_show (scroll);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1973
234
251845fc1ef1 2003-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 220
diff changeset
1974 gftp_lookup_request_option (tdata->fromreq, "overwrite_default",
251845fc1ef1 2003-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 220
diff changeset
1975 &overwrite_default);
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1976
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1977 for (templist = tdata->files; templist != NULL;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1978 templist = templist->next)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1979 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1980 tempfle = templist->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1981 if (tempfle->startsize == 0 || tempfle->isdir)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1982 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1983 tempfle->shown = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1984 continue;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1985 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1986 tempfle->shown = 1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1987
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1988 pos = tempfle->destfile;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1989 len = strlen (tdata->toreq->directory);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1990 if (strncmp (pos, tdata->toreq->directory, len) == 0)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1991 pos = tempfle->destfile + len + 1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1992 add_data[0] = pos;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1993
234
251845fc1ef1 2003-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 220
diff changeset
1994 if (overwrite_default)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1995 add_data[3] = _("Overwrite");
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1996 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1997 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1998 if (tempfle->startsize >= tempfle->size)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1999 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2000 add_data[3] = _("Skip");
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2001 tempfle->transfer_action = GFTP_TRANS_ACTION_SKIP;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2002 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2003 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2004 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2005 add_data[3] = _("Resume");
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2006 tempfle->transfer_action = GFTP_TRANS_ACTION_RESUME;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2007 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2008 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2009
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2010 if (tdata->transfer_direction == GFTP_DIRECTION_DOWNLOAD)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2011 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2012 add_data[2] = insert_commas (tempfle->size, tempstr,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2013 sizeof (tempstr));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2014 add_data[1] = insert_commas (tempfle->startsize, temp1str,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2015 sizeof (temp1str));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2016 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2017 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2018 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2019 add_data[1] = insert_commas (tempfle->size, tempstr,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2020 sizeof (tempstr));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2021 add_data[2] = insert_commas (tempfle->startsize, temp1str,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2022 sizeof (temp1str));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2023 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2024 i = gtk_clist_append (GTK_CLIST (tdata->clist), add_data);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2025 gtk_clist_set_row_data (GTK_CLIST (tdata->clist), i, tempfle);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2026 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2027
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2028 gtk_clist_select_all (GTK_CLIST (tdata->clist));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2029
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2030 hbox = gtk_hbox_new (TRUE, 20);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2031 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, TRUE, TRUE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2032 gtk_widget_show (hbox);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2033
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2034 tempwid = gtk_button_new_with_label (_("Overwrite"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2035 gtk_box_pack_start (GTK_BOX (hbox), tempwid, TRUE, TRUE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2036 gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2037 GTK_SIGNAL_FUNC (overwrite), (gpointer) tdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2038 gtk_widget_show (tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2039
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2040 tempwid = gtk_button_new_with_label (_("Resume"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2041 gtk_box_pack_start (GTK_BOX (hbox), tempwid, TRUE, TRUE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2042 gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2043 GTK_SIGNAL_FUNC (resume), (gpointer) tdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2044 gtk_widget_show (tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2045
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2046 tempwid = gtk_button_new_with_label (_("Skip File"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2047 gtk_box_pack_start (GTK_BOX (hbox), tempwid, TRUE, TRUE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2048 gtk_signal_connect (GTK_OBJECT (tempwid), "clicked", GTK_SIGNAL_FUNC (skip),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2049 (gpointer) tdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2050 gtk_widget_show (tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2051
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2052 hbox = gtk_hbox_new (TRUE, 20);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2053 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, TRUE, TRUE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2054 gtk_widget_show (hbox);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2055
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2056 tempwid = gtk_button_new_with_label (_("Select All"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2057 gtk_box_pack_start (GTK_BOX (hbox), tempwid, TRUE, TRUE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2058 gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2059 GTK_SIGNAL_FUNC (trans_selectall), (gpointer) tdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2060 gtk_widget_show (tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2061
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2062 tempwid = gtk_button_new_with_label (_("Deselect All"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2063 gtk_box_pack_start (GTK_BOX (hbox), tempwid, TRUE, TRUE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2064 gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2065 GTK_SIGNAL_FUNC (trans_unselectall), (gpointer) tdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2066 gtk_widget_show (tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2067
49
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
2068 #if GTK_MAJOR_VERSION == 1
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2069 tempwid = gtk_button_new_with_label (_("OK"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2070 GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2071 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), tempwid,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2072 TRUE, TRUE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2073 gtk_signal_connect (GTK_OBJECT (tempwid), "clicked", GTK_SIGNAL_FUNC (ok),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2074 (gpointer) tdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2075 gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2076 GTK_SIGNAL_FUNC (gtk_widget_destroy),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2077 GTK_OBJECT (dialog));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2078 gtk_widget_grab_default (tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2079 gtk_widget_show (tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2080
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2081 tempwid = gtk_button_new_with_label (_(" Cancel "));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2082 GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2083 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), tempwid,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2084 TRUE, TRUE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2085 gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2086 GTK_SIGNAL_FUNC (cancel), (gpointer) tdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2087 gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2088 GTK_SIGNAL_FUNC (gtk_widget_destroy),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2089 GTK_OBJECT (dialog));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2090 gtk_widget_show (tempwid);
49
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
2091 #else
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
2092 g_signal_connect (GTK_OBJECT (dialog), "response",
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
2093 G_CALLBACK (transfer_action), (gpointer) tdata);
0fec02fb9e54 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 48
diff changeset
2094 #endif
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2095
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2096 gtk_widget_show (dialog);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2097 dialog = NULL;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2098 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2099