annotate src/gtk/menu-items.c @ 129:fe0b21c006f6

2003-4-13 Brian Masney <masneyb@gftp.org> * lib/config_file.c - implemented gftp_set_global_option() * lib/gftp.h lib/misc.c - added gftp_tdata_new() * src/text/gftp-text.c src/gtk/transfer.c - use gftp_tdata_new() * src/gtk/bookmarks.c - In run_bookmark(), use gftp_parse_bookmark() function. Renamed all instances of gftp_bookmarks to gftp_bookmarks_var * src/gtk/gftp-gtk.[ch] - added global variables viewedit_processes and viewedit_processes_done. These used to be declared in lib/options.h * src/gtk/gftp-gtk.h (struct gftp_window_data) - removed sortcol and sortasds variables. Added prefix_col_str variable. This will either be local or remote * src/gtk/misc-gtk.c - removed r_gethostbyname() and r_getservbyname() * src/gtk/transfer.c - removed gftp_gtk_calc_kbs(), get_status() and parse_attribs(). These are in the lib/ directory now. Also, use g_static_mutex_*() functions from glib instead of pthread_mutex_*() * src/gtk/bookmark.c src/gtk/dnd.c src/gtk/menu-items.c src/gtk/transfer.c - use g_strdup() instead of g_malloc()/strcpy() * src/gtk/options_dialog.c - commented out large parts of this file. This file is busted at the moment * src/gtk/*.[ch] - Use new configuration interface in all source files. Updated copyright dates on all source files
author masneyb
date Sun, 13 Apr 2003 15:21:13 +0000
parents a12bcbc2fce4
children c77f85763e28
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 /* menu-items.c - menu callbacks */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
3 /* Copyright (C) 1998-2002 Brian Masney <masneyb@gftp.org> */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
4 /* */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
5 /* This program is free software; you can redistribute it and/or modify */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
6 /* it under the terms of the GNU General Public License as published by */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
7 /* the Free Software Foundation; either version 2 of the License, or */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
8 /* (at your option) any later version. */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
9 /* */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
10 /* This program is distributed in the hope that it will be useful, */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
11 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
12 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
13 /* GNU General Public License for more details. */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
14 /* */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
15 /* You should have received a copy of the GNU General Public License */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
16 /* along with this program; if not, write to the Free Software */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
17 /* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
18 /*****************************************************************************/
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
19
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
20 #include <gftp-gtk.h>
33
c8ec7877432e 2002-10-06 Brian Masney <masneyb@gftp.org>
masneyb
parents: 21
diff changeset
21 static const char cvsid[] = "$Id$";
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
22
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
23 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
24 change_setting (gftp_window_data * wdata, int menuitem, GtkWidget * checkmenu)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
25 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
26 switch (menuitem)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
27 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
28 case 1:
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
29 if (window1.request != NULL)
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
30 gftp_set_request_option (window1.request, "ascii_transfers", GINT_TO_POINTER(1));
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
31
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
32 if (window2.request != NULL)
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
33 gftp_set_request_option (window2.request, "ascii_transfers", GINT_TO_POINTER(1));
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
34 break;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
35 case 2:
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
36 if (window1.request != NULL)
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
37 gftp_set_request_option (window1.request, "ascii_transfers", GINT_TO_POINTER(0));
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
38
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
39 if (window2.request != NULL)
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
40 gftp_set_request_option (window2.request, "ascii_transfers", GINT_TO_POINTER(0));
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
41 break;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
42 case 3:
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
43 current_wdata = &window1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
44 other_wdata = &window2;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
45 if (wdata->request)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
46 update_window_info ();
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
47 break;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
48 case 4:
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
49 current_wdata = &window2;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
50 other_wdata = &window1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
51 if (wdata->request)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
52 update_window_info ();
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
53 break;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
54 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
55 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
56
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
57
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
58 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
59 tb_openurl_dialog (gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
60 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
61 const char *edttxt;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
62
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
63 if (current_wdata->request->stopable)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
64 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
65 ftp_log (gftp_logging_misc, NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
66 _("%s: Please hit the stop button first to do anything else\n"),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
67 _("OpenURL"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
68 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
69 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
70
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
71 edttxt = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (hostedit)->entry));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
72 if (*edttxt == '\0')
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
73 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
74 ftp_log (gftp_logging_misc, NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
75 _("OpenURL: Operation canceled...you must enter a string\n"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
76 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
77 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
78
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
79 if (GFTP_IS_CONNECTED (current_wdata->request))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
80 disconnect (current_wdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
81 else if (edttxt != NULL && *edttxt != '\0')
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
82 toolbar_hostedit (NULL, NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
83 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
84 openurl_dialog (current_wdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
85 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
86
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
87
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
88 static void
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
89 do_openurl (gftp_window_data * wdata, gftp_dialog_data * ddata)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
90 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
91 const char *tempstr;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
92
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
93 if (current_wdata->request->stopable)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
94 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
95 ftp_log (gftp_logging_misc, NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
96 _("%s: Please hit the stop button first to do anything else\n"),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
97 _("OpenURL"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
98 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
99 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
100
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
101 tempstr = gtk_entry_get_text (GTK_ENTRY (ddata->edit));
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
102 if (*tempstr == '\0')
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
103 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
104 ftp_log (gftp_logging_misc, NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
105 _("OpenURL: Operation canceled...you must enter a string\n"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
106 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
107 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
108
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
109 if (GFTP_IS_CONNECTED (wdata->request))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
110 disconnect (wdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
111
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
112 if (gftp_parse_url (wdata->request, tempstr) == 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
113 {
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
114 gtk_widget_destroy (ddata->dialog);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
115 ftp_connect (wdata, wdata->request, 1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
116 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
117 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
118 {
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
119 gtk_widget_destroy (ddata->dialog);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
120 ftp_log (gftp_logging_misc, NULL, _("Could not parse URL %s\n"), tempstr);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
121 }
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
122 ddata->dialog = NULL;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
123 }
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
124
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
125
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
126 void
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
127 openurl_dialog (gpointer data)
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
128 {
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
129 MakeEditDialog (_("Connect via URL"), _("Enter ftp url to connect to"),
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
130 NULL, 1, NULL, gftp_dialog_button_connect, do_openurl, data,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
131 NULL, NULL);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
132 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
133
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
134
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
135 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
136 disconnect (gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
137 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
138 gftp_window_data * wdata;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
139
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
140 wdata = data;
47
eec25f215772 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
141 gftp_delete_cache_entry (wdata->request, 1);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
142 gftp_disconnect (wdata->request);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
143 remove_files_window (wdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
144 update_window (wdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
145 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
146
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
147
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
148 static void
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
149 dochange_filespec (gftp_window_data * wdata, gftp_dialog_data * ddata)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
150 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
151 GList * templist, * filelist;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
152 gftp_file * tempfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
153 const char *edttext;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
154 int num;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
155
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
156 wdata->show_selected = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
157
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
158 edttext = gtk_entry_get_text (GTK_ENTRY (ddata->edit));
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
159 if (*edttext == '\0')
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
160 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
161 ftp_log (gftp_logging_misc, NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
162 _("Change Filespec: Operation canceled...you must enter a string\n"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
163 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
164 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
165 if (wdata->filespec)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
166 g_free (wdata->filespec);
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
167 wdata->filespec = g_strdup (edttext);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
168
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
169 filelist = wdata->files;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
170 templist = GTK_CLIST (wdata->listbox)->selection;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
171 num = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
172 while (templist != NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
173 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
174 templist = get_next_selection (templist, &filelist, &num);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
175 tempfle = filelist->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
176 tempfle->was_sel = 1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
177 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
178
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
179 gtk_clist_freeze (GTK_CLIST (wdata->listbox));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
180 gtk_clist_clear (GTK_CLIST (wdata->listbox));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
181 templist = wdata->files;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
182 while (templist != NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
183 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
184 tempfle = templist->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
185 add_file_listbox (wdata, tempfle);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
186 templist = templist->next;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
187 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
188 gtk_clist_thaw (GTK_CLIST (wdata->listbox));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
189 update_window (wdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
190 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
191
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
192
14
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
193 void
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
194 change_filespec (gpointer data)
14
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
195 {
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
196 gftp_window_data * wdata;
14
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
197
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
198 wdata = data;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
199 if (!check_status (_("Change Filespec"), wdata, 0, 0, 0, 1))
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
200 return;
14
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
201
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
202 MakeEditDialog (_("Change Filespec"), _("Enter the new file specification"),
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
203 wdata->filespec, 1, NULL, gftp_dialog_button_change,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
204 dochange_filespec, wdata, NULL, NULL);
14
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
205 }
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
206
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
207
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
208 static void
21
4b244bf9d84d 2002-09-16 Brian Masney <masneyb@gftp.org>
masneyb
parents: 19
diff changeset
209 destroy_save_directory_listing (GtkWidget * widget, gftp_save_dir_struct * str)
14
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
210 {
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
211 gtk_widget_destroy (str->filew);
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
212 g_free (str);
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
213 }
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
214
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
215
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
216 static void
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
217 dosave_directory_listing (GtkWidget * widget, gftp_save_dir_struct * str)
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
218 {
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
219 const char *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul",
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
220 "Aug", "Sep", "Oct", "Nov", "Dec" };
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
221 const char *filename;
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
222 struct tm *lt;
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
223 gftp_file * tempfle;
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
224 GList * templist;
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
225 FILE * fd;
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
226 time_t t;
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
227
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
228 filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (str->filew));
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
229 if ((fd = fopen (filename, "w")) == NULL)
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
230 {
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
231 ftp_log (gftp_logging_misc, NULL,
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
232 _("Error: Cannot open %s for writing: %s\n"), filename,
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
233 g_strerror (errno));
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
234 return;
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
235 }
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
236
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
237 time (&t);
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
238
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
239 for (templist = str->wdata->files;
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
240 templist->next != NULL;
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
241 templist = templist->next)
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
242 {
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
243 tempfle = templist->data;
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
244 fprintf (fd, "%10s %8s %8s ", tempfle->attribs, tempfle->user,
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
245 tempfle->group);
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
246 if (tempfle->attribs && (*tempfle->attribs == 'b' ||
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
247 *tempfle->attribs == 'c'))
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
248 fprintf (fd, "%5d, %4d", (((unsigned int) tempfle->size) >> 16) & 0xFF,
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
249 ((unsigned int) tempfle->size) & 0xFF);
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
250 else
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
251 {
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
252 #if defined (_LARGEFILE_SOURCE)
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
253 fprintf (fd, "%11lld", tempfle->size);
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
254 #else
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
255 fprintf (fd, "%11ld", tempfle->size);
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
256 #endif
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
257 }
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
258
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
259 lt = localtime (&tempfle->datetime);
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
260
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
261 if (tempfle->datetime > t ||
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
262 t - 3600*24*90 > tempfle->datetime)
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
263 fprintf (fd, " %s %2d %4d", months[lt->tm_mon], lt->tm_mday,
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
264 lt->tm_year + 1900);
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
265 else
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
266 fprintf (fd, " %s %2d %02d:%02d", months[lt->tm_mon], lt->tm_mday,
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
267 lt->tm_hour, lt->tm_min);
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
268
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
269 fprintf (fd, " %s\n", tempfle->file);
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
270 }
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
271
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
272 fclose (fd);
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
273 }
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
274
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
275
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
276 void
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
277 save_directory_listing (gpointer data)
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
278 {
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
279 gftp_save_dir_struct * str;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
280 GtkWidget *filew;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
281
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
282 filew = gtk_file_selection_new (_("Save Directory Listing"));
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
283
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
284 str = g_malloc (sizeof (*str));
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
285 str->filew = filew;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
286 str->wdata = data;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
287
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
288 gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (filew)->ok_button),
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
289 "clicked", GTK_SIGNAL_FUNC (dosave_directory_listing),
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
290 str);
21
4b244bf9d84d 2002-09-16 Brian Masney <masneyb@gftp.org>
masneyb
parents: 19
diff changeset
291 gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (filew)->ok_button),
4b244bf9d84d 2002-09-16 Brian Masney <masneyb@gftp.org>
masneyb
parents: 19
diff changeset
292 "clicked",
4b244bf9d84d 2002-09-16 Brian Masney <masneyb@gftp.org>
masneyb
parents: 19
diff changeset
293 GTK_SIGNAL_FUNC (destroy_save_directory_listing), str);
4b244bf9d84d 2002-09-16 Brian Masney <masneyb@gftp.org>
masneyb
parents: 19
diff changeset
294 gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (filew)->cancel_button),
4b244bf9d84d 2002-09-16 Brian Masney <masneyb@gftp.org>
masneyb
parents: 19
diff changeset
295 "clicked",
4b244bf9d84d 2002-09-16 Brian Masney <masneyb@gftp.org>
masneyb
parents: 19
diff changeset
296 GTK_SIGNAL_FUNC (destroy_save_directory_listing), str);
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
297
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
298 gtk_window_set_wmclass (GTK_WINDOW(filew), "Save Directory Listing", "gFTP");
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
299 gtk_widget_show (filew);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
300 }
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
301
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
302
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
303 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
304 show_selected (gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
305 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
306 GList * templist, * filelist;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
307 gftp_window_data * wdata;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
308 gftp_file * tempfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
309 int num;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
310
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
311 wdata = data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
312 wdata->show_selected = 1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
313
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
314 filelist = wdata->files;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
315 templist = GTK_CLIST (wdata->listbox)->selection;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
316 num = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
317 while (templist != NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
318 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
319 templist = get_next_selection (templist, &filelist, &num);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
320 tempfle = filelist->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
321 tempfle->was_sel = 1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
322 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
323
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
324 gtk_clist_freeze (GTK_CLIST (wdata->listbox));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
325 gtk_clist_clear (GTK_CLIST (wdata->listbox));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
326 templist = wdata->files;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
327 while (templist != NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
328 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
329 tempfle = templist->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
330 add_file_listbox (wdata, tempfle);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
331 templist = templist->next;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
332 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
333 gtk_clist_thaw (GTK_CLIST (wdata->listbox));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
334 update_window (wdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
335 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
336
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
337
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
338 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
339 selectall (gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
340 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
341 gftp_window_data * wdata;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
342
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
343 wdata = data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
344 wdata->show_selected = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
345 gtk_clist_select_all (GTK_CLIST (wdata->listbox));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
346 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
347
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
348
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
349 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
350 selectallfiles (gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
351 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
352 gftp_window_data * wdata;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
353 gftp_file * tempfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
354 GList *templist;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
355 int i;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
356
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
357 wdata = data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
358 wdata->show_selected = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
359 gtk_clist_freeze (GTK_CLIST (wdata->listbox));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
360 i = 0;
39
474d562c7268 2002-10-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 33
diff changeset
361 templist = wdata->files;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
362 while (templist != NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
363 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
364 tempfle = (gftp_file *) templist->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
365 if (tempfle->shown)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
366 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
367 if (tempfle->isdir)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
368 gtk_clist_unselect_row (GTK_CLIST (wdata->listbox), i, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
369 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
370 gtk_clist_select_row (GTK_CLIST (wdata->listbox), i, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
371 i++;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
372 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
373 templist = templist->next;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
374 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
375 gtk_clist_thaw (GTK_CLIST (wdata->listbox));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
376 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
377
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
378
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
379 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
380 deselectall (gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
381 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
382 gftp_window_data * wdata;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
383
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
384 wdata = data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
385 wdata->show_selected = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
386 gtk_clist_unselect_all (GTK_CLIST (wdata->listbox));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
387 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
388
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
389
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
390 static void
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
391 dosite (gftp_window_data * wdata, gftp_dialog_data * ddata)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
392 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
393 const char *edttext;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
394
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
395 edttext = gtk_entry_get_text (GTK_ENTRY (ddata->edit));
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
396 if (*edttext == '\0')
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
397 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
398 ftp_log (gftp_logging_misc, NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
399 _("SITE: Operation canceled...you must enter a string\n"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
400 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
401 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
402
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
403 if (check_reconnect (wdata) < 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
404 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
405 gftp_site_cmd (wdata->request, edttext);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
406
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
407 if (!GFTP_IS_CONNECTED (wdata->request))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
408 disconnect (wdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
409 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
410
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
411
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
412 void
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
413 site_dialog (gpointer data)
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
414 {
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
415 gftp_window_data * wdata;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
416
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
417 wdata = data;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
418 if (!check_status (_("Site"), wdata, 0, 0, 0, wdata->request->site != NULL))
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
419 return;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
420
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
421 MakeEditDialog (_("Site"), _("Enter site-specific command"), NULL, 1,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
422 NULL, gftp_dialog_button_ok, dosite, wdata, NULL, NULL);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
423 }
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
424
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
425
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
426 static void *
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
427 do_change_dir_thread (void * data)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
428 {
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
429 int success, sj, network_timeout;
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
430 gftp_window_data * wdata;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
431
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
432 wdata = data;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
433
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
434 if (wdata->request->use_threads)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
435 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
436 sj = sigsetjmp (jmp_environment, 1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
437 use_jmp_environment = 1;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
438 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
439 else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
440 sj = 0;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
441
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
442 gftp_lookup_request_option (wdata->request, "network_timeout",
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
443 &network_timeout);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
444
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
445 success = 0;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
446 if (sj == 0)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
447 {
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
448 if (network_timeout > 0)
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
449 alarm (network_timeout);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
450 success = gftp_set_directory (wdata->request, wdata->request->directory);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
451 alarm (0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
452 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
453 else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
454 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
455 gftp_disconnect (wdata->request);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
456 wdata->request->logging_function (gftp_logging_error,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
457 wdata->request->user_data,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
458 _("Operation canceled\n"));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
459 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
460
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
461 if (wdata->request->use_threads)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
462 use_jmp_environment = 0;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
463
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
464 wdata->request->stopable = 0;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
465 return ((void *) success);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
466 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
467
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
468
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
469 static int
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
470 do_change_dir (gftp_window_data * wdata, char *directory)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
471 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
472 char *olddir;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
473 int ret;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
474
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
475 if (directory != wdata->request->directory)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
476 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
477 olddir = wdata->request->directory;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
478 wdata->request->directory = g_strdup (directory);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
479 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
480 else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
481 olddir = NULL;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
482
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
483 ret = (int) generic_thread (do_change_dir_thread, wdata);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
484
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
485 if (!GFTP_IS_CONNECTED (wdata->request))
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
486 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
487 disconnect (wdata);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
488 if (olddir != NULL)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
489 g_free (olddir);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
490 return (-2);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
491 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
492
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
493 if (ret != 0)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
494 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
495 g_free (wdata->request->directory);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
496 wdata->request->directory = olddir;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
497 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
498 else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
499 g_free (olddir);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
500
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
501 return (ret);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
502 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
503
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
504
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
505 int
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
506 chdir_edit (GtkWidget * widget, gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
507 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
508 gftp_window_data * wdata;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
509 const char *edttxt;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
510 char *tempstr;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
511
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
512 wdata = data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
513 edttxt = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (wdata->combo)->entry));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
514 if (!GFTP_IS_CONNECTED (wdata->request) && *edttxt != '\0')
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
515 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
516 toolbar_hostedit (NULL, NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
517 return (0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
518 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
519
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
520 if (!check_status (_("Chdir"), wdata, wdata->request->use_threads, 0, 0,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
521 wdata->request->chdir != NULL))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
522 return (FALSE);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
523
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
524 if ((tempstr = expand_path (edttxt)) == NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
525 return (FALSE);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
526
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
527 if (check_reconnect (wdata) < 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
528 return (FALSE);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
529
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
530 if (do_change_dir (wdata, tempstr) == 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
531 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
532 gtk_clist_freeze (GTK_CLIST (wdata->listbox));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
533 remove_files_window (wdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
534 ftp_list_files (wdata, 1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
535 gtk_clist_thaw (GTK_CLIST (wdata->listbox));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
536 add_history (wdata->combo, wdata->history, wdata->histlen, tempstr);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
537 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
538
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
539 g_free (tempstr);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
540 return (FALSE);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
541 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
542
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
543
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
544 int
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
545 chdir_dialog (gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
546 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
547 GList * templist, * filelist;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
548 gftp_window_data * wdata;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
549 char *newdir, *tempstr;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
550 gftp_file *tempfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
551 int num, ret;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
552
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
553 wdata = data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
554 if (!check_status (_("Chdir"), wdata, wdata->request->use_threads, 1, 0,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
555 wdata->request->chdir != NULL))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
556 return (0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
557
39
474d562c7268 2002-10-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 33
diff changeset
558 filelist = wdata->files;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
559 templist = GTK_CLIST (wdata->listbox)->selection;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
560 num = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
561 templist = get_next_selection (templist, &filelist, &num);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
562 tempfle = filelist->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
563
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
564 newdir = g_strconcat (wdata->request->directory, "/", tempfle->file, NULL);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
565 remove_double_slashes (newdir);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
566 if ((tempstr = expand_path (newdir)) == NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
567 return (0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
568 g_free (newdir);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
569
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
570 if (check_reconnect (wdata) < 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
571 return (0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
572
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
573 ret = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
574 if (do_change_dir (wdata, tempstr) == 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
575 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
576 gtk_clist_freeze (GTK_CLIST (wdata->listbox));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
577 remove_files_window (wdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
578 ftp_list_files (wdata, 1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
579 gtk_clist_thaw (GTK_CLIST (wdata->listbox));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
580 ret = 1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
581 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
582 g_free (tempstr);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
583 return (ret);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
584 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
585
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
586
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
587 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
588 clearlog (gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
589 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
590 guint len;
45
311e29c40ed6 2002-10-31 Brian Masney <masneyb@gftp.org>
masneyb
parents: 42
diff changeset
591 #if GTK_MAJOR_VERSION == 1
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
592 len = gtk_text_get_length (GTK_TEXT (logwdw));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
593 gtk_text_set_point (GTK_TEXT (logwdw), len);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
594 gtk_text_backward_delete (GTK_TEXT (logwdw), len);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
595 #else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
596 GtkTextBuffer * textbuf;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
597 GtkTextIter iter, iter2;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
598
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
599 textbuf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (logwdw));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
600 len = gtk_text_buffer_get_char_count (textbuf);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
601 gtk_text_buffer_get_iter_at_offset (textbuf, &iter, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
602 gtk_text_buffer_get_iter_at_offset (textbuf, &iter2, len - 1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
603 gtk_text_buffer_delete (textbuf, &iter, &iter2);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
604 #endif
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
605 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
606
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
607
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
608 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
609 viewlog (gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
610 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
611 char *tempstr, *txt, *pos;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
612 guint textlen;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
613 ssize_t len;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
614 int fd;
45
311e29c40ed6 2002-10-31 Brian Masney <masneyb@gftp.org>
masneyb
parents: 42
diff changeset
615 #if GTK_MAJOR_VERSION > 1
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
616 GtkTextBuffer * textbuf;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
617 GtkTextIter iter, iter2;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
618 #endif
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
619
41
4bcfaf6307b5 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 39
diff changeset
620 tempstr = g_strconcat (g_get_tmp_dir (), "/gftp-view.XXXXXXXXXX", NULL);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
621 if ((fd = mkstemp (tempstr)) < 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
622 {
14
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
623 ftp_log (gftp_logging_misc, NULL,
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
624 _("Error: Cannot open %s for writing: %s\n"), tempstr,
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
625 g_strerror (errno));
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
626 g_free (tempstr);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
627 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
628 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
629 chmod (tempstr, S_IRUSR | S_IWUSR);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
630 unlink (tempstr);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
631
45
311e29c40ed6 2002-10-31 Brian Masney <masneyb@gftp.org>
masneyb
parents: 42
diff changeset
632 #if GTK_MAJOR_VERSION == 1
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
633 textlen = gtk_text_get_length (GTK_TEXT (logwdw));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
634 txt = gtk_editable_get_chars (GTK_EDITABLE (logwdw), 0, -1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
635 #else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
636 textbuf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (logwdw));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
637 textlen = gtk_text_buffer_get_char_count (textbuf);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
638 gtk_text_buffer_get_iter_at_offset (textbuf, &iter, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
639 gtk_text_buffer_get_iter_at_offset (textbuf, &iter2, textlen - 1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
640 txt = gtk_text_buffer_get_text (textbuf, &iter, &iter2, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
641 #endif
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
642 pos = txt;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
643 do
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
644 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
645 if ((len = write (fd, pos, textlen)) == -1)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
646 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
647 ftp_log (gftp_logging_misc, NULL, _("Error: Error writing to %s: %s\n"), tempstr, g_strerror (errno));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
648 break;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
649 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
650 textlen -= len;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
651 pos += len;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
652 } while (textlen > 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
653
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
654 lseek (fd, 0, SEEK_SET);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
655 view_file (tempstr, fd, 1, 0, 0, 1, NULL, NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
656 close (fd);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
657 g_free (tempstr);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
658 g_free (txt);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
659 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
660
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
661
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
662 static void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
663 dosavelog (GtkWidget * widget, GtkFileSelection * fs)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
664 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
665 const char *filename;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
666 char *txt, *pos;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
667 guint textlen;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
668 ssize_t len;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
669 FILE *fd;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
670 int ok;
45
311e29c40ed6 2002-10-31 Brian Masney <masneyb@gftp.org>
masneyb
parents: 42
diff changeset
671 #if GTK_MAJOR_VERSION > 1
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
672 GtkTextBuffer * textbuf;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
673 GtkTextIter iter, iter2;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
674 #endif
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
675
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
676 filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
677 if ((fd = fopen (filename, "w")) == NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
678 {
14
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
679 ftp_log (gftp_logging_misc, NULL,
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
680 _("Error: Cannot open %s for writing: %s\n"), filename,
83090328581e * More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents: 1
diff changeset
681 g_strerror (errno));
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
682 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
683 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
684
45
311e29c40ed6 2002-10-31 Brian Masney <masneyb@gftp.org>
masneyb
parents: 42
diff changeset
685 #if GTK_MAJOR_VERSION == 1
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
686 textlen = gtk_text_get_length (GTK_TEXT (logwdw));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
687 txt = gtk_editable_get_chars (GTK_EDITABLE (logwdw), 0, -1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
688 #else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
689 textbuf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (logwdw));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
690 textlen = gtk_text_buffer_get_char_count (textbuf);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
691 gtk_text_buffer_get_iter_at_offset (textbuf, &iter, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
692 gtk_text_buffer_get_iter_at_offset (textbuf, &iter2, textlen - 1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
693 txt = gtk_text_buffer_get_text (textbuf, &iter, &iter2, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
694 #endif
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
695
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
696 ok = 1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
697 pos = txt;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
698 do
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
699 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
700 if ((len = write (fileno (fd), pos, textlen)) == -1)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
701 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
702 ok = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
703 ftp_log (gftp_logging_misc, NULL, _("Error: Error writing to %s: %s\n"), filename, g_strerror (errno));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
704 break;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
705 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
706
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
707 textlen -= len;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
708 pos += len;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
709 } while (textlen > 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
710
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
711 if (ok)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
712 ftp_log (gftp_logging_misc, NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
713 _("Successfully wrote the log file to %s\n"), filename);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
714
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
715 fclose (fd);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
716 g_free (txt);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
717 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
718
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
719
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
720 void
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
721 savelog (gpointer data)
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
722 {
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
723 GtkWidget *filew;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
724
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
725 filew = gtk_file_selection_new (_("Save Log"));
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
726
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
727 gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (filew)->ok_button),
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
728 "clicked", GTK_SIGNAL_FUNC (dosavelog), filew);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
729 gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION (filew)->ok_button),
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
730 "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
731 GTK_OBJECT (filew));
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
732 gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION (filew)->cancel_button), "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_OBJECT (filew));
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
733
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
734 gtk_file_selection_set_filename (GTK_FILE_SELECTION (filew), "gftp.log");
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
735 gtk_window_set_wmclass (GTK_WINDOW(filew), "Save Log", "gFTP");
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
736 gtk_widget_show (filew);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
737 }
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
738
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
739
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
740 void
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
741 clear_cache (gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
742 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
743 gftp_clear_cache_files ();
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
744 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
745
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
746
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
747 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
748 about_dialog (gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
749 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
750 GtkWidget * tempwid, * notebook, * box, * label, * view, * vscroll,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
751 * dialog;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
752 char *tempstr, *no_license_agreement, *str, buf[255];
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
753 size_t len;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
754 FILE * fd;
45
311e29c40ed6 2002-10-31 Brian Masney <masneyb@gftp.org>
masneyb
parents: 42
diff changeset
755 #if GTK_MAJOR_VERSION > 1
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
756 GtkTextBuffer * textbuf;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
757 GtkTextIter iter;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
758 guint textlen;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
759 #endif
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
760
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
761 no_license_agreement = g_strdup_printf (_("Cannot find the license agreement file COPYING. Please make sure it is in either %s or in %s"), BASE_CONF_DIR, SHARE_DIR);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
762
45
311e29c40ed6 2002-10-31 Brian Masney <masneyb@gftp.org>
masneyb
parents: 42
diff changeset
763 #if GTK_MAJOR_VERSION == 1
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
764 dialog = gtk_dialog_new ();
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
765 gtk_window_set_title (GTK_WINDOW (dialog), _("About gFTP"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
766 gtk_container_border_width (GTK_CONTAINER
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
767 (GTK_DIALOG (dialog)->action_area), 5);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
768 gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dialog)->action_area), TRUE);
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
769 #else
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
770 dialog = gtk_dialog_new_with_buttons (_("About gFTP"), NULL, 0,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
771 GTK_STOCK_CLOSE,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
772 GTK_RESPONSE_CLOSE,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
773 NULL);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
774 #endif
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
775 gtk_window_set_wmclass (GTK_WINDOW(dialog), "about", "gFTP");
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
776 gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
777 gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 10);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
778 gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 5);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
779 gtk_widget_realize (dialog);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
780
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
781 if (gftp_icon != NULL)
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
782 {
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
783 gdk_window_set_icon (dialog->window, NULL, gftp_icon->pixmap,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
784 gftp_icon->bitmap);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
785 gdk_window_set_icon_name (dialog->window, _("gFTP Icon"));
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
786 }
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
787
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
788 notebook = gtk_notebook_new ();
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
789 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), notebook, TRUE,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
790 TRUE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
791 gtk_widget_show (notebook);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
792
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
793 box = gtk_vbox_new (TRUE, 5);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
794 gtk_container_border_width (GTK_CONTAINER (box), 10);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
795 gtk_widget_show (box);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
796
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
797 tempwid = toolbar_pixmap (dialog, "gftp-logo.xpm");
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
798 gtk_box_pack_start (GTK_BOX (box), tempwid, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
799 gtk_widget_show (tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
800
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
801 tempstr = g_strdup_printf (_("%s\nCopyright (C) 1998-2002 Brian Masney <masneyb@gftp.org>\nOfficial Homepage: http://www.gftp.org/\nLogo by: Aaron Worley <planet_hoth@yahoo.com>\n"), gftp_version);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
802 str = _("Translated by");
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
803 if (strcmp (str, "Translated by") != 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
804 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
805 tempstr = g_realloc (tempstr, strlen (tempstr) + strlen (str) + 1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
806 strcat (tempstr, str);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
807 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
808 tempwid = gtk_label_new (tempstr);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
809 g_free (tempstr);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
810 gtk_box_pack_start (GTK_BOX (box), tempwid, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
811 gtk_widget_show (tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
812
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
813 label = gtk_label_new (_("About"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
814 gtk_widget_show (label);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
815
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
816 gtk_notebook_append_page (GTK_NOTEBOOK (notebook), box, label);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
817
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
818 box = gtk_vbox_new (FALSE, 5);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
819 gtk_container_border_width (GTK_CONTAINER (box), 10);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
820 gtk_widget_show (box);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
821
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
822 tempwid = gtk_table_new (1, 2, FALSE);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
823 gtk_box_pack_start (GTK_BOX (box), tempwid, TRUE, TRUE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
824 gtk_widget_show (tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
825
45
311e29c40ed6 2002-10-31 Brian Masney <masneyb@gftp.org>
masneyb
parents: 42
diff changeset
826 #if GTK_MAJOR_VERSION == 1
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
827 view = gtk_text_new (NULL, NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
828 gtk_text_set_editable (GTK_TEXT (view), FALSE);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
829 gtk_text_set_word_wrap (GTK_TEXT (view), TRUE);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
830
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
831 gtk_table_attach (GTK_TABLE (tempwid), view, 0, 1, 0, 1,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
832 GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND | GTK_SHRINK,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
833 0, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
834 gtk_widget_show (view);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
835
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
836 vscroll = gtk_vscrollbar_new (GTK_TEXT (view)->vadj);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
837 gtk_table_attach (GTK_TABLE (tempwid), vscroll, 1, 2, 0, 1,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
838 GTK_FILL, GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
839 gtk_widget_show (vscroll);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
840 #else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
841 view = gtk_text_view_new ();
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
842 gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
843 gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
844 gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), GTK_WRAP_WORD);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
845
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
846 vscroll = gtk_scrolled_window_new (NULL, NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
847 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (vscroll),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
848 GTK_POLICY_AUTOMATIC,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
849 GTK_POLICY_AUTOMATIC);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
850
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
851 gtk_container_add (GTK_CONTAINER (vscroll), view);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
852 gtk_widget_show (view);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
853
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
854 gtk_table_attach (GTK_TABLE (tempwid), vscroll, 0, 1, 0, 1,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
855 GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND | GTK_SHRINK,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
856 0, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
857 gtk_widget_show (vscroll);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
858
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
859 textbuf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
860 #endif
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
861
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
862 label = gtk_label_new (_("License Agreement"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
863 gtk_widget_show (label);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
864
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
865 gtk_notebook_append_page (GTK_NOTEBOOK (notebook), box, label);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
866
45
311e29c40ed6 2002-10-31 Brian Masney <masneyb@gftp.org>
masneyb
parents: 42
diff changeset
867 #if GTK_MAJOR_VERSION == 1
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
868 tempwid = gtk_button_new_with_label (_(" Close "));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
869 GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
870 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), tempwid,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
871 FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
872 gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
873 GTK_SIGNAL_FUNC (gtk_widget_destroy),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
874 GTK_OBJECT (dialog));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
875 gtk_widget_grab_default (tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
876 gtk_widget_show (tempwid);
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
877 #else
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
878 g_signal_connect_swapped (GTK_OBJECT (dialog), "response",
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
879 G_CALLBACK (gtk_widget_destroy),
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
880 GTK_OBJECT (dialog));
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 14
diff changeset
881 #endif
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
882
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
883 tempstr = g_strconcat ("/usr/share/common-licenses/GPL", NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
884 if (access (tempstr, F_OK) != 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
885 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
886 g_free (tempstr);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
887 tempstr = expand_path (SHARE_DIR "/COPYING");
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
888 if (access (tempstr, F_OK) != 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
889 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
890 g_free (tempstr);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
891 tempstr = expand_path (BASE_CONF_DIR "/COPYING");
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
892 if (access (tempstr, F_OK) != 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
893 {
45
311e29c40ed6 2002-10-31 Brian Masney <masneyb@gftp.org>
masneyb
parents: 42
diff changeset
894 #if GTK_MAJOR_VERSION == 1
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
895 gtk_text_insert (GTK_TEXT (view), NULL, NULL, NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
896 no_license_agreement, -1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
897 #else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
898 textlen = gtk_text_buffer_get_char_count (textbuf);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
899 gtk_text_buffer_get_iter_at_offset (textbuf, &iter, textlen - 1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
900 gtk_text_buffer_insert (textbuf, &iter, no_license_agreement, -1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
901 #endif
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
902 gtk_widget_show (dialog);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
903 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
904 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
905 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
906 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
907
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
908 if ((fd = fopen (tempstr, "r")) == NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
909 {
45
311e29c40ed6 2002-10-31 Brian Masney <masneyb@gftp.org>
masneyb
parents: 42
diff changeset
910 #if GTK_MAJOR_VERSION == 1
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
911 gtk_text_insert (GTK_TEXT (view), NULL, NULL, NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
912 no_license_agreement, -1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
913 #else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
914 textlen = gtk_text_buffer_get_char_count (textbuf);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
915 gtk_text_buffer_get_iter_at_offset (textbuf, &iter, textlen - 1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
916 gtk_text_buffer_insert (textbuf, &iter, no_license_agreement, -1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
917 #endif
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
918 gtk_widget_show (dialog);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
919 g_free (tempstr);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
920 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
921 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
922 g_free (tempstr);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
923
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
924 memset (buf, 0, sizeof (buf));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
925 while ((len = fread (buf, 1, sizeof (buf) - 1, fd)))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
926 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
927 buf[len] = '\0';
45
311e29c40ed6 2002-10-31 Brian Masney <masneyb@gftp.org>
masneyb
parents: 42
diff changeset
928 #if GTK_MAJOR_VERSION == 1
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
929 gtk_text_insert (GTK_TEXT (view), NULL, NULL, NULL, buf, -1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
930 #else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
931 textlen = gtk_text_buffer_get_char_count (textbuf);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
932 gtk_text_buffer_get_iter_at_offset (textbuf, &iter, textlen - 1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
933 gtk_text_buffer_insert (textbuf, &iter, buf, -1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
934 #endif
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
935 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
936 fclose (fd);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
937 gtk_widget_show (dialog);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
938 g_free (no_license_agreement);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
939 gftp_free_pixmap ("gftp-logo.xpm");
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
940 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
941
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
942
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
943 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
944 compare_windows (gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
945 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
946 gftp_file * curfle, * otherfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
947 GList * curlist, * otherlist;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
948 int row;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
949
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
950 if (!check_status (_("Compare Windows"), &window2, 1, 0, 0, 1))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
951 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
952
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
953 deselectall (&window1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
954 deselectall (&window2);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
955
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
956 row = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
957 curlist = window1.files;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
958 while (curlist != NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
959 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
960 curfle = curlist->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
961 if (!curfle->shown)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
962 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
963 curlist = curlist->next;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
964 continue;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
965 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
966
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
967 otherlist = window2.files;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
968 while (otherlist != NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
969 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
970 otherfle = otherlist->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
971 if (!otherfle->shown)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
972 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
973 otherlist = otherlist->next;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
974 continue;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
975 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
976
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
977 if (strcmp (otherfle->file, curfle->file) == 0 &&
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
978 otherfle->isdir == curfle->isdir &&
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
979 (curfle->isdir || otherfle->size == curfle->size))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
980 break;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
981
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
982 otherlist = otherlist->next;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
983 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
984
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
985 if (otherlist == NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
986 gtk_clist_select_row (GTK_CLIST (window1.listbox), row, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
987 row++;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
988 curlist = curlist->next;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
989 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
990
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
991 row = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
992 curlist = window2.files;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
993 while (curlist != NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
994 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
995 curfle = curlist->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
996 if (!curfle->shown)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
997 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
998 curlist = curlist->next;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
999 continue;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1000 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1001
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1002 otherlist = window1.files;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1003 while (otherlist != NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1004 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1005 otherfle = otherlist->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1006 if (!otherfle->shown)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1007 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1008 otherlist = otherlist->next;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1009 continue;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1010 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1011
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1012 if (strcmp (otherfle->file, curfle->file) == 0 &&
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1013 otherfle->isdir == curfle->isdir &&
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1014 (curfle->isdir || otherfle->size == curfle->size))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1015 break;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1016
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1017 otherlist = otherlist->next;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1018 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1019
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1020 if (otherlist == NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1021 gtk_clist_select_row (GTK_CLIST (window2.listbox), row, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1022 row++;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1023 curlist = curlist->next;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1024 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1025 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1026