1
|
1 /*****************************************************************************/
|
|
2 /* menu-items.c - menu callbacks */
|
|
3 /* Copyright (C) 1998-2002 Brian Masney <masneyb@gftp.org> */
|
|
4 /* */
|
|
5 /* This program is free software; you can redistribute it and/or modify */
|
|
6 /* it under the terms of the GNU General Public License as published by */
|
|
7 /* the Free Software Foundation; either version 2 of the License, or */
|
|
8 /* (at your option) any later version. */
|
|
9 /* */
|
|
10 /* This program is distributed in the hope that it will be useful, */
|
|
11 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
|
12 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
|
13 /* GNU General Public License for more details. */
|
|
14 /* */
|
|
15 /* You should have received a copy of the GNU General Public License */
|
|
16 /* along with this program; if not, write to the Free Software */
|
|
17 /* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|
18 /*****************************************************************************/
|
|
19
|
|
20 #include <gftp-gtk.h>
|
33
|
21 static const char cvsid[] = "$Id$";
|
1
|
22
|
|
23 static GtkWidget * proxy_text, * proxy_list, * new_proxy_domain, * network1,
|
|
24 * network2, * network3, * network4, * netmask1, * netmask2,
|
|
25 * netmask3, * netmask4, * domain_active, * proxy_combo,
|
|
26 * def_proto_combo;
|
|
27 static GList * new_proxy_hosts;
|
|
28 static char *custom_proxy;
|
|
29
|
48
|
30
|
|
31 static void
|
|
32 clean_old_changes (GtkWidget * widget, gpointer data)
|
|
33 {
|
|
34 gftp_proxy_hosts *hosts;
|
|
35 GList *templist;
|
|
36
|
|
37 templist = new_proxy_hosts;
|
|
38 while (templist != NULL)
|
|
39 {
|
|
40 hosts = templist->data;
|
|
41 if (hosts->domain)
|
|
42 g_free (hosts->domain);
|
|
43 g_free (hosts);
|
|
44 templist = templist->next;
|
|
45 }
|
|
46 g_list_free (new_proxy_hosts);
|
|
47 new_proxy_hosts = NULL;
|
|
48
|
|
49 if (custom_proxy != NULL)
|
|
50 {
|
|
51 g_free (custom_proxy);
|
|
52 custom_proxy = NULL;
|
|
53 }
|
|
54 }
|
|
55
|
|
56
|
|
57 static char *
|
|
58 get_proxy_config (void)
|
|
59 {
|
|
60 char *newstr, *oldstr, *pos, *endpos, *textstr;
|
|
61 guint len;
|
|
62 #if GTK_MAJOR_VERSION == 1
|
|
63 char tmp[128];
|
|
64 #else
|
|
65 GtkTextBuffer * textbuf;
|
|
66 GtkTextIter iter, iter2;
|
|
67 #endif
|
|
68
|
|
69 textstr = NULL;
|
|
70 newstr = g_malloc (1);
|
|
71 *newstr = '\0';
|
|
72
|
|
73 #if GTK_MAJOR_VERSION == 1
|
|
74 /*
|
|
75 GTK_TEXT uses wchar_t instead of char in environment of multibyte encoding
|
|
76 locale (ex Japanese), so we must convert from wide character
|
|
77 to multibyte charator.... Yasuyuki Furukawa (yasu@on.cs.keio.ac.jp)
|
|
78 */
|
|
79 if (GTK_TEXT (proxy_text)->use_wchar)
|
|
80 {
|
|
81 wcstombs (tmp, (wchar_t *) GTK_TEXT (proxy_text)->text.wc,
|
|
82 sizeof (tmp));
|
|
83 pos = tmp;
|
|
84 }
|
|
85 else
|
|
86 {
|
|
87 oldstr = (char *) GTK_TEXT (proxy_text)->text.ch;
|
|
88 len = gtk_text_get_length (GTK_TEXT (proxy_text));
|
|
89 textstr = g_malloc (len + 1);
|
|
90 strncpy (textstr, oldstr, len);
|
|
91 textstr[len] = '\0';
|
|
92 pos = textstr;
|
|
93 }
|
|
94 #else
|
|
95 textbuf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (proxy_text));
|
|
96 len = gtk_text_buffer_get_char_count (textbuf);
|
|
97 gtk_text_buffer_get_iter_at_offset (textbuf, &iter, 0);
|
|
98 gtk_text_buffer_get_iter_at_offset (textbuf, &iter2, len - 1);
|
|
99 pos = textstr = gtk_text_buffer_get_text (textbuf, &iter, &iter2, 0);
|
|
100 #endif
|
|
101
|
|
102 do
|
|
103 {
|
|
104 if ((endpos = strchr (pos, '\n')) != NULL)
|
|
105 *endpos = '\0';
|
|
106 oldstr = newstr;
|
|
107 if (endpos != NULL)
|
|
108 newstr = g_strconcat (newstr, pos, "%n", NULL);
|
|
109 else
|
|
110 newstr = g_strconcat (newstr, pos, NULL);
|
|
111 g_free (oldstr);
|
|
112 if (endpos != NULL)
|
|
113 {
|
|
114 *endpos = '\n';
|
|
115 pos = endpos + 1;
|
|
116 }
|
|
117 }
|
|
118 while (endpos != NULL);
|
|
119
|
|
120 #if GTK_MAJOR_VERSION == 1
|
|
121 if (!GTK_TEXT (proxy_text)->use_wchar)
|
|
122 g_free (textstr);
|
|
123 #else
|
|
124 g_free (textstr);
|
|
125 #endif
|
|
126
|
|
127 return (newstr);
|
|
128 }
|
|
129
|
|
130
|
|
131 static void
|
|
132 apply_changes (GtkWidget * widget, gpointer data)
|
|
133 {
|
|
134 const char *tempstr;
|
|
135 int num, found, i;
|
|
136 GList *templist;
|
|
137
|
|
138 for (num = 0; config_file_vars[num].var != NULL; num++)
|
|
139 {
|
|
140 if (config_file_vars[num].widget != NULL)
|
|
141 {
|
|
142 switch (config_file_vars[num].type)
|
|
143 {
|
|
144 case CONFIG_CHECKBOX:
|
|
145 *(int *) config_file_vars[num].var =
|
|
146 GTK_TOGGLE_BUTTON (config_file_vars[num].widget)->active;
|
|
147 break;
|
|
148 case CONFIG_INTTEXT:
|
|
149 case CONFIG_UINTTEXT:
|
|
150 tempstr = gtk_entry_get_text (
|
|
151 GTK_ENTRY (config_file_vars[num].widget));
|
|
152 *(int *) config_file_vars[num].var = strtol (tempstr, NULL, 10);
|
|
153 break;
|
|
154 case CONFIG_FLOATTEXT:
|
|
155 tempstr = gtk_entry_get_text (
|
|
156 GTK_ENTRY (config_file_vars[num].widget));
|
|
157 *(double *) config_file_vars[num].var = strtod (tempstr, NULL);
|
|
158 break;
|
|
159 case CONFIG_CHARTEXT:
|
|
160 case CONFIG_CHARPASS:
|
|
161 tempstr = gtk_entry_get_text (
|
|
162 GTK_ENTRY (config_file_vars[num].widget));
|
|
163 g_free (*(char **) config_file_vars[num].var);
|
|
164 *(char **) config_file_vars[num].var =
|
|
165 g_malloc (strlen (tempstr) + 1);
|
|
166 strcpy (*(char **) config_file_vars[num].var, tempstr);
|
|
167 break;
|
|
168 }
|
|
169 }
|
|
170 }
|
|
171
|
|
172 tempstr = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (def_proto_combo)->entry));
|
|
173 found = 0;
|
|
174 for (i = 0; gftp_protocols[i].name; i++)
|
|
175 {
|
|
176 if (strcmp (gftp_protocols[i].name, tempstr) == 0)
|
|
177 {
|
|
178 found = 1;
|
|
179 break;
|
|
180 }
|
|
181 }
|
|
182
|
|
183 if (found)
|
|
184 {
|
|
185 g_free (default_protocol);
|
|
186 default_protocol = g_strconcat (tempstr, NULL);
|
|
187 }
|
|
188
|
|
189 templist = proxy_hosts;
|
|
190 proxy_hosts = new_proxy_hosts;
|
|
191 new_proxy_hosts = templist;
|
|
192 clean_old_changes (NULL, NULL);
|
|
193
|
|
194 if (proxy_config != NULL)
|
|
195 g_free (proxy_config);
|
|
196 proxy_config = get_proxy_config ();
|
|
197
|
|
198 gftp_write_config_file ();
|
|
199 }
|
|
200
|
|
201
|
45
|
202 #if GTK_MAJOR_VERSION > 1
|
19
|
203 static void
|
|
204 options_action (GtkWidget * widget, gint response, gpointer user_data)
|
|
205 {
|
|
206 switch (response)
|
|
207 {
|
|
208 case GTK_RESPONSE_APPLY:
|
|
209 apply_changes (widget, NULL);
|
|
210 break;
|
|
211 case GTK_RESPONSE_OK:
|
|
212 apply_changes (widget, NULL);
|
|
213 /* no break */
|
|
214 default:
|
|
215 gtk_widget_destroy (widget);
|
|
216 }
|
|
217 }
|
|
218 #endif
|
|
219
|
|
220
|
48
|
221 static void
|
|
222 proxy_toggle (GtkList * list, GtkWidget * child, gpointer data)
|
|
223 {
|
|
224 int proxy_num;
|
|
225 char *str;
|
|
226
|
|
227 #if GTK_MAJOR_VERSION > 1
|
|
228 GtkTextIter iter, iter2;
|
|
229 GtkTextBuffer * textbuf;
|
|
230 guint len;
|
|
231 #endif
|
|
232
|
|
233 proxy_num = gtk_list_child_position (list, child);
|
|
234 if (proxy_num == GFTP_CUSTOM_PROXY_NUM)
|
|
235 str = custom_proxy;
|
|
236 else
|
|
237 str = proxy_type[proxy_num].description;
|
|
238
|
|
239 #if GTK_MAJOR_VERSION == 1
|
|
240 gtk_text_set_point (GTK_TEXT (proxy_text), 0);
|
|
241 gtk_text_forward_delete (GTK_TEXT (proxy_text),
|
|
242 gtk_text_get_length (GTK_TEXT (proxy_text)));
|
|
243
|
|
244 gtk_text_insert (GTK_TEXT (proxy_text), NULL, NULL, NULL, str, -1);
|
|
245 #else
|
|
246 textbuf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (proxy_text));
|
|
247 len = gtk_text_buffer_get_char_count (textbuf);
|
|
248 gtk_text_buffer_get_iter_at_offset (textbuf, &iter, 0);
|
|
249 gtk_text_buffer_get_iter_at_offset (textbuf, &iter2, len - 1);
|
|
250 gtk_text_buffer_delete (textbuf, &iter, &iter2);
|
|
251
|
|
252 len = gtk_text_buffer_get_char_count (textbuf);
|
|
253 gtk_text_buffer_get_iter_at_offset (textbuf, &iter, len - 1);
|
|
254 gtk_text_buffer_insert (textbuf, &iter, str, -1);
|
|
255 #endif
|
|
256 }
|
|
257
|
|
258
|
|
259 static void
|
|
260 add_host_to_listbox (GList * templist)
|
|
261 {
|
|
262 gftp_proxy_hosts *hosts;
|
|
263 char *add_data[2];
|
|
264 int num;
|
|
265
|
|
266 hosts = templist->data;
|
|
267 if (hosts->domain)
|
|
268 {
|
|
269 add_data[0] = hosts->domain;
|
|
270 add_data[1] = NULL;
|
|
271 num = gtk_clist_append (GTK_CLIST (proxy_list), add_data);
|
|
272 }
|
|
273 else
|
|
274 {
|
|
275 add_data[0] = g_strdup_printf ("%d.%d.%d.%d",
|
|
276 hosts->ipv4_network_address >> 24 & 0xff,
|
|
277 hosts->ipv4_network_address >> 16 & 0xff,
|
|
278 hosts->ipv4_network_address >> 8 & 0xff,
|
|
279 hosts->ipv4_network_address & 0xff);
|
|
280 add_data[1] = g_strdup_printf ("%d.%d.%d.%d",
|
|
281 hosts->ipv4_netmask >> 24 & 0xff,
|
|
282 hosts->ipv4_netmask >> 16 & 0xff,
|
|
283 hosts->ipv4_netmask >> 8 & 0xff,
|
|
284 hosts->ipv4_netmask & 0xff);
|
|
285 num = gtk_clist_append (GTK_CLIST (proxy_list), add_data);
|
|
286 g_free (add_data[0]);
|
|
287 g_free (add_data[1]);
|
|
288 }
|
|
289 gtk_clist_set_row_data (GTK_CLIST (proxy_list), num, (gpointer) templist);
|
|
290 }
|
|
291
|
|
292
|
|
293 static void
|
|
294 add_ok (GtkWidget * widget, gpointer data)
|
|
295 {
|
|
296 gftp_proxy_hosts *hosts;
|
|
297 const char *edttxt;
|
|
298 GList *templist;
|
|
299 int num;
|
|
300
|
|
301 if ((templist = data) == NULL)
|
|
302 {
|
|
303 hosts = g_malloc0 (sizeof (*hosts));
|
|
304 new_proxy_hosts = g_list_append (new_proxy_hosts, hosts);
|
|
305 for (templist = new_proxy_hosts; templist->next != NULL;
|
|
306 templist = templist->next);
|
|
307 }
|
|
308 else
|
|
309 {
|
|
310 num = gtk_clist_find_row_from_data (GTK_CLIST (proxy_list), templist);
|
|
311 if (num != -1)
|
|
312 gtk_clist_remove (GTK_CLIST (proxy_list), num);
|
|
313 hosts = templist->data;
|
|
314 }
|
|
315
|
|
316 if (hosts->domain)
|
|
317 {
|
|
318 g_free (hosts->domain);
|
|
319 hosts->domain = NULL;
|
|
320 }
|
|
321
|
|
322 if (GTK_TOGGLE_BUTTON (domain_active)->active)
|
|
323 {
|
|
324 edttxt = gtk_entry_get_text (GTK_ENTRY (new_proxy_domain));
|
|
325 hosts->domain = g_malloc (strlen (edttxt) + 1);
|
|
326 strcpy (hosts->domain, edttxt);
|
|
327 hosts->ipv4_netmask = hosts->ipv4_network_address = 0;
|
|
328 }
|
|
329 else
|
|
330 {
|
|
331 edttxt = gtk_entry_get_text (GTK_ENTRY (network1));
|
|
332 hosts->ipv4_network_address = (strtol (edttxt, NULL, 10) & 0xff) << 24;
|
|
333
|
|
334 edttxt = gtk_entry_get_text (GTK_ENTRY (network2));
|
|
335 hosts->ipv4_network_address |= (strtol (edttxt, NULL, 10) & 0xff) << 16;
|
|
336
|
|
337 edttxt = gtk_entry_get_text (GTK_ENTRY (network3));
|
|
338 hosts->ipv4_network_address |= (strtol (edttxt, NULL, 10) & 0xff) << 8;
|
|
339
|
|
340 edttxt = gtk_entry_get_text (GTK_ENTRY (network4));
|
|
341 hosts->ipv4_network_address |= strtol (edttxt, NULL, 10) & 0xff;
|
|
342
|
|
343 edttxt = gtk_entry_get_text (GTK_ENTRY (netmask1));
|
|
344 hosts->ipv4_netmask = (strtol (edttxt, NULL, 10) & 0xff) << 24;
|
|
345
|
|
346 edttxt = gtk_entry_get_text (GTK_ENTRY (netmask2));
|
|
347 hosts->ipv4_netmask |= (strtol (edttxt, NULL, 10) & 0xff) << 16;
|
|
348
|
|
349 edttxt = gtk_entry_get_text (GTK_ENTRY (netmask3));
|
|
350 hosts->ipv4_netmask |= (strtol (edttxt, NULL, 10) & 0xff) << 8;
|
|
351
|
|
352 edttxt = gtk_entry_get_text (GTK_ENTRY (netmask4));
|
|
353 hosts->ipv4_netmask |= strtol (edttxt, NULL, 10) & 0xff;
|
|
354 }
|
|
355 add_host_to_listbox (templist);
|
|
356 }
|
|
357
|
|
358
|
|
359 #if GTK_MAJOR_VERSION > 1
|
|
360 static void
|
|
361 proxyhosts_action (GtkWidget * widget, gint response, gpointer user_data)
|
|
362 {
|
|
363 switch (response)
|
|
364 {
|
|
365 case GTK_RESPONSE_OK:
|
|
366 add_ok (widget, user_data);
|
|
367 /* no break */
|
|
368 default:
|
|
369 gtk_widget_destroy (widget);
|
|
370 }
|
|
371 }
|
|
372 #endif
|
|
373
|
|
374
|
|
375 static void
|
|
376 add_toggle (GtkWidget * widget, gpointer data)
|
|
377 {
|
|
378 gtk_widget_set_sensitive (new_proxy_domain, data != NULL);
|
|
379 gtk_widget_set_sensitive (network1, data == NULL);
|
|
380 gtk_widget_set_sensitive (network2, data == NULL);
|
|
381 gtk_widget_set_sensitive (network3, data == NULL);
|
|
382 gtk_widget_set_sensitive (network4, data == NULL);
|
|
383 gtk_widget_set_sensitive (netmask1, data == NULL);
|
|
384 gtk_widget_set_sensitive (netmask2, data == NULL);
|
|
385 gtk_widget_set_sensitive (netmask3, data == NULL);
|
|
386 gtk_widget_set_sensitive (netmask4, data == NULL);
|
|
387 }
|
|
388
|
|
389
|
|
390 static void
|
|
391 delete_proxy_host (GtkWidget * widget, gpointer data)
|
|
392 {
|
|
393 GList *templist;
|
|
394 int num;
|
|
395
|
|
396 if ((templist = GTK_CLIST (proxy_list)->selection) == NULL)
|
|
397 return;
|
|
398 num = (int) templist->data;
|
|
399 templist = gtk_clist_get_row_data (GTK_CLIST (proxy_list), num);
|
|
400 new_proxy_hosts = g_list_remove_link (new_proxy_hosts, templist);
|
|
401 gtk_clist_remove (GTK_CLIST (proxy_list), num);
|
|
402 }
|
|
403
|
|
404
|
|
405 static void
|
|
406 add_proxy_host (GtkWidget * widget, gpointer data)
|
|
407 {
|
|
408 GtkWidget *tempwid, *dialog, *frame, *box, *table;
|
|
409 gftp_proxy_hosts *hosts;
|
|
410 char *tempstr, *title;
|
|
411 GList *templist;
|
|
412
|
|
413 if (data)
|
|
414 {
|
|
415 if ((templist = GTK_CLIST (proxy_list)->selection) == NULL)
|
|
416 return;
|
|
417 templist = gtk_clist_get_row_data (GTK_CLIST (proxy_list),
|
|
418 (int) templist->data);
|
|
419 hosts = templist->data;
|
|
420 }
|
|
421 else
|
|
422 {
|
|
423 hosts = NULL;
|
|
424 templist = NULL;
|
|
425 }
|
|
426
|
|
427 title = hosts ? _("Edit Host") : _("Add Host");
|
|
428 #if GTK_MAJOR_VERSION == 1
|
|
429 dialog = gtk_dialog_new ();
|
|
430 gtk_window_set_title (GTK_WINDOW (dialog), title);
|
|
431 gtk_container_border_width (GTK_CONTAINER
|
|
432 (GTK_DIALOG (dialog)->action_area), 5);
|
|
433 gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->action_area), 15);
|
|
434 gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dialog)->action_area), TRUE);
|
|
435 gtk_grab_add (dialog);
|
|
436 #else
|
|
437 dialog = gtk_dialog_new_with_buttons (title, NULL, 0,
|
|
438 GTK_STOCK_SAVE,
|
|
439 GTK_RESPONSE_OK,
|
|
440 GTK_STOCK_CANCEL,
|
|
441 GTK_RESPONSE_CANCEL,
|
|
442 NULL);
|
|
443 #endif
|
|
444 gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 10);
|
|
445 gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 2);
|
|
446 gtk_window_set_wmclass (GTK_WINDOW(dialog), "hostinfo", "Gftp");
|
|
447 gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
|
|
448
|
|
449 frame = gtk_frame_new (NULL);
|
|
450 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), frame, TRUE, TRUE,
|
|
451 0);
|
|
452 gtk_widget_show (frame);
|
|
453
|
|
454 box = gtk_hbox_new (FALSE, 5);
|
|
455 gtk_container_border_width (GTK_CONTAINER (box), 5);
|
|
456 gtk_container_add (GTK_CONTAINER (frame), box);
|
|
457 gtk_widget_show (box);
|
|
458
|
|
459 tempwid = gtk_label_new (_("Domain"));
|
|
460 gtk_box_pack_start (GTK_BOX (box), tempwid, TRUE, TRUE, 0);
|
|
461 gtk_widget_show (tempwid);
|
|
462
|
|
463 new_proxy_domain = gtk_entry_new ();
|
|
464 gtk_box_pack_start (GTK_BOX (box), new_proxy_domain, TRUE, TRUE, 0);
|
|
465 gtk_widget_show (new_proxy_domain);
|
|
466
|
|
467 frame = gtk_frame_new (NULL);
|
|
468 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), frame, TRUE, TRUE,
|
|
469 0);
|
|
470 gtk_widget_show (frame);
|
|
471
|
|
472 table = gtk_table_new (4, 2, FALSE);
|
|
473 gtk_container_border_width (GTK_CONTAINER (table), 5);
|
|
474 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
|
|
475 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
|
|
476 gtk_container_add (GTK_CONTAINER (frame), table);
|
|
477 gtk_widget_show (table);
|
|
478
|
|
479 tempwid = gtk_label_new (_("Network Address"));
|
|
480 gtk_misc_set_alignment (GTK_MISC (tempwid), 1, 0.5);
|
|
481 gtk_table_attach_defaults (GTK_TABLE (table), tempwid, 0, 1, 0, 1);
|
|
482 gtk_widget_show (tempwid);
|
|
483
|
|
484 box = gtk_hbox_new (FALSE, 5);
|
|
485 gtk_table_attach_defaults (GTK_TABLE (table), box, 1, 2, 0, 1);
|
|
486 gtk_widget_show (box);
|
|
487
|
|
488 network1 = gtk_entry_new ();
|
|
489 gtk_widget_set_size_request (network1, 28, -1);
|
|
490
|
|
491 gtk_box_pack_start (GTK_BOX (box), network1, TRUE, TRUE, 0);
|
|
492 gtk_widget_show (network1);
|
|
493
|
|
494 network2 = gtk_entry_new ();
|
|
495 gtk_widget_set_size_request (network2, 28, -1);
|
|
496
|
|
497 gtk_box_pack_start (GTK_BOX (box), network2, TRUE, TRUE, 0);
|
|
498 gtk_widget_show (network2);
|
|
499
|
|
500 network3 = gtk_entry_new ();
|
|
501 gtk_widget_set_size_request (network3, 28, -1);
|
|
502
|
|
503 gtk_box_pack_start (GTK_BOX (box), network3, TRUE, TRUE, 0);
|
|
504 gtk_widget_show (network3);
|
|
505
|
|
506 network4 = gtk_entry_new ();
|
|
507 gtk_widget_set_size_request (network4, 28, -1);
|
|
508
|
|
509 gtk_box_pack_start (GTK_BOX (box), network4, TRUE, TRUE, 0);
|
|
510 gtk_widget_show (network4);
|
|
511
|
|
512 tempwid = gtk_label_new (_("Netmask"));
|
|
513 gtk_misc_set_alignment (GTK_MISC (tempwid), 1, 0.5);
|
|
514 gtk_table_attach_defaults (GTK_TABLE (table), tempwid, 0, 1, 1, 2);
|
|
515 gtk_widget_show (tempwid);
|
|
516
|
|
517 box = gtk_hbox_new (FALSE, 5);
|
|
518 gtk_table_attach_defaults (GTK_TABLE (table), box, 1, 2, 1, 2);
|
|
519 gtk_widget_show (box);
|
|
520
|
|
521 netmask1 = gtk_entry_new ();
|
|
522 gtk_widget_set_size_request (netmask1, 28, -1);
|
|
523
|
|
524 gtk_box_pack_start (GTK_BOX (box), netmask1, TRUE, TRUE, 0);
|
|
525 gtk_widget_show (netmask1);
|
|
526
|
|
527 netmask2 = gtk_entry_new ();
|
|
528 gtk_widget_set_size_request (netmask2, 28, -1);
|
|
529
|
|
530 gtk_box_pack_start (GTK_BOX (box), netmask2, TRUE, TRUE, 0);
|
|
531 gtk_widget_show (netmask2);
|
|
532
|
|
533 netmask3 = gtk_entry_new ();
|
|
534 gtk_widget_set_size_request (netmask3, 28, -1);
|
|
535
|
|
536 gtk_box_pack_start (GTK_BOX (box), netmask3, TRUE, TRUE, 0);
|
|
537 gtk_widget_show (netmask3);
|
|
538
|
|
539 netmask4 = gtk_entry_new ();
|
|
540 gtk_widget_set_size_request (netmask4, 28, -1);
|
|
541
|
|
542 gtk_box_pack_start (GTK_BOX (box), netmask4, TRUE, TRUE, 0);
|
|
543 gtk_widget_show (netmask4);
|
|
544
|
|
545 box = gtk_hbox_new (FALSE, 5);
|
|
546 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), box, TRUE, TRUE,
|
|
547 0);
|
|
548 gtk_widget_show (box);
|
|
549
|
|
550 domain_active = gtk_radio_button_new_with_label (NULL, _("Domain"));
|
|
551 gtk_signal_connect (GTK_OBJECT (domain_active), "toggled",
|
|
552 GTK_SIGNAL_FUNC (add_toggle), (gpointer) 1);
|
|
553 gtk_box_pack_start (GTK_BOX (box), domain_active, TRUE, TRUE, 0);
|
|
554 gtk_widget_show (domain_active);
|
|
555
|
|
556 tempwid = gtk_radio_button_new_with_label (gtk_radio_button_group
|
|
557 (GTK_RADIO_BUTTON (domain_active)),
|
|
558 _("Network"));
|
|
559 gtk_signal_connect (GTK_OBJECT (tempwid), "toggled",
|
|
560 GTK_SIGNAL_FUNC (add_toggle), NULL);
|
|
561 gtk_box_pack_start (GTK_BOX (box), tempwid, TRUE, TRUE, 0);
|
|
562 gtk_widget_show (tempwid);
|
|
563
|
|
564 if (!hosts || !hosts->domain)
|
|
565 {
|
|
566 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (tempwid), TRUE);
|
|
567 add_toggle (NULL, NULL);
|
|
568 }
|
|
569 else
|
|
570 {
|
|
571 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (domain_active), TRUE);
|
|
572 add_toggle (NULL, (gpointer) 1);
|
|
573 }
|
|
574
|
|
575 if (hosts)
|
|
576 {
|
|
577 if (hosts->domain)
|
|
578 gtk_entry_set_text (GTK_ENTRY (new_proxy_domain), hosts->domain);
|
|
579 else
|
|
580 {
|
|
581 tempstr = g_strdup_printf ("%d", hosts->ipv4_network_address >> 24 & 0xff);
|
|
582 gtk_entry_set_text (GTK_ENTRY (network1), tempstr);
|
|
583 g_free (tempstr);
|
|
584
|
|
585 tempstr = g_strdup_printf ("%d", hosts->ipv4_network_address >> 16 & 0xff);
|
|
586 gtk_entry_set_text (GTK_ENTRY (network2), tempstr);
|
|
587 g_free (tempstr);
|
|
588
|
|
589 tempstr = g_strdup_printf ("%d", hosts->ipv4_network_address >> 8 & 0xff);
|
|
590 gtk_entry_set_text (GTK_ENTRY (network3), tempstr);
|
|
591 g_free (tempstr);
|
|
592
|
|
593 tempstr = g_strdup_printf ("%d", hosts->ipv4_network_address & 0xff);
|
|
594 gtk_entry_set_text (GTK_ENTRY (network4), tempstr);
|
|
595 g_free (tempstr);
|
|
596
|
|
597 tempstr = g_strdup_printf ("%d", hosts->ipv4_netmask >> 24 & 0xff);
|
|
598 gtk_entry_set_text (GTK_ENTRY (netmask1), tempstr);
|
|
599 g_free (tempstr);
|
|
600
|
|
601 tempstr = g_strdup_printf ("%d", hosts->ipv4_netmask >> 16 & 0xff);
|
|
602 gtk_entry_set_text (GTK_ENTRY (netmask2), tempstr);
|
|
603 g_free (tempstr);
|
|
604
|
|
605 tempstr = g_strdup_printf ("%d", hosts->ipv4_netmask >> 8 & 0xff);
|
|
606 gtk_entry_set_text (GTK_ENTRY (netmask3), tempstr);
|
|
607 g_free (tempstr);
|
|
608
|
|
609 tempstr = g_strdup_printf ("%d", hosts->ipv4_netmask & 0xff);
|
|
610 gtk_entry_set_text (GTK_ENTRY (netmask4), tempstr);
|
|
611 g_free (tempstr);
|
|
612 }
|
|
613 }
|
|
614
|
|
615 #if GTK_MAJOR_VERSION == 1
|
|
616 tempwid = gtk_button_new_with_label (_("OK"));
|
|
617 GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
|
|
618 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), tempwid,
|
|
619 TRUE, TRUE, 0);
|
|
620 gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
|
|
621 GTK_SIGNAL_FUNC (add_ok), (gpointer) templist);
|
|
622 gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked",
|
|
623 GTK_SIGNAL_FUNC (gtk_widget_destroy),
|
|
624 GTK_OBJECT (dialog));
|
|
625 gtk_widget_show (tempwid);
|
|
626
|
|
627 tempwid = gtk_button_new_with_label (_(" Cancel "));
|
|
628 GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
|
|
629 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), tempwid,
|
|
630 TRUE, TRUE, 0);
|
|
631 gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked",
|
|
632 GTK_SIGNAL_FUNC (gtk_widget_destroy),
|
|
633 GTK_OBJECT (dialog));
|
|
634 gtk_widget_show (tempwid);
|
|
635 #else
|
|
636 g_signal_connect (GTK_OBJECT (dialog), "response",
|
|
637 G_CALLBACK (proxyhosts_action), NULL);
|
|
638 #endif
|
|
639
|
|
640 gtk_widget_show (dialog);
|
|
641 }
|
|
642
|
|
643 static void
|
|
644 make_proxy_hosts_tab (GtkWidget * notebook)
|
|
645 {
|
|
646 GtkWidget *tempwid, *box, *hbox, *scroll;
|
|
647 gftp_proxy_hosts *hosts, *newhosts;
|
|
648 char *add_data[2];
|
|
649 GList *templist;
|
|
650
|
|
651 add_data[0] = _("Network");
|
|
652 add_data[1] = _("Netmask");
|
|
653
|
|
654 box = gtk_vbox_new (FALSE, 5);
|
|
655 gtk_container_border_width (GTK_CONTAINER (box), 10);
|
|
656 gtk_widget_show (box);
|
|
657
|
|
658 tempwid = gtk_label_new (_("Local Hosts"));
|
|
659 gtk_widget_show (tempwid);
|
|
660 gtk_notebook_append_page (GTK_NOTEBOOK (notebook), box, tempwid);
|
|
661
|
|
662 scroll = gtk_scrolled_window_new (NULL, NULL);
|
|
663 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
|
|
664 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
|
665 gtk_box_pack_start (GTK_BOX (box), scroll, TRUE, TRUE, 0);
|
|
666
|
|
667 proxy_list = gtk_clist_new_with_titles (2, add_data);
|
|
668 gtk_container_add (GTK_CONTAINER (scroll), proxy_list);
|
|
669 gtk_clist_set_column_auto_resize (GTK_CLIST (proxy_list), 0, TRUE);
|
|
670 gtk_clist_set_column_auto_resize (GTK_CLIST (proxy_list), 1, TRUE);
|
|
671 gtk_widget_show (proxy_list);
|
|
672 gtk_widget_show (scroll);
|
|
673
|
|
674 hbox = gtk_hbox_new (TRUE, 15);
|
|
675 gtk_box_pack_start (GTK_BOX (box), hbox, FALSE, FALSE, 0);
|
|
676 gtk_widget_show (hbox);
|
|
677
|
|
678 tempwid = gtk_button_new_with_label (_("Add"));
|
|
679 GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
|
|
680 gtk_box_pack_start (GTK_BOX (hbox), tempwid, TRUE, TRUE, 0);
|
|
681 gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
|
|
682 GTK_SIGNAL_FUNC (add_proxy_host), NULL);
|
|
683 gtk_widget_show (tempwid);
|
|
684
|
|
685 tempwid = gtk_button_new_with_label (_("Edit"));
|
|
686 GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
|
|
687 gtk_box_pack_start (GTK_BOX (hbox), tempwid, TRUE, TRUE, 0);
|
|
688 gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
|
|
689 GTK_SIGNAL_FUNC (add_proxy_host), (gpointer) 1);
|
|
690 gtk_widget_show (tempwid);
|
|
691
|
|
692 tempwid = gtk_button_new_with_label (_("Delete"));
|
|
693 GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
|
|
694 gtk_box_pack_start (GTK_BOX (hbox), tempwid, TRUE, TRUE, 0);
|
|
695 gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
|
|
696 GTK_SIGNAL_FUNC (delete_proxy_host), NULL);
|
|
697 gtk_widget_show (tempwid);
|
|
698
|
|
699 new_proxy_hosts = NULL;
|
|
700 for (templist = proxy_hosts; templist != NULL;
|
|
701 templist = templist->next)
|
|
702 {
|
|
703 hosts = templist->data;
|
|
704 newhosts = g_malloc (sizeof (*newhosts));
|
|
705 memcpy (newhosts, hosts, sizeof (*newhosts));
|
|
706 if (newhosts->domain)
|
|
707 {
|
|
708 newhosts->domain = g_malloc (strlen (hosts->domain) + 1);
|
|
709 strcpy (newhosts->domain, hosts->domain);
|
|
710 }
|
|
711 new_proxy_hosts = g_list_prepend (new_proxy_hosts, newhosts);
|
|
712 add_host_to_listbox (new_proxy_hosts);
|
|
713 }
|
|
714 }
|
|
715
|
|
716
|
1
|
717 void
|
|
718 options_dialog (gpointer data)
|
|
719 {
|
|
720 GtkWidget * dialog, * tempwid, * notebook, * table, * box;
|
|
721 char tempstr[20], *pos, *endpos, *oldstr;
|
|
722 int i, tbl_col, tbl_num, combo_num;
|
|
723 GList * combo_list;
|
|
724
|
45
|
725 #if GTK_MAJOR_VERSION == 1
|
1
|
726 dialog = gtk_dialog_new ();
|
|
727 gtk_window_set_title (GTK_WINDOW (dialog), _("Options"));
|
|
728 gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area),
|
|
729 5);
|
|
730 gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->action_area), 15);
|
|
731 gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dialog)->action_area), TRUE);
|
19
|
732 #else
|
|
733 dialog = gtk_dialog_new_with_buttons (_("Options"), NULL, 0,
|
|
734 GTK_STOCK_SAVE,
|
|
735 GTK_RESPONSE_OK,
|
|
736 GTK_STOCK_CANCEL,
|
|
737 GTK_RESPONSE_CANCEL,
|
|
738 GTK_STOCK_APPLY,
|
|
739 GTK_RESPONSE_APPLY,
|
|
740 NULL);
|
|
741 #endif
|
|
742 gtk_window_set_wmclass (GTK_WINDOW(dialog), "options", "gFTP");
|
1
|
743 gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
|
19
|
744 gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 10);
|
|
745 gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 2);
|
|
746 gtk_widget_realize (dialog);
|
|
747
|
|
748 if (gftp_icon != NULL)
|
|
749 {
|
|
750 gdk_window_set_icon (dialog->window, NULL, gftp_icon->pixmap,
|
|
751 gftp_icon->bitmap);
|
|
752 gdk_window_set_icon_name (dialog->window, _("gFTP Icon"));
|
|
753 }
|
1
|
754
|
|
755 notebook = gtk_notebook_new ();
|
|
756 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), notebook, TRUE,
|
|
757 TRUE, 0);
|
|
758 gtk_widget_show (notebook);
|
|
759
|
|
760 tbl_num = tbl_col = 0;
|
|
761 table = box = NULL;
|
|
762 for (i=0; config_file_vars[i].key != NULL; i++)
|
|
763 {
|
37
|
764 if (!(config_file_vars[i].ports_shown & GFTP_PORT_GTK))
|
1
|
765 continue;
|
|
766
|
|
767 switch (config_file_vars[i].type)
|
|
768 {
|
|
769 case CONFIG_NOTEBOOK:
|
|
770 box = gtk_vbox_new (FALSE, 0);
|
|
771 gtk_container_border_width (GTK_CONTAINER (box), 10);
|
|
772 gtk_widget_show (box);
|
|
773
|
|
774 tempwid = gtk_label_new (_(config_file_vars[i].description));
|
|
775 gtk_widget_show (tempwid);
|
|
776 gtk_notebook_append_page (GTK_NOTEBOOK (notebook), box, tempwid);
|
|
777 break;
|
|
778 case CONFIG_TABLE:
|
|
779 table = gtk_table_new (1, 2, FALSE);
|
|
780 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
|
|
781 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
|
|
782 gtk_box_pack_start (GTK_BOX (box), table, FALSE, FALSE, 0);
|
|
783 gtk_widget_show (table);
|
|
784 tbl_num = 1;
|
|
785 tbl_col = 0;
|
|
786 break;
|
|
787 case CONFIG_COMBO:
|
|
788 gtk_table_resize (GTK_TABLE (table), tbl_num, 2);
|
|
789
|
|
790 tempwid = gtk_label_new (_(config_file_vars[i].description));
|
|
791 gtk_misc_set_alignment (GTK_MISC (tempwid), 1, 0.5);
|
|
792 gtk_table_attach_defaults (GTK_TABLE (table), tempwid, 0, 1,
|
|
793 tbl_num - 1, tbl_num);
|
|
794 gtk_widget_show (tempwid);
|
|
795
|
|
796 tempwid = gtk_combo_new ();
|
|
797 gtk_table_attach_defaults (GTK_TABLE (table), tempwid, 1, 2,
|
|
798 tbl_num - 1, tbl_num);
|
|
799 gtk_widget_show (tempwid);
|
|
800 config_file_vars[i].widget = tempwid;
|
|
801
|
|
802 /* We only have Default Protocol and the Proxy type as the two
|
|
803 combo types. If I add more later on, I'll work on a better
|
|
804 interface for all this stuff */
|
|
805 if (strcmp (config_file_vars[i].comment, "DP") == 0)
|
|
806 def_proto_combo = tempwid;
|
|
807 else
|
|
808 proxy_combo = tempwid;
|
|
809
|
|
810 tbl_num++;
|
|
811 break;
|
|
812 case CONFIG_TEXT:
|
45
|
813 #if GTK_MAJOR_VERSION == 1
|
1
|
814 proxy_text = gtk_text_new (NULL, NULL);
|
|
815 gtk_text_set_editable (GTK_TEXT (proxy_text), TRUE);
|
|
816 #else
|
|
817 proxy_text = gtk_text_view_new ();
|
|
818 gtk_text_view_set_editable (GTK_TEXT_VIEW (proxy_text), TRUE);
|
|
819 #endif
|
|
820 gtk_widget_set_size_request (proxy_text, -1, 75);
|
|
821 gtk_table_attach_defaults (GTK_TABLE (table), proxy_text, 0, 2,
|
|
822 tbl_num - 1, tbl_num);
|
|
823 gtk_widget_show (proxy_text);
|
|
824 config_file_vars[i].widget = proxy_text;
|
|
825
|
|
826 tbl_num++;
|
|
827 break;
|
|
828 case CONFIG_CHARTEXT:
|
|
829 case CONFIG_CHARPASS:
|
|
830 case CONFIG_INTTEXT:
|
|
831 case CONFIG_UINTTEXT:
|
|
832 case CONFIG_FLOATTEXT:
|
|
833 gtk_table_resize (GTK_TABLE (table), tbl_num, 2);
|
|
834
|
|
835 tempwid = gtk_label_new (_(config_file_vars[i].description));
|
|
836 gtk_misc_set_alignment (GTK_MISC (tempwid), 1, 0.5);
|
|
837 gtk_table_attach_defaults (GTK_TABLE (table), tempwid, 0, 1,
|
|
838 tbl_num - 1, tbl_num);
|
|
839 gtk_widget_show (tempwid);
|
|
840
|
|
841 tempwid = gtk_entry_new ();
|
|
842 gtk_table_attach_defaults (GTK_TABLE (table), tempwid, 1, 2,
|
|
843 tbl_num - 1, tbl_num);
|
|
844
|
|
845 switch (config_file_vars[i].type)
|
|
846 {
|
|
847 case CONFIG_INTTEXT:
|
|
848 case CONFIG_UINTTEXT:
|
|
849 g_snprintf (tempstr, sizeof (tempstr), "%d",
|
|
850 *(int *) config_file_vars[i].var);
|
|
851 gtk_entry_set_text (GTK_ENTRY (tempwid), tempstr);
|
|
852 break;
|
|
853 case CONFIG_FLOATTEXT:
|
|
854 g_snprintf (tempstr, sizeof (tempstr), "%.2f",
|
|
855 *(double *) config_file_vars[i].var);
|
|
856 gtk_entry_set_text (GTK_ENTRY (tempwid), tempstr);
|
|
857 break;
|
|
858 case CONFIG_CHARTEXT:
|
|
859 gtk_entry_set_text (GTK_ENTRY (tempwid),
|
|
860 *(char **) config_file_vars[i].var);
|
|
861 break;
|
|
862 case CONFIG_CHARPASS:
|
|
863 gtk_entry_set_text (GTK_ENTRY (tempwid),
|
|
864 *(char **) config_file_vars[i].var);
|
|
865 gtk_entry_set_visibility (GTK_ENTRY (tempwid), 0);
|
|
866 break;
|
|
867 }
|
|
868 gtk_widget_show (tempwid);
|
|
869 config_file_vars[i].widget = tempwid;
|
|
870 tbl_num++;
|
|
871 break;
|
|
872 case CONFIG_CHECKBOX:
|
|
873 tempwid = gtk_check_button_new_with_label (
|
|
874 _(config_file_vars[i].description));
|
|
875 gtk_table_attach_defaults (GTK_TABLE (table), tempwid,
|
|
876 tbl_col, tbl_col + 1, tbl_num, tbl_num + 1);
|
|
877 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (tempwid),
|
|
878 *(int *) config_file_vars[i].var);
|
|
879 gtk_widget_show (tempwid);
|
|
880 config_file_vars[i].widget = tempwid;
|
|
881 tbl_col++;
|
|
882 if (tbl_col == 2)
|
|
883 {
|
|
884 tbl_col = 0;
|
|
885 tbl_num++;
|
|
886 gtk_table_resize (GTK_TABLE (table), tbl_num + 1, 2);
|
|
887 }
|
|
888 break;
|
|
889 case CONFIG_LABEL:
|
|
890 tempwid = gtk_label_new (_(config_file_vars[i].description));
|
|
891 gtk_misc_set_alignment (GTK_MISC (tempwid), tbl_col, 0.5);
|
|
892 gtk_table_attach_defaults (GTK_TABLE (table), tempwid,
|
|
893 tbl_col, tbl_col + 1, tbl_num, tbl_num + 1);
|
|
894 gtk_widget_show (tempwid);
|
|
895 config_file_vars[i].widget = tempwid;
|
|
896 tbl_col++;
|
|
897 if (tbl_col == 2)
|
|
898 {
|
|
899 tbl_col = 0;
|
|
900 tbl_num++;
|
|
901 gtk_table_resize (GTK_TABLE (table), tbl_num + 1, 2);
|
|
902 }
|
|
903 break;
|
|
904 }
|
|
905 }
|
|
906
|
|
907 combo_num = 0;
|
|
908 combo_list = NULL;
|
|
909 for (i = 0; gftp_protocols[i].name != NULL; i++)
|
|
910 {
|
|
911 if (strcmp (default_protocol, gftp_protocols[i].name) == 0)
|
|
912 combo_num = i;
|
|
913 tempwid = gtk_list_item_new_with_label (gftp_protocols[i].name);
|
|
914 gtk_widget_show (tempwid);
|
|
915 combo_list = g_list_append (combo_list, tempwid);
|
|
916 }
|
|
917 gtk_list_prepend_items (GTK_LIST (GTK_COMBO (def_proto_combo)->list),
|
|
918 combo_list);
|
|
919 gtk_list_select_item (GTK_LIST (GTK_COMBO (def_proto_combo)->list),
|
|
920 combo_num);
|
|
921
|
|
922 combo_list = NULL;
|
|
923 for (i = 0; proxy_type[i].key != NULL; i++)
|
|
924 {
|
|
925 tempwid = gtk_list_item_new_with_label (_(proxy_type[i].key));
|
|
926 gtk_widget_show (tempwid);
|
|
927 combo_list = g_list_append (combo_list, tempwid);
|
|
928 }
|
|
929 gtk_list_prepend_items (GTK_LIST (GTK_COMBO (proxy_combo)->list), combo_list);
|
|
930 combo_list = NULL;
|
|
931
|
|
932 custom_proxy = g_malloc0 (1);
|
|
933 if (proxy_config == NULL || *proxy_config == '\0')
|
|
934 combo_num = 0;
|
|
935 else
|
|
936 {
|
|
937 pos = proxy_config;
|
|
938 while ((endpos = strstr (pos, "%n")))
|
|
939 {
|
|
940 *endpos = '\0';
|
|
941 oldstr = custom_proxy;
|
|
942 custom_proxy = g_strconcat (custom_proxy, pos, "\n", NULL);
|
|
943 g_free (oldstr);
|
|
944 *endpos = '%';
|
|
945 pos = endpos + 2;
|
|
946 }
|
|
947
|
|
948 for (combo_num = 1; combo_num < GFTP_CUSTOM_PROXY_NUM; combo_num++)
|
|
949 {
|
|
950 if (strcmp (proxy_type[combo_num].description, custom_proxy) == 0)
|
|
951 break;
|
|
952 }
|
|
953 }
|
|
954
|
|
955 gtk_signal_connect (GTK_OBJECT (GTK_COMBO (proxy_combo)->list),
|
|
956 "select_child", GTK_SIGNAL_FUNC (proxy_toggle), NULL);
|
|
957 gtk_list_select_item (GTK_LIST (GTK_COMBO (proxy_combo)->list), combo_num);
|
|
958
|
|
959 make_proxy_hosts_tab (notebook);
|
|
960
|
45
|
961 #if GTK_MAJOR_VERSION == 1
|
1
|
962 tempwid = gtk_button_new_with_label (_("OK"));
|
|
963 GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
|
|
964 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), tempwid,
|
|
965 TRUE, TRUE, 0);
|
|
966 gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
|
|
967 GTK_SIGNAL_FUNC (apply_changes), NULL);
|
|
968 gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked",
|
|
969 GTK_SIGNAL_FUNC (gtk_widget_destroy),
|
|
970 GTK_OBJECT (dialog));
|
|
971 gtk_widget_show (tempwid);
|
|
972
|
|
973 tempwid = gtk_button_new_with_label (_(" Cancel "));
|
|
974 GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
|
|
975 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), tempwid,
|
|
976 TRUE, TRUE, 0);
|
|
977 gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
|
|
978 GTK_SIGNAL_FUNC (clean_old_changes), NULL);
|
|
979 gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked",
|
|
980 GTK_SIGNAL_FUNC (gtk_widget_destroy),
|
|
981 GTK_OBJECT (dialog));
|
|
982 gtk_widget_show (tempwid);
|
|
983
|
|
984 tempwid = gtk_button_new_with_label (_("Apply"));
|
|
985 GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
|
|
986 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), tempwid,
|
|
987 TRUE, TRUE, 0);
|
|
988 gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
|
|
989 GTK_SIGNAL_FUNC (apply_changes), NULL);
|
|
990 gtk_widget_grab_default (tempwid);
|
|
991 gtk_widget_show (tempwid);
|
19
|
992 #else
|
|
993 g_signal_connect (GTK_OBJECT (dialog), "response",
|
|
994 G_CALLBACK (options_action), NULL);
|
|
995 #endif
|
1
|
996
|
|
997 gtk_widget_show (dialog);
|
|
998 }
|
|
999
|