annotate src/gtk/transfer.c @ 767:49cfbe02926b

2006-7-13 Brian Masney <masneyb@gftp.org> * src/gtk/bookmarks.c src/gtk/delete_dialog.c src/gtk/dnd.c src/gtk/gftp-gtk.c src/gtk/gftp-gtk.h src/gtk/gtkui.c src/gtk/menu-items.c src/gtk/misc-gtk.c src/gtk/options_dialog.c src/gtk/transfer.c src/gtk/view_dialog.c - fixed a few minor warnings from splint.
author masneyb
date Fri, 14 Jul 2006 01:53:42 +0000
parents 11b85ac0ec15
children eeb471438232
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
518
c6a6e908dbaf 2004-7-27 Brian Masney <masneyb@gftp.org>
masneyb
parents: 517
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
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
23 static int num_transfers_in_progress = 0;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
24
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
25 int
496
937f2b75bbee 2004-7-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 470
diff changeset
26 ftp_list_files (gftp_window_data * wdata)
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
27 {
355
60d3da6ab336 2003-1-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 341
diff changeset
28 gftpui_callback_data * cdata;
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
29
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
30 gtk_label_set (GTK_LABEL (wdata->hoststxt), _("Receiving file names..."));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
31
355
60d3da6ab336 2003-1-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 341
diff changeset
32 cdata = g_malloc0 (sizeof (*cdata));
60d3da6ab336 2003-1-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 341
diff changeset
33 cdata->request = wdata->request;
60d3da6ab336 2003-1-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 341
diff changeset
34 cdata->uidata = wdata;
60d3da6ab336 2003-1-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 341
diff changeset
35 cdata->run_function = gftpui_common_run_ls;
511
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
36 cdata->dont_refresh = 1;
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
37
355
60d3da6ab336 2003-1-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 341
diff changeset
38 gftpui_common_run_callback_function (cdata);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
39
355
60d3da6ab336 2003-1-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 341
diff changeset
40 wdata->files = cdata->files;
60d3da6ab336 2003-1-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 341
diff changeset
41 g_free (cdata);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
42
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
43 if (wdata->files == NULL || !GFTP_IS_CONNECTED (wdata->request))
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
44 {
380
05ee37a5558b 2003-1-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 377
diff changeset
45 gftpui_disconnect (wdata);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
46 return (0);
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
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
49 wdata->sorted = 0;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
50 sortrows (GTK_CLIST (wdata->listbox), -1, (gpointer) wdata);
355
60d3da6ab336 2003-1-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 341
diff changeset
51
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
52 if (IS_NONE_SELECTED (wdata))
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
53 gtk_clist_select_row (GTK_CLIST (wdata->listbox), 0, 0);
355
60d3da6ab336 2003-1-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 341
diff changeset
54
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
55 return (1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
56 }
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
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
59 int
767
49cfbe02926b 2006-7-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 753
diff changeset
60 ftp_connect (gftp_window_data * wdata, gftp_request * request)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
61 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
62 if (wdata->request == request)
367
d5409bf03ff1 2003-1-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 356
diff changeset
63 gtk_label_set (GTK_LABEL (wdata->hoststxt), _("Connecting..."));
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
64
377
14da115b149b 2003-1-23 Brian Masney <masneyb@gftp.org>
masneyb
parents: 368
diff changeset
65 return (gftpui_common_cmd_open (wdata, request, NULL, NULL, NULL));
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
66 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
67
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
68
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
69 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
70 get_files (gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
71 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
72 transfer_window_files (&window2, &window1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
73 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
74
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
75
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
76 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
77 put_files (gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
78 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
79 transfer_window_files (&window1, &window2);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
80 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
81
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
82
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
83 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
84 transfer_window_files (gftp_window_data * fromwdata, gftp_window_data * towdata)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
85 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
86 gftp_file * tempfle, * newfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
87 GList * templist, * filelist;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
88 gftp_transfer * transfer;
506
5944bd059ae0 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 496
diff changeset
89 int num, ret, disconnect;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
90
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
91 if (!check_status (_("Transfer Files"), fromwdata, 1, 0, 1,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
92 towdata->request->put_file != NULL && fromwdata->request->get_file != NULL))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
93 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
94
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
95 if (!GFTP_IS_CONNECTED (fromwdata->request) ||
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
96 !GFTP_IS_CONNECTED (towdata->request))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
97 {
677
8990a8a26ccf 2005-1-24 Brian Masney <masneyb@gftp.org>
masneyb
parents: 675
diff changeset
98 ftp_log (gftp_logging_error, NULL,
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
99 _("Retrieve Files: Not connected to a remote site\n"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
100 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
101 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
102
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
103 if (check_reconnect (fromwdata) < 0 || check_reconnect (towdata) < 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
104 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
105
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
106 transfer = g_malloc0 (sizeof (*transfer));
368
af541d789f4c 2003-1-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
107 transfer->fromreq = gftp_copy_request (fromwdata->request);
af541d789f4c 2003-1-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 367
diff changeset
108 transfer->toreq = gftp_copy_request (towdata->request);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
109 transfer->fromwdata = fromwdata;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
110 transfer->towdata = towdata;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
111
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
112 num = 0;
525
7262851e3ae8 2004-8-1 Brian Masney <masneyb@gftp.org>
masneyb
parents: 518
diff changeset
113 templist = gftp_gtk_get_list_selection (fromwdata);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
114 filelist = fromwdata->files;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
115 while (templist != NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
116 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
117 templist = get_next_selection (templist, &filelist, &num);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
118 tempfle = filelist->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
119 if (strcmp (tempfle->file, "..") != 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
120 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
121 newfle = copy_fdata (tempfle);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
122 transfer->files = g_list_append (transfer->files, newfle);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
123 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
124 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
125
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
126 if (transfer->files != NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
127 {
63
41b71c4e5076 2002-11-2333 Brian Masney <masneyb@gftp.org>
masneyb
parents: 59
diff changeset
128 gftp_swap_socks (transfer->fromreq, fromwdata->request);
41b71c4e5076 2002-11-2333 Brian Masney <masneyb@gftp.org>
masneyb
parents: 59
diff changeset
129 gftp_swap_socks (transfer->toreq, towdata->request);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
130
767
49cfbe02926b 2006-7-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 753
diff changeset
131 ret = gftp_gtk_get_subdirs (transfer);
506
5944bd059ae0 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 496
diff changeset
132 if (ret < 0)
5944bd059ae0 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 496
diff changeset
133 disconnect = 1;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
134 else
506
5944bd059ae0 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 496
diff changeset
135 disconnect = 0;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
136
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
137 if (!GFTP_IS_CONNECTED (transfer->fromreq))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
138 {
380
05ee37a5558b 2003-1-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 377
diff changeset
139 gftpui_disconnect (fromwdata);
506
5944bd059ae0 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 496
diff changeset
140 disconnect = 1;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
141 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
142
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
143 if (!GFTP_IS_CONNECTED (transfer->toreq))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
144 {
380
05ee37a5558b 2003-1-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 377
diff changeset
145 gftpui_disconnect (towdata);
506
5944bd059ae0 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 496
diff changeset
146 disconnect = 1;
5944bd059ae0 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 496
diff changeset
147 }
5944bd059ae0 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 496
diff changeset
148
5944bd059ae0 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 496
diff changeset
149 if (disconnect)
5944bd059ae0 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 496
diff changeset
150 {
5944bd059ae0 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 496
diff changeset
151 free_tdata (transfer);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
152 return;
506
5944bd059ae0 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 496
diff changeset
153 }
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
154
63
41b71c4e5076 2002-11-2333 Brian Masney <masneyb@gftp.org>
masneyb
parents: 59
diff changeset
155 gftp_swap_socks (fromwdata->request, transfer->fromreq);
41b71c4e5076 2002-11-2333 Brian Masney <masneyb@gftp.org>
masneyb
parents: 59
diff changeset
156 gftp_swap_socks (towdata->request, transfer->toreq);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
157 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
158
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
159 if (transfer->files != NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
160 {
367
d5409bf03ff1 2003-1-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 356
diff changeset
161 gftpui_common_add_file_transfer (transfer->fromreq, transfer->toreq,
d5409bf03ff1 2003-1-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 356
diff changeset
162 transfer->fromwdata, transfer->towdata,
d5409bf03ff1 2003-1-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 356
diff changeset
163 transfer->files);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
164 g_free (transfer);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
165 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
166 else
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
167 free_tdata (transfer);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
168 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
169
506
5944bd059ae0 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 496
diff changeset
170
508
a95c5acdacf6 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
171 static int
511
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
172 gftpui_gtk_tdata_connect (gftpui_callback_data * cdata)
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
173 {
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
174 gftp_transfer * tdata;
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
175 int ret;
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
176
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
177 tdata = cdata->user_data;
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
178
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
179 if (tdata->fromreq != NULL)
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
180 {
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
181 ret = gftp_connect (tdata->fromreq);
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
182 if (ret < 0)
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
183 return (ret);
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
184 }
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
185
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
186 if (tdata->toreq != NULL)
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
187 {
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
188 ret = gftp_connect (tdata->toreq);
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
189 if (ret < 0)
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
190 return (ret);
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
191 }
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
192
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
193 return (0);
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
194 }
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
195
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
196
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
197 static void
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
198 gftpui_gtk_tdata_disconnect (gftpui_callback_data * cdata)
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
199 {
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
200 gftp_transfer * tdata;
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
201
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
202 tdata = cdata->user_data;
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
203
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
204 if (tdata->fromreq != NULL)
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
205 gftp_disconnect (tdata->fromreq);
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
206
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
207 if (tdata->toreq != NULL)
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
208 gftp_disconnect (tdata->toreq);
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
209
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
210 cdata->request->datafd = -1;
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
211 }
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
212
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
213
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
214 static int
508
a95c5acdacf6 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
215 _gftp_getdir_thread (gftpui_callback_data * cdata)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
216 {
508
a95c5acdacf6 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
217 return (gftp_get_all_subdirs (cdata->user_data, NULL));
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
218 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
219
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
220
506
5944bd059ae0 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 496
diff changeset
221 int
767
49cfbe02926b 2006-7-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 753
diff changeset
222 gftp_gtk_get_subdirs (gftp_transfer * transfer)
506
5944bd059ae0 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 496
diff changeset
223 {
508
a95c5acdacf6 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
224 gftpui_callback_data * cdata;
506
5944bd059ae0 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 496
diff changeset
225 long numfiles, numdirs;
5944bd059ae0 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 496
diff changeset
226 guint timeout_num;
508
a95c5acdacf6 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
227 int ret;
506
5944bd059ae0 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 496
diff changeset
228
508
a95c5acdacf6 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
229 cdata = g_malloc0 (sizeof (*cdata));
a95c5acdacf6 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
230 cdata->user_data = transfer;
a95c5acdacf6 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
231 cdata->uidata = transfer->fromwdata;
a95c5acdacf6 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
232 cdata->request = ((gftp_window_data *) transfer->fromwdata)->request;
a95c5acdacf6 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
233 cdata->run_function = _gftp_getdir_thread;
511
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
234 cdata->connect_function = gftpui_gtk_tdata_connect;
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
235 cdata->disconnect_function = gftpui_gtk_tdata_disconnect;
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
236 cdata->dont_check_connection = 1;
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 508
diff changeset
237 cdata->dont_refresh = 1;
506
5944bd059ae0 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 496
diff changeset
238
508
a95c5acdacf6 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
239 timeout_num = gtk_timeout_add (100, progress_timeout, transfer);
a95c5acdacf6 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
240 ret = gftpui_common_run_callback_function (cdata);
a95c5acdacf6 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
241 gtk_timeout_remove (timeout_num);
506
5944bd059ae0 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 496
diff changeset
242
508
a95c5acdacf6 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
243 numfiles = transfer->numfiles;
a95c5acdacf6 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
244 numdirs = transfer->numdirs;
a95c5acdacf6 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
245 transfer->numfiles = transfer->numdirs = -1;
a95c5acdacf6 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
246 update_directory_download_progress (transfer);
a95c5acdacf6 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
247 transfer->numfiles = numfiles;
a95c5acdacf6 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
248 transfer->numdirs = numdirs;
506
5944bd059ae0 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 496
diff changeset
249
508
a95c5acdacf6 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
250 g_free (cdata);
506
5944bd059ae0 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 496
diff changeset
251
508
a95c5acdacf6 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
252 return (ret);
506
5944bd059ae0 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 496
diff changeset
253 }
5944bd059ae0 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 496
diff changeset
254
5944bd059ae0 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 496
diff changeset
255
305
6d180e6a8ba5 2003-11-3 Brian Masney <masneyb@gftp.org>
masneyb
parents: 303
diff changeset
256 static void
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
257 remove_file (char *filename)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
258 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
259 if (unlink (filename) == 0)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
260 ftp_log (gftp_logging_misc, NULL, _("Successfully removed %s\n"),
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
261 filename);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
262 else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
263 ftp_log (gftp_logging_error, NULL,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
264 _("Error: Could not remove file %s: %s\n"), filename,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
265 g_strerror (errno));
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
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
268
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
269 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
270 free_edit_data (gftp_viewedit_data * ve_proc)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
271 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
272 int i;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
273
294
4747f621b79b 2003-10-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 278
diff changeset
274 if (ve_proc->torequest)
4747f621b79b 2003-10-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 278
diff changeset
275 gftp_request_destroy (ve_proc->torequest, 1);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
276 if (ve_proc->filename)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
277 g_free (ve_proc->filename);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
278 if (ve_proc->remote_filename)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
279 g_free (ve_proc->remote_filename);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
280 for (i = 0; ve_proc->argv[i] != NULL; i++)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
281 g_free (ve_proc->argv[i]);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
282 g_free (ve_proc->argv);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
283 g_free (ve_proc);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
284 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
285
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
286
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
287 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
288 dont_upload (gftp_viewedit_data * ve_proc, gftp_dialog_data * ddata)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
289 {
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
290 remove_file (ve_proc->filename);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
291 free_edit_data (ve_proc);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
292 }
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 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
296 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
297 {
303
3b9d5797050f 2003-11-2 Brian Masney <masneyb@gftp.org>
masneyb
parents: 297
diff changeset
298 gftp_transfer * tdata;
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
299 gftp_file * tempfle;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
300 GList * newfile;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
301
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
302 tempfle = g_malloc0 (sizeof (*tempfle));
555
7f54d0c0edbc 2004-9-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 553
diff changeset
303 tempfle->destfile = gftp_build_path (ve_proc->torequest,
7f54d0c0edbc 2004-9-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 553
diff changeset
304 ve_proc->torequest->directory,
294
4747f621b79b 2003-10-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 278
diff changeset
305 ve_proc->remote_filename, NULL);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
306 ve_proc->remote_filename = NULL;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
307 tempfle->file = ve_proc->filename;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
308 ve_proc->filename = NULL;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
309 tempfle->done_rm = 1;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
310 newfile = g_list_append (NULL, tempfle);
367
d5409bf03ff1 2003-1-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 356
diff changeset
311 tdata = gftpui_common_add_file_transfer (ve_proc->fromwdata->request,
d5409bf03ff1 2003-1-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 356
diff changeset
312 ve_proc->torequest,
d5409bf03ff1 2003-1-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 356
diff changeset
313 ve_proc->fromwdata,
d5409bf03ff1 2003-1-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 356
diff changeset
314 ve_proc->towdata, newfile);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
315 free_edit_data (ve_proc);
303
3b9d5797050f 2003-11-2 Brian Masney <masneyb@gftp.org>
masneyb
parents: 297
diff changeset
316
3b9d5797050f 2003-11-2 Brian Masney <masneyb@gftp.org>
masneyb
parents: 297
diff changeset
317 if (tdata != NULL)
3b9d5797050f 2003-11-2 Brian Masney <masneyb@gftp.org>
masneyb
parents: 297
diff changeset
318 tdata->conn_error_no_timeout = 1;
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
319 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
320
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
321
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
322 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
323 check_done_process (void)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
324 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
325 gftp_viewedit_data * ve_proc;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
326 GList * curdata, *deldata;
556
017b1108305b 2004-9-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 555
diff changeset
327 int ret, procret;
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
328 struct stat st;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
329 char *str;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
330 pid_t pid;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
331
470
a68273d9725a 2004-5-16 Brian Masney <masneyb@gftp.org>
masneyb
parents: 463
diff changeset
332 gftpui_common_child_process_done = 0;
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
333 while ((pid = waitpid (-1, &ret, WNOHANG)) > 0)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
334 {
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
335 curdata = viewedit_processes;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
336 while (curdata != NULL)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
337 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
338 ve_proc = curdata->data;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
339 deldata = curdata;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
340 curdata = curdata->next;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
341 if (ve_proc->pid == pid)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
342 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
343 viewedit_processes = g_list_remove_link (viewedit_processes,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
344 deldata);
556
017b1108305b 2004-9-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 555
diff changeset
345 if (WIFEXITED (ret))
017b1108305b 2004-9-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 555
diff changeset
346 {
017b1108305b 2004-9-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 555
diff changeset
347 procret = WEXITSTATUS (ret);
017b1108305b 2004-9-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 555
diff changeset
348 if (procret != 0)
559
b497d05cb591 2004-9-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 556
diff changeset
349 {
b497d05cb591 2004-9-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 556
diff changeset
350 ftp_log (gftp_logging_error, NULL,
b497d05cb591 2004-9-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 556
diff changeset
351 _("Error: Child %d returned %d\n"), pid, procret);
703
56de00e9afa1 2005-3-31 Brian Masney <masneyb@gftp.org>
masneyb
parents: 677
diff changeset
352 if (ve_proc->view)
56de00e9afa1 2005-3-31 Brian Masney <masneyb@gftp.org>
masneyb
parents: 677
diff changeset
353 remove_file (ve_proc->filename);
559
b497d05cb591 2004-9-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 556
diff changeset
354 continue;
b497d05cb591 2004-9-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 556
diff changeset
355 }
556
017b1108305b 2004-9-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 555
diff changeset
356 else
017b1108305b 2004-9-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 555
diff changeset
357 ftp_log (gftp_logging_misc, NULL,
017b1108305b 2004-9-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 555
diff changeset
358 _("Child %d returned successfully\n"), pid);
017b1108305b 2004-9-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 555
diff changeset
359 }
017b1108305b 2004-9-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 555
diff changeset
360 else
017b1108305b 2004-9-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 555
diff changeset
361 ftp_log (gftp_logging_error, NULL,
017b1108305b 2004-9-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 555
diff changeset
362 _("Error: Child %d did not terminate properly\n"),
017b1108305b 2004-9-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 555
diff changeset
363 pid);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
364
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
365 if (!ve_proc->view && !ve_proc->dontupload)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
366 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
367 /* We was editing the file. Upload it */
556
017b1108305b 2004-9-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 555
diff changeset
368 ret = stat (ve_proc->filename, &st);
017b1108305b 2004-9-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 555
diff changeset
369
017b1108305b 2004-9-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 555
diff changeset
370 if (ret == -1)
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
371 ftp_log (gftp_logging_error, NULL,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
372 _("Error: Cannot get information about file %s: %s\n"),
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
373 ve_proc->filename, g_strerror (errno));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
374 else if (st.st_mtime == ve_proc->st.st_mtime)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
375 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
376 ftp_log (gftp_logging_misc, NULL,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
377 _("File %s was not changed\n"),
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
378 ve_proc->filename);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
379 remove_file (ve_proc->filename);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
380 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
381 else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
382 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
383 memcpy (&ve_proc->st, &st, sizeof (ve_proc->st));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
384 str = g_strdup_printf (
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
385 _("File %s has changed.\nWould you like to upload it?"),
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
386 ve_proc->remote_filename);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
387
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
388 MakeYesNoDialog (_("Edit File"), str,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
389 do_upload, ve_proc,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
390 dont_upload, ve_proc);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
391 g_free (str);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
392 continue;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
393 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
394 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
395
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
396 free_edit_data (ve_proc);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
397 continue;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
398 }
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
399 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
400 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
401 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
402
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
403
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
404 static void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
405 on_next_transfer (gftp_transfer * tdata)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
406 {
326
cdabbe5c9a95 2003-12-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 320
diff changeset
407 int fd;
cdabbe5c9a95 2003-12-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 320
diff changeset
408 intptr_t refresh_files;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
409 gftp_file * tempfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
410
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
411 tdata->next_file = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
412 for (; tdata->updfle != tdata->curfle; tdata->updfle = tdata->updfle->next)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
413 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
414 tempfle = tdata->updfle->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
415
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
416 if (tempfle->is_fd)
58
c01d91c10f6c 2002-11-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
417 fd = tempfle->fd;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
418 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
419 fd = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
420
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
421 if (tempfle->done_view)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
422 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
423 if (tempfle->transfer_action != GFTP_TRANS_ACTION_SKIP)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
424 view_file (tempfle->destfile, fd, 1, tempfle->done_rm, 1, 0,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
425 tempfle->file, NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
426
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
427 if (tempfle->is_fd)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
428 {
58
c01d91c10f6c 2002-11-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
429 close (tempfle->fd);
c01d91c10f6c 2002-11-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
430 tempfle->fd = -1;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
431 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
432 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
433 else if (tempfle->done_edit)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
434 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
435 if (tempfle->transfer_action != GFTP_TRANS_ACTION_SKIP)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
436 view_file (tempfle->destfile, fd, 0, tempfle->done_rm, 1, 0,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
437 tempfle->file, NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
438
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
439 if (tempfle->is_fd)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
440 {
58
c01d91c10f6c 2002-11-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
441 close (tempfle->fd);
c01d91c10f6c 2002-11-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
442 tempfle->fd = -1;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
443 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
444 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
445 else if (tempfle->done_rm)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
446 tdata->fromreq->rmfile (tdata->fromreq, tempfle->file);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
447
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
448 if (tempfle->transfer_action == GFTP_TRANS_ACTION_SKIP)
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
449 gtk_ctree_node_set_text (GTK_CTREE (dlwdw), tempfle->user_data, 1,
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
450 _("Skipped"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
451 else
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
452 gtk_ctree_node_set_text (GTK_CTREE (dlwdw), tempfle->user_data, 1,
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
453 _("Finished"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
454 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
455
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
456 gftp_lookup_request_option (tdata->fromreq, "refresh_files", &refresh_files);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
457
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
458 if (refresh_files && tdata->curfle && tdata->curfle->next &&
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
459 compare_request (tdata->toreq,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
460 ((gftp_window_data *) tdata->towdata)->request, 1))
514
e55d8b35d809 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 511
diff changeset
461 gftpui_refresh (tdata->towdata, 1);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
462 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
463
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
464
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
465 static void
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
466 get_trans_password (gftp_request * request, gftp_dialog_data * ddata)
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
467 {
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
468 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
469 request->stopable = 0;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
470 }
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
471
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
472
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
473 static void
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
474 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
475 {
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
476 if (tdata->fromreq->stopable == 0)
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
477 return;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
478
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
479 g_static_mutex_lock (&tdata->structmutex);
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
480 if (tdata->started)
42
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 41
diff changeset
481 {
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 41
diff changeset
482 tdata->cancel = 1;
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 41
diff changeset
483 tdata->fromreq->cancel = 1;
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 41
diff changeset
484 tdata->toreq->cancel = 1;
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 41
diff changeset
485 }
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
486 else
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
487 tdata->done = 1;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
488
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
489 tdata->fromreq->stopable = 0;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
490 tdata->toreq->stopable = 0;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
491 g_static_mutex_unlock (&tdata->structmutex);
40
66c064fd05bc 2002-10-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 37
diff changeset
492
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
493 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
494 ((gftp_file *) tdata->curfle->data)->file);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
495 }
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
496
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
497
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
498 static void
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
499 show_transfer (gftp_transfer * tdata)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
500 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
501 GdkPixmap * closedir_pixmap, * opendir_pixmap;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
502 GdkBitmap * closedir_bitmap, * opendir_bitmap;
367
d5409bf03ff1 2003-1-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 356
diff changeset
503 gftpui_common_curtrans_data * transdata;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
504 gftp_file * tempfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
505 GList * templist;
397
14ef37b62c20 2004-2-8 Brian Masney <masneyb@gftp.org>
masneyb
parents: 380
diff changeset
506 char *text[2];
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
507
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
508 gftp_get_pixmap (dlwdw, "open_dir.xpm", &opendir_pixmap, &opendir_bitmap);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
509 gftp_get_pixmap (dlwdw, "dir.xpm", &closedir_pixmap, &closedir_bitmap);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
510
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
511 text[0] = tdata->fromreq->hostname;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
512 text[1] = _("Waiting...");
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
513 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
514 text, 5,
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
515 closedir_pixmap, closedir_bitmap,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
516 opendir_pixmap, opendir_bitmap,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
517 FALSE,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
518 tdata->numdirs + tdata->numfiles < 50);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
519 transdata = g_malloc (sizeof (*transdata));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
520 transdata->transfer = tdata;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
521 transdata->curfle = NULL;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
522 gtk_ctree_node_set_row_data (GTK_CTREE (dlwdw), tdata->user_data, transdata);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
523 tdata->show = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
524 tdata->curfle = tdata->updfle = tdata->files;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
525
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
526 tdata->total_bytes = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
527 for (templist = tdata->files; templist != NULL; templist = templist->next)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
528 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
529 tempfle = templist->data;
397
14ef37b62c20 2004-2-8 Brian Masney <masneyb@gftp.org>
masneyb
parents: 380
diff changeset
530
14ef37b62c20 2004-2-8 Brian Masney <masneyb@gftp.org>
masneyb
parents: 380
diff changeset
531 text[0] = gftpui_gtk_get_utf8_file_pos (tempfle);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
532 if (tempfle->transfer_action == GFTP_TRANS_ACTION_SKIP)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
533 text[1] = _("Skipped");
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
534 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
535 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
536 tdata->total_bytes += tempfle->size;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
537 text[1] = _("Waiting...");
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
538 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
539
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
540 tempfle->user_data = gtk_ctree_insert_node (GTK_CTREE (dlwdw),
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
541 tdata->user_data,
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
542 NULL, text, 5, NULL, NULL, NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
543 NULL, FALSE, FALSE);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
544 transdata = g_malloc (sizeof (*transdata));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
545 transdata->transfer = tdata;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
546 transdata->curfle = templist;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
547 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
548 transdata);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
549 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
550
553
b2b4f5fa8fc7 2004-9-14 Brian Masney <masneyb@gftp.org>
masneyb
parents: 525
diff changeset
551 if (!tdata->toreq->stopable && gftp_need_password (tdata->toreq))
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
552 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
553 tdata->toreq->stopable = 1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
554 MakeEditDialog (_("Enter Password"),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
555 _("Please enter your password for this site"), NULL, 0,
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
556 NULL, gftp_dialog_button_connect,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
557 get_trans_password, tdata->toreq,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
558 cancel_get_trans_password, tdata);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
559 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
560
553
b2b4f5fa8fc7 2004-9-14 Brian Masney <masneyb@gftp.org>
masneyb
parents: 525
diff changeset
561 if (!tdata->fromreq->stopable && gftp_need_password (tdata->fromreq))
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
562 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
563 tdata->fromreq->stopable = 1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
564 MakeEditDialog (_("Enter Password"),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
565 _("Please enter your password for this site"), NULL, 0,
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
566 NULL, gftp_dialog_button_connect,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
567 get_trans_password, tdata->fromreq,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
568 cancel_get_trans_password, tdata);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
569 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
570 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
571
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
572
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
573 static void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
574 transfer_done (GList * node)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
575 {
367
d5409bf03ff1 2003-1-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 356
diff changeset
576 gftpui_common_curtrans_data * transdata;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
577 gftp_transfer * tdata;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
578 gftp_file * tempfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
579 GList * templist;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
580
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
581 tdata = node->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
582 if (tdata->started)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
583 {
297
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
584 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
585 tdata->fromreq))
309
cc2eeb30b793 2003-11-7 Brian Masney <masneyb@gftp.org>
masneyb
parents: 305
diff changeset
586 {
cc2eeb30b793 2003-11-7 Brian Masney <masneyb@gftp.org>
masneyb
parents: 305
diff changeset
587 gftp_copy_param_options (((gftp_window_data *) tdata->fromwdata)->request, tdata->fromreq);
cc2eeb30b793 2003-11-7 Brian Masney <masneyb@gftp.org>
masneyb
parents: 305
diff changeset
588
cc2eeb30b793 2003-11-7 Brian Masney <masneyb@gftp.org>
masneyb
parents: 305
diff changeset
589 gftp_swap_socks (((gftp_window_data *) tdata->fromwdata)->request,
cc2eeb30b793 2003-11-7 Brian Masney <masneyb@gftp.org>
masneyb
parents: 305
diff changeset
590 tdata->fromreq);
cc2eeb30b793 2003-11-7 Brian Masney <masneyb@gftp.org>
masneyb
parents: 305
diff changeset
591 }
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
592 else
297
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
593 gftp_disconnect (tdata->fromreq);
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
594
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
595 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
596 tdata->toreq))
309
cc2eeb30b793 2003-11-7 Brian Masney <masneyb@gftp.org>
masneyb
parents: 305
diff changeset
597 {
cc2eeb30b793 2003-11-7 Brian Masney <masneyb@gftp.org>
masneyb
parents: 305
diff changeset
598 gftp_copy_param_options (((gftp_window_data *) tdata->towdata)->request, tdata->toreq);
cc2eeb30b793 2003-11-7 Brian Masney <masneyb@gftp.org>
masneyb
parents: 305
diff changeset
599
cc2eeb30b793 2003-11-7 Brian Masney <masneyb@gftp.org>
masneyb
parents: 305
diff changeset
600 gftp_swap_socks (((gftp_window_data *) tdata->towdata)->request,
cc2eeb30b793 2003-11-7 Brian Masney <masneyb@gftp.org>
masneyb
parents: 305
diff changeset
601 tdata->toreq);
cc2eeb30b793 2003-11-7 Brian Masney <masneyb@gftp.org>
masneyb
parents: 305
diff changeset
602 }
297
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
603 else
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
604 gftp_disconnect (tdata->toreq);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
605
305
6d180e6a8ba5 2003-11-3 Brian Masney <masneyb@gftp.org>
masneyb
parents: 303
diff changeset
606 if (tdata->towdata != NULL && compare_request (tdata->toreq,
6d180e6a8ba5 2003-11-3 Brian Masney <masneyb@gftp.org>
masneyb
parents: 303
diff changeset
607 ((gftp_window_data *) tdata->towdata)->request, 1))
514
e55d8b35d809 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 511
diff changeset
608 gftpui_refresh (tdata->towdata, 1);
305
6d180e6a8ba5 2003-11-3 Brian Masney <masneyb@gftp.org>
masneyb
parents: 303
diff changeset
609
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
610 num_transfers_in_progress--;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
611 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
612
2
a171df6764a7 * Fixed crash if you was already transfering a file, and you started another
masneyb
parents: 1
diff changeset
613 if (!tdata->show && tdata->started)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
614 {
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
615 transdata = gtk_ctree_node_get_row_data (GTK_CTREE (dlwdw),
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
616 tdata->user_data);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
617 if (transdata != NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
618 g_free (transdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
619
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
620 for (templist = tdata->files; templist != NULL; templist = templist->next)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
621 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
622 tempfle = templist->data;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
623 transdata = gtk_ctree_node_get_row_data (GTK_CTREE (dlwdw),
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
624 tempfle->user_data);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
625 if (transdata != NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
626 g_free (transdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
627 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
628
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
629 gtk_ctree_remove_node (GTK_CTREE (dlwdw), tdata->user_data);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
630 }
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
631
367
d5409bf03ff1 2003-1-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 356
diff changeset
632 g_static_mutex_lock (&gftpui_common_transfer_mutex);
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
633 gftp_file_transfers = g_list_remove_link (gftp_file_transfers, node);
367
d5409bf03ff1 2003-1-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 356
diff changeset
634 g_static_mutex_unlock (&gftpui_common_transfer_mutex);
d5409bf03ff1 2003-1-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 356
diff changeset
635
320
853981bbd4d7 2003-11-30 Brian Masney <masneyb@gftp.org>
masneyb
parents: 319
diff changeset
636 gdk_window_set_title (gtk_widget_get_parent_window (GTK_WIDGET(dlwdw)),
853981bbd4d7 2003-11-30 Brian Masney <masneyb@gftp.org>
masneyb
parents: 319
diff changeset
637 gftp_version);
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
638
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
639 free_tdata (tdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
640 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
641
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
642
367
d5409bf03ff1 2003-1-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 356
diff changeset
643 static void *
d5409bf03ff1 2003-1-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 356
diff changeset
644 _gftpui_transfer_files (void *data)
d5409bf03ff1 2003-1-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 356
diff changeset
645 {
d5409bf03ff1 2003-1-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 356
diff changeset
646 int ret;
d5409bf03ff1 2003-1-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 356
diff changeset
647
d5409bf03ff1 2003-1-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 356
diff changeset
648 pthread_detach (pthread_self ());
d5409bf03ff1 2003-1-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 356
diff changeset
649 ret = gftpui_common_transfer_files (data);
d5409bf03ff1 2003-1-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 356
diff changeset
650 return (GINT_TO_POINTER(ret));
d5409bf03ff1 2003-1-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 356
diff changeset
651 }
d5409bf03ff1 2003-1-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 356
diff changeset
652
d5409bf03ff1 2003-1-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 356
diff changeset
653
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
654 static void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
655 create_transfer (gftp_transfer * tdata)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
656 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
657 pthread_t tid;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
658
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
659 if (!tdata->fromreq->stopable)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
660 {
297
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
661 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
662 tdata->fromreq))
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
663 {
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
664 gftp_swap_socks (tdata->fromreq,
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
665 ((gftp_window_data *) tdata->fromwdata)->request);
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
666 update_window (tdata->fromwdata);
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
667 }
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
668
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
669 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
670 tdata->toreq))
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
671 {
63
41b71c4e5076 2002-11-2333 Brian Masney <masneyb@gftp.org>
masneyb
parents: 59
diff changeset
672 gftp_swap_socks (tdata->toreq,
41b71c4e5076 2002-11-2333 Brian Masney <masneyb@gftp.org>
masneyb
parents: 59
diff changeset
673 ((gftp_window_data *) tdata->towdata)->request);
297
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
674 update_window (tdata->towdata);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
675 }
297
6d088dfece0b 2003-10-26 Brian Masney <masneyb@gftp.org>
masneyb
parents: 294
diff changeset
676
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
677 num_transfers_in_progress++;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
678 tdata->started = 1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
679 tdata->stalled = 1;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
680 gtk_ctree_node_set_text (GTK_CTREE (dlwdw), tdata->user_data, 1,
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
681 _("Connecting..."));
367
d5409bf03ff1 2003-1-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 356
diff changeset
682 pthread_create (&tid, NULL, _gftpui_transfer_files, tdata);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
683 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
684 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
685
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
686
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
687 static void
753
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
688 _setup_dlstr (gftp_transfer * tdata, gftp_file * fle, char *dlstr,
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
689 size_t dlstr_len)
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
690 {
767
49cfbe02926b 2006-7-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 753
diff changeset
691 int hours, mins, secs, stalled, usesentdescr;
753
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
692 unsigned long remaining_secs, lkbs;
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
693 char gotstr[50], ofstr[50];
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
694 struct timeval tv;
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
695
767
49cfbe02926b 2006-7-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 753
diff changeset
696 stalled = 1;
753
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
697 gettimeofday (&tv, NULL);
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
698 usesentdescr = (tdata->fromreq->protonum == GFTP_LOCAL_NUM);
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
699
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
700 insert_commas (fle->size, ofstr, sizeof (ofstr));
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
701 insert_commas (tdata->curtrans + tdata->curresumed, gotstr, sizeof (gotstr));
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
702
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
703 if (tv.tv_sec - tdata->lasttime.tv_sec <= 5)
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
704 {
767
49cfbe02926b 2006-7-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 753
diff changeset
705 remaining_secs = (fle->size - tdata->curtrans - tdata->curresumed) / 1024;
49cfbe02926b 2006-7-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 753
diff changeset
706
49cfbe02926b 2006-7-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 753
diff changeset
707 lkbs = (unsigned long) tdata->kbs;
49cfbe02926b 2006-7-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 753
diff changeset
708 if (lkbs > 0)
49cfbe02926b 2006-7-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 753
diff changeset
709 remaining_secs /= lkbs;
753
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
710
767
49cfbe02926b 2006-7-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 753
diff changeset
711 hours = remaining_secs / 3600;
49cfbe02926b 2006-7-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 753
diff changeset
712 remaining_secs -= hours * 3600;
49cfbe02926b 2006-7-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 753
diff changeset
713 mins = remaining_secs / 60;
49cfbe02926b 2006-7-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 753
diff changeset
714 remaining_secs -= mins * 60;
49cfbe02926b 2006-7-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 753
diff changeset
715 secs = remaining_secs;
753
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
716
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
717 if (!(hours < 0 || mins < 0 || secs < 0))
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
718 {
767
49cfbe02926b 2006-7-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 753
diff changeset
719 stalled = 0;
753
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
720 if (usesentdescr)
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
721 {
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
722 g_snprintf (dlstr, dlstr_len,
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
723 _("Sent %s of %s at %.2fKB/s, %02d:%02d:%02d est. time remaining"), gotstr, ofstr, tdata->kbs, hours, mins, secs);
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
724 }
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
725 else
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
726 {
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
727 g_snprintf (dlstr, dlstr_len,
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
728 _("Recv %s of %s at %.2fKB/s, %02d:%02d:%02d est. time remaining"), gotstr, ofstr, tdata->kbs, hours, mins, secs);
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
729 }
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
730 }
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
731 }
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
732
767
49cfbe02926b 2006-7-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 753
diff changeset
733 if (stalled)
753
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
734 {
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
735 tdata->stalled = 1;
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
736 if (usesentdescr)
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
737 {
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
738 g_snprintf (dlstr, dlstr_len,
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
739 _("Sent %s of %s, transfer stalled, unknown time remaining"),
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
740 gotstr, ofstr);
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
741 }
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
742 else
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
743 {
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
744 g_snprintf (dlstr, dlstr_len,
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
745 _("Recv %s of %s, transfer stalled, unknown time remaining"),
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
746 gotstr, ofstr);
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
747 }
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
748 }
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
749 }
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
750
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
751
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
752 static void
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
753 update_file_status (gftp_transfer * tdata)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
754 {
753
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
755 char totstr[150], winstr[150], dlstr[150];
246
290d00853950 2003-8-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 234
diff changeset
756 unsigned long remaining_secs, lkbs;
767
49cfbe02926b 2006-7-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 753
diff changeset
757 int hours, mins, secs, pcent;
463
39d9cf1bf0df 2004-4-14 Brian Masney <masneyb@gftp.org>
masneyb
parents: 433
diff changeset
758 intptr_t show_trans_in_title;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
759 gftp_file * tempfle;
320
853981bbd4d7 2003-11-30 Brian Masney <masneyb@gftp.org>
masneyb
parents: 319
diff changeset
760
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
761 g_static_mutex_lock (&tdata->statmutex);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
762 tempfle = tdata->curfle->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
763
220
6de9a8280aa4 2003-7-10 Brian Masney <masneyb@gftp.org>
masneyb
parents: 207
diff changeset
764 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
765
290d00853950 2003-8-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 234
diff changeset
766 lkbs = (unsigned long) tdata->kbs;
290d00853950 2003-8-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 234
diff changeset
767 if (lkbs > 0)
290d00853950 2003-8-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 234
diff changeset
768 remaining_secs /= lkbs;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
769
220
6de9a8280aa4 2003-7-10 Brian Masney <masneyb@gftp.org>
masneyb
parents: 207
diff changeset
770 hours = remaining_secs / 3600;
6de9a8280aa4 2003-7-10 Brian Masney <masneyb@gftp.org>
masneyb
parents: 207
diff changeset
771 remaining_secs -= hours * 3600;
6de9a8280aa4 2003-7-10 Brian Masney <masneyb@gftp.org>
masneyb
parents: 207
diff changeset
772 mins = remaining_secs / 60;
6de9a8280aa4 2003-7-10 Brian Masney <masneyb@gftp.org>
masneyb
parents: 207
diff changeset
773 remaining_secs -= mins * 60;
6de9a8280aa4 2003-7-10 Brian Masney <masneyb@gftp.org>
masneyb
parents: 207
diff changeset
774 secs = remaining_secs;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
775
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
776 if (hours < 0 || mins < 0 || secs < 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
777 {
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
778 g_static_mutex_unlock (&tdata->statmutex);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
779 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
780 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
781
246
290d00853950 2003-8-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 234
diff changeset
782 if ((double) tdata->total_bytes > 0)
290d00853950 2003-8-4 Brian Masney <masneyb@gftp.org>
masneyb
parents: 234
diff changeset
783 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
784 else
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
785 pcent = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
786
602
89216879202f 2004-11-1 Brian Masney <masneyb@gftp.org>
masneyb
parents: 559
diff changeset
787 if (pcent > 100)
89216879202f 2004-11-1 Brian Masney <masneyb@gftp.org>
masneyb
parents: 559
diff changeset
788 g_snprintf (totstr, sizeof (totstr),
89216879202f 2004-11-1 Brian Masney <masneyb@gftp.org>
masneyb
parents: 559
diff changeset
789 _("Unknown percentage complete. (File %ld of %ld)"),
89216879202f 2004-11-1 Brian Masney <masneyb@gftp.org>
masneyb
parents: 559
diff changeset
790 tdata->current_file_number, tdata->numdirs + tdata->numfiles);
89216879202f 2004-11-1 Brian Masney <masneyb@gftp.org>
masneyb
parents: 559
diff changeset
791 else
89216879202f 2004-11-1 Brian Masney <masneyb@gftp.org>
masneyb
parents: 559
diff changeset
792 g_snprintf (totstr, sizeof (totstr),
14
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 7
diff changeset
793 _("%d%% complete, %02d:%02d:%02d est. time remaining. (File %ld of %ld)"),
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
794 pcent, hours, mins, secs, tdata->current_file_number,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
795 tdata->numdirs + tdata->numfiles);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
796
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
797 *dlstr = '\0';
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
798 if (!tdata->stalled)
753
11b85ac0ec15 2006-6-22 Brian Masney <masneyb@gftp.org>
masneyb
parents: 703
diff changeset
799 _setup_dlstr (tdata, tempfle, dlstr, sizeof (dlstr));
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
800
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
801 g_static_mutex_unlock (&tdata->statmutex);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
802
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
803 gtk_ctree_node_set_text (GTK_CTREE (dlwdw), tdata->user_data, 1, totstr);
320
853981bbd4d7 2003-11-30 Brian Masney <masneyb@gftp.org>
masneyb
parents: 319
diff changeset
804
853981bbd4d7 2003-11-30 Brian Masney <masneyb@gftp.org>
masneyb
parents: 319
diff changeset
805 gftp_lookup_global_option ("show_trans_in_title", &show_trans_in_title);
853981bbd4d7 2003-11-30 Brian Masney <masneyb@gftp.org>
masneyb
parents: 319
diff changeset
806 if (gftp_file_transfers->data == tdata && show_trans_in_title)
853981bbd4d7 2003-11-30 Brian Masney <masneyb@gftp.org>
masneyb
parents: 319
diff changeset
807 {
853981bbd4d7 2003-11-30 Brian Masney <masneyb@gftp.org>
masneyb
parents: 319
diff changeset
808 g_snprintf (winstr, sizeof(winstr), "%s: %s", gftp_version, totstr);
853981bbd4d7 2003-11-30 Brian Masney <masneyb@gftp.org>
masneyb
parents: 319
diff changeset
809 gdk_window_set_title (gtk_widget_get_parent_window (GTK_WIDGET(dlwdw)),
853981bbd4d7 2003-11-30 Brian Masney <masneyb@gftp.org>
masneyb
parents: 319
diff changeset
810 winstr);
853981bbd4d7 2003-11-30 Brian Masney <masneyb@gftp.org>
masneyb
parents: 319
diff changeset
811 }
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
812
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
813 if (*dlstr != '\0')
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
814 gtk_ctree_node_set_text (GTK_CTREE (dlwdw), tempfle->user_data, 1, dlstr);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
815 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
816
377
14da115b149b 2003-1-23 Brian Masney <masneyb@gftp.org>
masneyb
parents: 368
diff changeset
817
56
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
818 static void
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
819 update_window_transfer_bytes (gftp_window_data * wdata)
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
820 {
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
821 char *tempstr, *temp1str;
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
822
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
823 if (wdata->request->gotbytes == -1)
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
824 {
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
825 update_window_info ();
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
826 wdata->request->gotbytes = 0;
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
827 }
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
828 else
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
829 {
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
830 tempstr = insert_commas (wdata->request->gotbytes, NULL, 0);
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
831 temp1str = g_strdup_printf (_("Retrieving file names...%s bytes"),
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
832 tempstr);
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
833 gtk_label_set (GTK_LABEL (wdata->hoststxt), temp1str);
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
834 g_free (tempstr);
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
835 g_free (temp1str);
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
836 }
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
837 }
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
838
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
839
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
840 gint
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
841 update_downloads (gpointer data)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
842 {
433
77fffba5e170 2004-3-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 397
diff changeset
843 intptr_t do_one_transfer_at_a_time, start_transfers;
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
844 GList * templist, * next;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
845 gftp_transfer * tdata;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
846
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
847 if (gftp_file_transfer_logs != NULL)
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
848 display_cached_logs ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
849
56
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
850 if (window1.request->gotbytes != 0)
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
851 update_window_transfer_bytes (&window1);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
852 if (window2.request->gotbytes != 0)
56
a12bcbc2fce4 2002-11-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 49
diff changeset
853 update_window_transfer_bytes (&window2);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
854
470
a68273d9725a 2004-5-16 Brian Masney <masneyb@gftp.org>
masneyb
parents: 463
diff changeset
855 if (gftpui_common_child_process_done)
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
856 check_done_process ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
857
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
858 for (templist = gftp_file_transfers; templist != NULL;)
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
859 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
860 tdata = templist->data;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
861 if (tdata->ready)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
862 {
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
863 g_static_mutex_lock (&tdata->structmutex);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
864
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
865 if (tdata->next_file)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
866 on_next_transfer (tdata);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
867 else if (tdata->show)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
868 show_transfer (tdata);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
869 else if (tdata->done)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
870 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
871 next = templist->next;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
872 g_static_mutex_unlock (&tdata->structmutex);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
873 transfer_done (templist);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
874 templist = next;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
875 continue;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
876 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
877
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
878 if (tdata->curfle != NULL)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
879 {
151
2f15b3000dbc 2003-4-27 Brian Masney <masneyb@gftp.org>
masneyb
parents: 143
diff changeset
880 gftp_lookup_global_option ("one_transfer",
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
881 &do_one_transfer_at_a_time);
433
77fffba5e170 2004-3-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 397
diff changeset
882 gftp_lookup_global_option ("start_transfers", &start_transfers);
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
883
433
77fffba5e170 2004-3-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 397
diff changeset
884 if (!tdata->started && start_transfers &&
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
885 (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
886 create_transfer (tdata);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
887
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
888 if (tdata->started)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
889 update_file_status (tdata);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
890 }
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
891 g_static_mutex_unlock (&tdata->structmutex);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
892 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
893 templist = templist->next;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
894 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
895
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
896 gtk_timeout_add (500, update_downloads, NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
897 return (0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
898 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
899
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
900
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
901 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
902 start_transfer (gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
903 {
367
d5409bf03ff1 2003-1-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 356
diff changeset
904 gftpui_common_curtrans_data * transdata;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
905 GtkCTreeNode * node;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
906
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
907 if (GTK_CLIST (dlwdw)->selection == NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
908 {
677
8990a8a26ccf 2005-1-24 Brian Masney <masneyb@gftp.org>
masneyb
parents: 675
diff changeset
909 ftp_log (gftp_logging_error, NULL,
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
910 _("There are no file transfers selected\n"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
911 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
912 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
913 node = GTK_CLIST (dlwdw)->selection->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
914 transdata = gtk_ctree_node_get_row_data (GTK_CTREE (dlwdw), node);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
915
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
916 g_static_mutex_lock (&transdata->transfer->structmutex);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
917 if (!transdata->transfer->started)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
918 create_transfer (transdata->transfer);
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
919 g_static_mutex_unlock (&transdata->transfer->structmutex);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
920 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
921
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
922
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
923 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
924 stop_transfer (gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
925 {
367
d5409bf03ff1 2003-1-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 356
diff changeset
926 gftpui_common_curtrans_data * transdata;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
927 GtkCTreeNode * node;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
928
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
929 if (GTK_CLIST (dlwdw)->selection == NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
930 {
677
8990a8a26ccf 2005-1-24 Brian Masney <masneyb@gftp.org>
masneyb
parents: 675
diff changeset
931 ftp_log (gftp_logging_error, NULL,
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
932 _("There are no file transfers selected\n"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
933 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
934 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
935 node = GTK_CLIST (dlwdw)->selection->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
936 transdata = gtk_ctree_node_get_row_data (GTK_CTREE (dlwdw), node);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
937
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
938 g_static_mutex_lock (&transdata->transfer->structmutex);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
939 if (transdata->transfer->started)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
940 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
941 transdata->transfer->cancel = 1;
42
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 41
diff changeset
942 transdata->transfer->fromreq->cancel = 1;
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 41
diff changeset
943 transdata->transfer->toreq->cancel = 1;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
944 transdata->transfer->skip_file = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
945 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
946 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
947 transdata->transfer->done = 1;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
948 g_static_mutex_unlock (&transdata->transfer->structmutex);
40
66c064fd05bc 2002-10-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 37
diff changeset
949
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
950 ftp_log (gftp_logging_misc, NULL, _("Stopping the transfer on host %s\n"),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
951 transdata->transfer->fromreq->hostname);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
952 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
953
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
954
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
955 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
956 skip_transfer (gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
957 {
367
d5409bf03ff1 2003-1-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 356
diff changeset
958 gftpui_common_curtrans_data * transdata;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
959 GtkCTreeNode * node;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
960 gftp_file * curfle;
40
66c064fd05bc 2002-10-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 37
diff changeset
961 char *file;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
962
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
963 if (GTK_CLIST (dlwdw)->selection == NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
964 {
677
8990a8a26ccf 2005-1-24 Brian Masney <masneyb@gftp.org>
masneyb
parents: 675
diff changeset
965 ftp_log (gftp_logging_error, NULL,
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
966 _("There are no file transfers selected\n"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
967 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
968 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
969 node = GTK_CLIST (dlwdw)->selection->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
970 transdata = gtk_ctree_node_get_row_data (GTK_CTREE (dlwdw), node);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
971
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
972 g_static_mutex_lock (&transdata->transfer->structmutex);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
973 if (transdata->transfer->curfle != NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
974 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
975 curfle = transdata->transfer->curfle->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
976 if (transdata->transfer->started)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
977 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
978 transdata->transfer->cancel = 1;
42
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 41
diff changeset
979 transdata->transfer->fromreq->cancel = 1;
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 41
diff changeset
980 transdata->transfer->toreq->cancel = 1;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
981 transdata->transfer->skip_file = 1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
982 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
983
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
984 curfle->transfer_action = GFTP_TRANS_ACTION_SKIP;
40
66c064fd05bc 2002-10-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 37
diff changeset
985 file = curfle->file;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
986 }
40
66c064fd05bc 2002-10-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 37
diff changeset
987 else
66c064fd05bc 2002-10-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 37
diff changeset
988 file = NULL;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
989 g_static_mutex_unlock (&transdata->transfer->structmutex);
40
66c064fd05bc 2002-10-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 37
diff changeset
990
66c064fd05bc 2002-10-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 37
diff changeset
991 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
992 file, transdata->transfer->fromreq->hostname);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
993 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
994
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
995
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
996 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
997 remove_file_transfer (gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
998 {
367
d5409bf03ff1 2003-1-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 356
diff changeset
999 gftpui_common_curtrans_data * transdata;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1000 GtkCTreeNode * node;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1001 gftp_file * curfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1002
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1003 if (GTK_CLIST (dlwdw)->selection == NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1004 {
677
8990a8a26ccf 2005-1-24 Brian Masney <masneyb@gftp.org>
masneyb
parents: 675
diff changeset
1005 ftp_log (gftp_logging_error, NULL,
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1006 _("There are no file transfers selected\n"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1007 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1008 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1009
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1010 node = GTK_CLIST (dlwdw)->selection->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1011 transdata = gtk_ctree_node_get_row_data (GTK_CTREE (dlwdw), node);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1012
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1013
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1014 if (transdata->curfle == NULL || transdata->curfle->data == NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1015 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1016
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1017 curfle = transdata->curfle->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1018
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1019 if (curfle->transfer_action & GFTP_TRANS_ACTION_SKIP)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1020 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1021
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1022 g_static_mutex_lock (&transdata->transfer->structmutex);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1023
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1024 curfle->transfer_action = GFTP_TRANS_ACTION_SKIP;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1025
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1026 if (transdata->transfer->started &&
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1027 transdata->curfle == transdata->transfer->curfle)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1028 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1029 transdata->transfer->cancel = 1;
42
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 41
diff changeset
1030 transdata->transfer->fromreq->cancel = 1;
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 41
diff changeset
1031 transdata->transfer->toreq->cancel = 1;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1032 transdata->transfer->skip_file = 1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1033 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1034 else if (transdata->curfle != transdata->transfer->curfle &&
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1035 !curfle->transfer_done)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1036 {
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1037 gtk_ctree_node_set_text (GTK_CTREE (dlwdw), curfle->user_data, 1,
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1038 _("Skipped"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1039 transdata->transfer->total_bytes -= curfle->size;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1040 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1041
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1042 g_static_mutex_unlock (&transdata->transfer->structmutex);
40
66c064fd05bc 2002-10-17 Brian Masney <masneyb@gftp.org>
masneyb
parents: 37
diff changeset
1043
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1044 ftp_log (gftp_logging_misc, NULL, _("Skipping file %s on host %s\n"),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1045 curfle->file, transdata->transfer->fromreq->hostname);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1046 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1047
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1048
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1049 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1050 move_transfer_up (gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1051 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1052 GList * firstentry, * secentry, * lastentry;
367
d5409bf03ff1 2003-1-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 356
diff changeset
1053 gftpui_common_curtrans_data * transdata;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1054 GtkCTreeNode * node;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1055
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1056 if (GTK_CLIST (dlwdw)->selection == NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1057 {
677
8990a8a26ccf 2005-1-24 Brian Masney <masneyb@gftp.org>
masneyb
parents: 675
diff changeset
1058 ftp_log (gftp_logging_error, NULL,
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1059 _("There are no file transfers selected\n"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1060 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1061 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1062 node = GTK_CLIST (dlwdw)->selection->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1063 transdata = gtk_ctree_node_get_row_data (GTK_CTREE (dlwdw), node);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1064
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1065 if (transdata->curfle == NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1066 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1067
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1068 g_static_mutex_lock (&transdata->transfer->structmutex);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1069 if (transdata->curfle->prev != NULL && (!transdata->transfer->started ||
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1070 (transdata->transfer->curfle != transdata->curfle &&
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1071 transdata->transfer->curfle != transdata->curfle->prev)))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1072 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1073 if (transdata->curfle->prev->prev == NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1074 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1075 firstentry = transdata->curfle->prev;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1076 lastentry = transdata->curfle->next;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1077 transdata->transfer->files = transdata->curfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1078 transdata->curfle->next = firstentry;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1079 transdata->transfer->files->prev = NULL;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1080 firstentry->prev = transdata->curfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1081 firstentry->next = lastentry;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1082 if (lastentry != NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1083 lastentry->prev = firstentry;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1084 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1085 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1086 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1087 firstentry = transdata->curfle->prev->prev;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1088 secentry = transdata->curfle->prev;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1089 lastentry = transdata->curfle->next;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1090 firstentry->next = transdata->curfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1091 transdata->curfle->prev = firstentry;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1092 transdata->curfle->next = secentry;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1093 secentry->prev = transdata->curfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1094 secentry->next = lastentry;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1095 if (lastentry != NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1096 lastentry->prev = secentry;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1097 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1098
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1099 gtk_ctree_move (GTK_CTREE (dlwdw),
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1100 ((gftp_file *) transdata->curfle->data)->user_data,
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1101 transdata->transfer->user_data,
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1102 transdata->curfle->next != NULL ?
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1103 ((gftp_file *) transdata->curfle->next->data)->user_data: NULL);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1104 }
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1105 g_static_mutex_unlock (&transdata->transfer->structmutex);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1106 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1107
367
d5409bf03ff1 2003-1-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 356
diff changeset
1108
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1109 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1110 move_transfer_down (gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1111 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1112 GList * firstentry, * secentry, * lastentry;
367
d5409bf03ff1 2003-1-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 356
diff changeset
1113 gftpui_common_curtrans_data * transdata;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1114 GtkCTreeNode * node;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1115
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1116 if (GTK_CLIST (dlwdw)->selection == NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1117 {
677
8990a8a26ccf 2005-1-24 Brian Masney <masneyb@gftp.org>
masneyb
parents: 675
diff changeset
1118 ftp_log (gftp_logging_error, NULL,
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1119 _("There are no file transfers selected\n"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1120 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1121 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1122 node = GTK_CLIST (dlwdw)->selection->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1123 transdata = gtk_ctree_node_get_row_data (GTK_CTREE (dlwdw), node);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1124
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1125 if (transdata->curfle == NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1126 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1127
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1128 g_static_mutex_lock (&transdata->transfer->structmutex);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1129 if (transdata->curfle->next != NULL && (!transdata->transfer->started ||
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1130 (transdata->transfer->curfle != transdata->curfle &&
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1131 transdata->transfer->curfle != transdata->curfle->next)))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1132 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1133 if (transdata->curfle->prev == NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1134 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1135 firstentry = transdata->curfle->next;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1136 lastentry = transdata->curfle->next->next;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1137 transdata->transfer->files = firstentry;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1138 transdata->transfer->files->prev = NULL;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1139 transdata->transfer->files->next = transdata->curfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1140 transdata->curfle->prev = transdata->transfer->files;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1141 transdata->curfle->next = lastentry;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1142 if (lastentry != NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1143 lastentry->prev = transdata->curfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1144 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1145 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1146 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1147 firstentry = transdata->curfle->prev;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1148 secentry = transdata->curfle->next;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1149 lastentry = transdata->curfle->next->next;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1150 firstentry->next = secentry;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1151 secentry->prev = firstentry;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1152 secentry->next = transdata->curfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1153 transdata->curfle->prev = secentry;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1154 transdata->curfle->next = lastentry;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1155 if (lastentry != NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1156 lastentry->prev = transdata->curfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1157 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1158
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1159 gtk_ctree_move (GTK_CTREE (dlwdw),
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1160 ((gftp_file *) transdata->curfle->data)->user_data,
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1161 transdata->transfer->user_data,
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1162 transdata->curfle->next != NULL ?
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1163 ((gftp_file *) transdata->curfle->next->data)->user_data: NULL);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1164 }
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 86
diff changeset
1165 g_static_mutex_unlock (&transdata->transfer->structmutex);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1166 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1167