annotate src/gtk/options_dialog.c @ 218:de6a2e8e51cb

2003-7-9 Brian Masney <masneyb@gftp.org> * lib/config_file.c (gftp_write_config_file) - fix for writing out list items to the config file. * lib/config_file.c lib/gftp.h - added gftp_free_proxy_hosts() and gftp_copy_proxy_hosts() * lib/protocols.c (gftp_connect_server) - look up dont_use_proxy instead of ext * lib/protocols.c lib/sshv2.c src/gtk/dnd.c src/gtk/menu-items.c - when calling g_build_path(), set the directory separator to / instead of G_DIR_SEPARATOR_S * src/gtk/gftp-gtk.c (toolbar_hostedit) - fixed crash * src/gtk/gftp-gtk.h - removed gotbytes from gftp_window_data structure * src/gtk/options_dialog.c - show proxy hosts in options dialog * docs/sample.gftp/gftprc - new default config file
author masneyb
date Wed, 09 Jul 2003 23:25:56 +0000
parents 3fa7b4f4ab78
children b9584a877daf
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: 19
diff changeset
21 static const char cvsid[] = "$Id$";
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
22
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
23 static GtkWidget * proxy_list, * new_proxy_domain, * network1,
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
24 * network2, * network3, * network4, * netmask1, * netmask2,
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
25 * netmask3, * netmask4, * domain_active;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
26 static GList * new_proxy_hosts;
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
27
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
28 /* FIXME - use cancel function */
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
29
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
30 static void
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
31 _setup_option (gftp_option_type_enum otype,
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
32 gftp_options_dialog_data * option_data,
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
33 void * (*ui_print_function) (gftp_config_vars * cv,
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
34 void *user_data),
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
35 void (*ui_save_function) (gftp_config_vars * cv,
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
36 void *user_data),
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
37 void (*ui_cancel_function) (gftp_config_vars * cv,
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
38 void *user_data))
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
39
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
40 {
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
41 gftp_option_types[otype].user_data = option_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
42 gftp_option_types[otype].ui_print_function = ui_print_function;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
43 gftp_option_types[otype].ui_save_function = ui_save_function;
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
44 gftp_option_types[otype].ui_cancel_function = ui_cancel_function;
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
45 }
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
46
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
47
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
48 static void *
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
49 _gen_input_widget (gftp_options_dialog_data * option_data, char *label, char *tiptxt)
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
50 {
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
51 GtkTooltips * tooltip;
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
52 GtkWidget * tempwid;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
53
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
54 option_data->tbl_row_num++;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
55 gtk_table_resize (GTK_TABLE (option_data->table),
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
56 option_data->tbl_row_num, 2);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
57
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
58 tempwid = gtk_label_new (_(label));
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
59 gtk_misc_set_alignment (GTK_MISC (tempwid), 1, 0.5);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
60 gtk_table_attach_defaults (GTK_TABLE (option_data->table), tempwid, 0, 1,
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
61 option_data->tbl_row_num - 1,
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
62 option_data->tbl_row_num);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
63 gtk_widget_show (tempwid);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
64
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
65 tempwid = gtk_entry_new ();
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
66 gtk_table_attach_defaults (GTK_TABLE (option_data->table), tempwid, 1, 2,
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
67 option_data->tbl_row_num - 1,
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
68 option_data->tbl_row_num);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
69 gtk_widget_show (tempwid);
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
70
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
71 if (tiptxt != NULL)
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
72 {
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
73 tooltip = gtk_tooltips_new ();
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
74 gtk_tooltips_set_tip (GTK_TOOLTIPS(tooltip), tempwid, tiptxt, NULL);
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
75 }
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
76
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
77 return (tempwid);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
78 }
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
79
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
80
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
81 static void *
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
82 _print_option_type_newtable (gftp_config_vars * cv, void *user_data)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
83 {
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
84 gftp_options_dialog_data * option_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
85
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
86 option_data = user_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
87
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
88 option_data->table = gtk_table_new (1, 2, FALSE);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
89 gtk_table_set_row_spacings (GTK_TABLE (option_data->table), 5);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
90 gtk_table_set_col_spacings (GTK_TABLE (option_data->table), 5);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
91 gtk_box_pack_start (GTK_BOX (option_data->box), option_data->table, FALSE,
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
92 FALSE, 0);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
93 gtk_widget_show (option_data->table);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
94 option_data->tbl_row_num = 0;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
95 option_data->tbl_col_num = 0;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
96
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
97 return (NULL);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
98 }
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
99
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
100
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
101 static void *
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
102 _print_option_type_text (gftp_config_vars * cv, void *user_data)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
103 {
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
104 gftp_options_dialog_data * option_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
105 GtkWidget * tempwid;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
106
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
107 option_data = user_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
108
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
109 tempwid = _gen_input_widget (option_data, cv->description, cv->comment);
218
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
110 if (cv->value != NULL)
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
111 gtk_entry_set_text (GTK_ENTRY (tempwid), (char *) cv->value);
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
112
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
113 return (tempwid);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
114 }
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
115
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
116
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
117 static void
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
118 _save_option_type_text (gftp_config_vars * cv, void *user_data)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
119 {
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
120 gftp_options_dialog_data * option_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
121 const char *tempstr;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
122
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
123 option_data = user_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
124 tempstr = gtk_entry_get_text (GTK_ENTRY (cv->user_data));
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
125
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
126 if (cv->flags & GFTP_CVARS_FLAGS_DYNMEM)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
127 g_free (cv->value);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
128
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
129 cv->value = g_strdup (tempstr);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
130 cv->flags |= GFTP_CVARS_FLAGS_DYNMEM;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
131 }
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
132
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
133
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
134 static GtkWidget *
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
135 _gen_combo_widget (gftp_options_dialog_data * option_data, char *label)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
136 {
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
137 GtkWidget * tempwid, * combo;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
138
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
139 option_data->tbl_row_num++;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
140 gtk_table_resize (GTK_TABLE (option_data->table),
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
141 option_data->tbl_row_num, 2);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
142
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
143 tempwid = gtk_label_new (_(label));
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
144 gtk_misc_set_alignment (GTK_MISC (tempwid), 1, 0.5);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
145 gtk_table_attach_defaults (GTK_TABLE (option_data->table), tempwid, 0, 1,
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
146 option_data->tbl_row_num - 1,
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
147 option_data->tbl_row_num);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
148 gtk_widget_show (tempwid);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
149
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
150 combo = gtk_combo_new ();
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
151 gtk_table_attach_defaults (GTK_TABLE (option_data->table), combo, 1, 2,
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
152 option_data->tbl_row_num - 1,
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
153 option_data->tbl_row_num);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
154 return (combo);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
155 }
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
156
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
157
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
158 static void *
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
159 _print_option_type_textcombo (gftp_config_vars * cv, void *user_data)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
160 {
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
161 gftp_options_dialog_data * option_data;
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
162 GtkWidget * tempwid, * combo;
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
163 GList * widget_list;
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
164 GtkTooltips * tooltip;
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
165 int selitem, i;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
166 char **clist;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
167
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
168 option_data = user_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
169 combo = _gen_combo_widget (option_data, cv->description);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
170
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
171 if (cv->listdata != NULL)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
172 {
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
173 selitem = 0;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
174 widget_list = NULL;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
175
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
176 clist = cv->listdata;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
177 for (i=0; clist[i] != NULL; i++)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
178 {
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
179 if (cv->value != NULL &&
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
180 strcasecmp ((char *) cv->value, clist[i]) == 0)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
181 selitem = i;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
182
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
183 tempwid = gtk_list_item_new_with_label (clist[i]);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
184 gtk_widget_show (tempwid);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
185 widget_list = g_list_append (widget_list, tempwid);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
186 }
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
187
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
188 gtk_list_prepend_items (GTK_LIST (GTK_COMBO (combo)->list), widget_list);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
189 gtk_list_select_item (GTK_LIST (GTK_COMBO (combo)->list), selitem);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
190 }
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
191
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
192 gtk_widget_show (combo);
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
193
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
194 if (cv->comment != NULL)
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
195 {
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
196 tooltip = gtk_tooltips_new ();
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
197 gtk_tooltips_set_tip (GTK_TOOLTIPS(tooltip), combo, cv->comment, NULL);
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
198 }
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
199
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
200 return (combo);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
201 }
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
202
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
203
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
204 static void
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
205 _save_option_type_textcombo (gftp_config_vars * cv, void *user_data)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
206 {
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
207 gftp_options_dialog_data * option_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
208 const char *tempstr;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
209 char **clist;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
210 int i;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
211
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
212 option_data = user_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
213
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
214 tempstr = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (cv->user_data)->entry));
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
215
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
216 if (cv->listdata != NULL && tempstr != NULL)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
217 {
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
218 clist = cv->listdata;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
219 for (i=0; clist[i] != NULL; i++)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
220 {
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
221 if (strcasecmp (tempstr, clist[i]) == 0)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
222 {
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
223 cv->value = clist[i];
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
224 break;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
225 }
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
226 }
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
227 }
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
228 }
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
229
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
230
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
231 static void
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
232 _textcomboedt_toggle (GtkList * list, GtkWidget * child, gpointer data)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
233 {
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
234 gftp_textcomboedt_widget_data * widdata;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
235 gftp_textcomboedt_data * tedata;
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
236 char *insert_text;
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
237 int num, isedit;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
238 #if GTK_MAJOR_VERSION > 1
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
239 GtkTextIter iter, iter2;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
240 GtkTextBuffer * textbuf;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
241 guint len;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
242 #endif
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
243
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
244 widdata = data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
245 tedata = widdata->cv->listdata;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
246
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
247 num = gtk_list_child_position (list, child);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
248 isedit = tedata[num].flags & GFTP_TEXTCOMBOEDT_EDITABLE;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
249 #if GTK_MAJOR_VERSION == 1
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
250 gtk_text_set_editable (GTK_TEXT (widdata->text), isedit);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
251 #else
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
252 gtk_text_view_set_editable (GTK_TEXT_VIEW (widdata->text), isedit);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
253 #endif
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
254
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
255 if (isedit)
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
256 insert_text = widdata->custom_edit_value;
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
257 else
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
258 insert_text = tedata[num].text;
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
259
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
260 #if GTK_MAJOR_VERSION == 1
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
261 gtk_text_set_point (GTK_TEXT (widdata->text), 0);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
262 gtk_text_forward_delete (GTK_TEXT (widdata->text),
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
263 gtk_text_get_length (GTK_TEXT (widdata->text)));
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
264
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
265 gtk_text_insert (GTK_TEXT (widdata->text), NULL, NULL, NULL,
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
266 insert_text, -1);
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
267 #else
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
268 textbuf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widdata->text));
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
269 len = gtk_text_buffer_get_char_count (textbuf);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
270 gtk_text_buffer_get_iter_at_offset (textbuf, &iter, 0);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
271 gtk_text_buffer_get_iter_at_offset (textbuf, &iter2, len - 1);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
272 gtk_text_buffer_delete (textbuf, &iter, &iter2);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
273
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
274 len = gtk_text_buffer_get_char_count (textbuf);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
275 gtk_text_buffer_get_iter_at_offset (textbuf, &iter, len - 1);
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
276 gtk_text_buffer_insert (textbuf, &iter, insert_text, -1);
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
277 #endif
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
278 }
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
279
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
280
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
281 static char *
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
282 _gftp_convert_to_newlines (char *str)
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
283 {
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
284 char *stpos, *endpos, *ret, savechar;
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
285 size_t len;
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
286
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
287 ret = g_strdup ("");
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
288 len = 0;
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
289 for (stpos = str;
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
290 (endpos = strstr (stpos, "%n")) != NULL;
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
291 stpos = endpos + 2)
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
292 {
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
293 savechar = *endpos;
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
294 *endpos = '\0';
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
295
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
296 len += strlen (stpos) + 1;
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
297 ret = g_realloc (ret, len + 1);
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
298 strcat (ret, stpos);
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
299 strcat (ret, "\n");
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
300
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
301 *endpos = savechar;
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
302 }
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
303
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
304 return (ret);
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
305 }
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
306
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
307
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
308 static char *
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
309 _gftp_convert_from_newlines (char *str)
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
310 {
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
311 char *stpos, *endpos, *ret, savechar;
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
312 size_t len;
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
313
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
314 ret = g_strdup ("");
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
315 len = 0;
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
316 for (stpos = str;
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
317 (endpos = strchr (stpos, '\n')) != NULL;
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
318 stpos = endpos + 1)
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
319 {
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
320 savechar = *endpos;
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
321 *endpos = '\0';
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
322
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
323 len += strlen (stpos) + 2;
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
324 ret = g_realloc (ret, len + 1);
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
325 strcat (ret, stpos);
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
326 strcat (ret, "%n");
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
327
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
328 *endpos = savechar;
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
329 }
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
330
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
331 return (ret);
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
332 }
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
333
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
334
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
335 static void *
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
336 _print_option_type_textcomboedt (gftp_config_vars * cv, void *user_data)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
337 {
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
338 gftp_textcomboedt_widget_data * widdata;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
339 GtkWidget * combo, * textwid, * tempwid;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
340 gftp_options_dialog_data * option_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
341 gftp_textcomboedt_data * tedata;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
342 int i, selitem, edititem;
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
343 GtkTooltips * tooltip;
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
344 GList * widget_list;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
345 char *tempstr;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
346
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
347 option_data = user_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
348 combo = _gen_combo_widget (option_data, cv->description);
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
349
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
350 tempstr = NULL;
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
351 if (cv->value != NULL)
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
352 tempstr = _gftp_convert_to_newlines (cv->value);
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
353 if (tempstr == NULL)
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
354 tempstr = g_strdup ("");
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
355
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
356 edititem = selitem = -1;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
357 if (cv->listdata != NULL)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
358 {
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
359 widget_list = NULL;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
360
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
361 tedata = cv->listdata;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
362 for (i=0; tedata[i].description != NULL; i++)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
363 {
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
364 if (tedata[i].flags & GFTP_TEXTCOMBOEDT_EDITABLE)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
365 edititem = i;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
366
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
367 if (selitem == -1 &&
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
368 strcasecmp (tempstr, tedata[i].text) == 0)
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
369 selitem = i;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
370
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
371 tempwid = gtk_list_item_new_with_label (tedata[i].description);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
372 gtk_widget_show (tempwid);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
373 widget_list = g_list_append (widget_list, tempwid);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
374 }
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
375
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
376 gtk_list_prepend_items (GTK_LIST (GTK_COMBO (combo)->list), widget_list);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
377
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
378 if (selitem == -1 && edititem != -1)
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
379 selitem = edititem;
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
380 }
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
381
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
382 if (selitem == -1)
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
383 selitem = 0;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
384
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
385 option_data->tbl_row_num++;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
386 gtk_table_resize (GTK_TABLE (option_data->table),
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
387 option_data->tbl_row_num, 2);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
388
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
389 #if GTK_MAJOR_VERSION == 1
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
390 textwid = gtk_text_new (NULL, NULL);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
391 #else
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
392 textwid = gtk_text_view_new ();
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
393 #endif
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
394 gtk_widget_set_size_request (textwid, -1, 75);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
395 gtk_table_attach_defaults (GTK_TABLE (option_data->table), textwid, 0, 2,
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
396 option_data->tbl_row_num - 1,
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
397 option_data->tbl_row_num);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
398 gtk_widget_show (textwid);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
399
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
400 widdata = g_malloc0 (sizeof (*widdata));
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
401 widdata->combo = combo;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
402 widdata->text = textwid;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
403 widdata->cv = cv;
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
404 widdata->custom_edit_value = tempstr;
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
405
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
406 gtk_signal_connect (GTK_OBJECT (GTK_COMBO (combo)->list),
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
407 "select_child",
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
408 GTK_SIGNAL_FUNC (_textcomboedt_toggle), widdata);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
409 gtk_list_select_item (GTK_LIST (GTK_COMBO (combo)->list), selitem);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
410 gtk_widget_show (combo);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
411
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
412 if (cv->comment != NULL)
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
413 {
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
414 tooltip = gtk_tooltips_new ();
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
415 gtk_tooltips_set_tip (GTK_TOOLTIPS(tooltip), combo, cv->comment, NULL);
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
416
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
417 tooltip = gtk_tooltips_new ();
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
418 gtk_tooltips_set_tip (GTK_TOOLTIPS(tooltip), textwid, cv->comment, NULL);
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
419 }
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
420
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
421 return (widdata);
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
422 }
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
423
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
424
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
425 static void
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
426 _cancel_option_type_textcomboedt (gftp_config_vars * cv, void *user_data)
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
427 {
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
428 gftp_textcomboedt_widget_data * widdata;
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
429
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
430 widdata = cv->user_data;
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
431 if (widdata != NULL)
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
432 {
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
433 if (widdata->custom_edit_value != NULL)
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
434 g_free (widdata->custom_edit_value);
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
435 g_free (widdata);
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
436 }
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
437 }
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
438
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
439
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
440 static void
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
441 _save_option_type_textcomboedt (gftp_config_vars * cv, void *user_data)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
442 {
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
443 gftp_textcomboedt_widget_data * widdata;
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
444 char *newstr;
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
445 int freeit;
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
446 #if GTK_MAJOR_VERSION == 1
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
447 char tmp[128];
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
448 #else
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
449 GtkTextBuffer * textbuf;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
450 GtkTextIter iter, iter2;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
451 size_t len;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
452 #endif
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
453
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
454 widdata = cv->user_data;
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
455
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
456 #if GTK_MAJOR_VERSION == 1
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
457 /*
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
458 GTK_TEXT uses wchar_t instead of char in environment of multibyte encoding
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
459 locale (ex Japanese), so we must convert from wide character
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
460 to multibyte charator.... Yasuyuki Furukawa (yasu@on.cs.keio.ac.jp)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
461 */
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
462 if (GTK_TEXT (widdata->text)->use_wchar)
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
463 {
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
464 wcstombs (tmp, (wchar_t *) GTK_TEXT (widdata->text)->text.wc, sizeof (tmp));
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
465 newstr = tmp;
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
466 freeit = 0;
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
467 }
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
468 else
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
469 {
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
470 newstr = (char *) GTK_TEXT (widdata->text)->text.ch;
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
471 freeit = 0;
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
472 }
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
473 #else
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
474 textbuf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widdata->text));
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
475 len = gtk_text_buffer_get_char_count (textbuf);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
476 gtk_text_buffer_get_iter_at_offset (textbuf, &iter, 0);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
477 gtk_text_buffer_get_iter_at_offset (textbuf, &iter2, len - 1);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
478 newstr = gtk_text_buffer_get_text (textbuf, &iter, &iter2, 0);
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
479 freeit = 1;
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
480 #endif
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
481
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
482 if (cv->flags & GFTP_CVARS_FLAGS_DYNMEM)
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
483 g_free (cv->value);
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
484
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
485 cv->value = _gftp_convert_from_newlines (newstr);
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
486 cv->flags |= GFTP_CVARS_FLAGS_DYNMEM;
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
487
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
488 if (freeit)
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
489 g_free (newstr);
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
490
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
491 _cancel_option_type_textcomboedt (cv, user_data);
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
492 }
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
493
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
494
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
495 static void *
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
496 _print_option_type_hidetext (gftp_config_vars * cv, void *user_data)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
497 {
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
498 gftp_options_dialog_data * option_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
499 GtkWidget * tempwid;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
500
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
501 option_data = user_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
502
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
503 tempwid = _gen_input_widget (option_data, cv->description, cv->comment);
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
504 gtk_entry_set_visibility (GTK_ENTRY (tempwid), 0);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
505 gtk_entry_set_text (GTK_ENTRY (tempwid), (char *) cv->value);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
506 return (tempwid);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
507 }
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
508
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
509
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
510 static void *
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
511 _print_option_type_int (gftp_config_vars * cv, void *user_data)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
512 {
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
513 gftp_options_dialog_data * option_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
514 GtkWidget * tempwid;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
515 char tempstr[20];
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
516
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
517 option_data = user_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
518
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
519 tempwid = _gen_input_widget (option_data, cv->description, cv->comment);
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
520 g_snprintf (tempstr, sizeof (tempstr), "%d", GPOINTER_TO_INT(cv->value));
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
521 gtk_entry_set_text (GTK_ENTRY (tempwid), tempstr);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
522 return (tempwid);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
523 }
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
524
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
525
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
526 static void
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
527 _save_option_type_int (gftp_config_vars * cv, void *user_data)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
528 {
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
529 gftp_options_dialog_data * option_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
530 const char *tempstr;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
531
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
532 option_data = user_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
533 tempstr = gtk_entry_get_text (GTK_ENTRY (cv->user_data));
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
534 cv->value = GINT_TO_POINTER(strtol (tempstr, NULL, 10));
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
535 }
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
536
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
537
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
538 static void *
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
539 _print_option_type_checkbox (gftp_config_vars * cv, void *user_data)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
540 {
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
541 gftp_options_dialog_data * option_data;
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
542 GtkTooltips * tooltip;
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
543 GtkWidget * tempwid;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
544
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
545 option_data = user_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
546
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
547 if (option_data->last_option != gftp_option_type_checkbox)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
548 _print_option_type_newtable (NULL, user_data);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
549
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
550 if (option_data->tbl_col_num == 0)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
551 {
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
552 option_data->tbl_row_num++;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
553 gtk_table_resize (GTK_TABLE (option_data->table),
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
554 option_data->tbl_row_num + 1, 2);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
555 }
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
556
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
557 tempwid = gtk_check_button_new_with_label (_(cv->description));
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
558 gtk_table_attach_defaults (GTK_TABLE (option_data->table), tempwid,
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
559 option_data->tbl_col_num,
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
560 option_data->tbl_col_num + 1,
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
561 option_data->tbl_row_num,
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
562 option_data->tbl_row_num + 1);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
563 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (tempwid),
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
564 GPOINTER_TO_INT(cv->value));
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
565 gtk_widget_show (tempwid);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
566
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
567 option_data->tbl_col_num = (option_data->tbl_col_num + 1) % 2;
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
568
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
569 if (cv->comment != NULL)
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
570 {
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
571 tooltip = gtk_tooltips_new ();
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
572 gtk_tooltips_set_tip (GTK_TOOLTIPS(tooltip), tempwid, cv->comment, NULL);
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
573 }
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
574
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
575 return (tempwid);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
576 }
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
577
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
578
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
579 static void
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
580 _save_option_type_checkbox (gftp_config_vars * cv, void *user_data)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
581 {
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
582 gftp_options_dialog_data * option_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
583
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
584 option_data = user_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
585 cv->value = GINT_TO_POINTER (GTK_TOGGLE_BUTTON (cv->user_data)->active);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
586 }
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
587
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
588
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
589 static void *
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
590 _print_option_type_float (gftp_config_vars * cv, void *user_data)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
591 {
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
592 gftp_options_dialog_data * option_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
593 GtkWidget * tempwid;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
594 char tempstr[20];
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
595 float f;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
596
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
597 option_data = user_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
598
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
599 tempwid = _gen_input_widget (option_data, cv->description, cv->comment);
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
600 memcpy (&f, &cv->value, sizeof (f));
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
601 g_snprintf (tempstr, sizeof (tempstr), "%.2f", f);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
602 gtk_entry_set_text (GTK_ENTRY (tempwid), tempstr);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
603 return (tempwid);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
604 }
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
605
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
606
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
607 static void
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
608 _save_option_type_float (gftp_config_vars * cv, void *user_data)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
609 {
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
610 gftp_options_dialog_data * option_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
611 const char *tempstr;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
612 float f;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
613
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
614 option_data = user_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
615 tempstr = gtk_entry_get_text (GTK_ENTRY (cv->user_data));
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
616 f = strtod (tempstr, NULL);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
617 memcpy (&cv->value, &f, sizeof (cv->value));
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
618 }
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
619
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
620
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
621 static void *
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
622 _print_option_type_notebook (gftp_config_vars * cv, void *user_data)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
623 {
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
624 gftp_options_dialog_data * option_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
625 GtkWidget * tempwid;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
626
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
627 option_data = user_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
628
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
629 option_data->box = gtk_vbox_new (FALSE, 0);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
630 gtk_container_border_width (GTK_CONTAINER (option_data->box), 10);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
631 gtk_widget_show (option_data->box);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
632
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
633 tempwid = gtk_label_new (_(cv->description));
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
634 gtk_widget_show (tempwid);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
635 gtk_notebook_append_page (GTK_NOTEBOOK (option_data->notebook),
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
636 option_data->box, tempwid);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
637
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
638 _print_option_type_newtable (NULL, user_data);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
639
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
640 return (NULL);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
641 }
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
642
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
643
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
644 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
645 clean_old_changes (GtkWidget * widget, gpointer data)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
646 {
218
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
647 if (new_proxy_hosts != NULL)
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
648 {
218
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
649 gftp_free_proxy_hosts (new_proxy_hosts);
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
650 new_proxy_hosts = NULL;
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
651 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
652 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
653
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
654
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
655 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
656 apply_changes (GtkWidget * widget, gpointer data)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
657 {
218
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
658 gftp_config_list_vars * proxy_hosts;
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
659 gftp_config_vars * cv;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
660 GList * templist;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
661 int i;
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
662
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
663 for (templist = gftp_options_list;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
664 templist != NULL;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
665 templist = templist->next)
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
666 {
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
667 cv = templist->data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
668
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
669 for (i=0; cv[i].key != NULL; i++)
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
670 {
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
671 if (!(cv[i].ports_shown & GFTP_PORT_GTK))
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
672 continue;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
673
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
674 if (gftp_option_types[cv[i].otype].ui_save_function == NULL)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
675 continue;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
676
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
677 gftp_option_types[cv[i].otype].ui_save_function (&cv[i], gftp_option_types[cv[i].otype].user_data);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
678 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
679 }
218
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
680
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
681 gftp_lookup_global_option ("dont_use_proxy", &proxy_hosts);
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
682
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
683 if (proxy_hosts->list != NULL)
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
684 gftp_free_proxy_hosts (proxy_hosts->list);
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
685
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
686 proxy_hosts->list = new_proxy_hosts;
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
687 new_proxy_hosts = NULL;
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
688 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
689
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
690
45
311e29c40ed6 2002-10-31 Brian Masney <masneyb@gftp.org>
masneyb
parents: 37
diff changeset
691 #if GTK_MAJOR_VERSION > 1
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
692 static void
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
693 options_action (GtkWidget * widget, gint response, gpointer user_data)
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
694 {
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
695 switch (response)
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
696 {
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
697 case GTK_RESPONSE_APPLY:
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
698 apply_changes (widget, NULL);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
699 break;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
700 case GTK_RESPONSE_OK:
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
701 apply_changes (widget, NULL);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
702 /* no break */
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
703 default:
218
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
704 clean_old_changes (widget, user_data);
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
705 gtk_widget_destroy (widget);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
706 }
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
707 }
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
708 #endif
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
709
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
710
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
711 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
712 add_host_to_listbox (GList * templist)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
713 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
714 gftp_proxy_hosts *hosts;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
715 char *add_data[2];
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
716 int num;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
717
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
718 hosts = templist->data;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
719 if (hosts->domain)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
720 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
721 add_data[0] = hosts->domain;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
722 add_data[1] = NULL;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
723 num = gtk_clist_append (GTK_CLIST (proxy_list), add_data);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
724 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
725 else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
726 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
727 add_data[0] = g_strdup_printf ("%d.%d.%d.%d",
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
728 hosts->ipv4_network_address >> 24 & 0xff,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
729 hosts->ipv4_network_address >> 16 & 0xff,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
730 hosts->ipv4_network_address >> 8 & 0xff,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
731 hosts->ipv4_network_address & 0xff);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
732 add_data[1] = g_strdup_printf ("%d.%d.%d.%d",
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
733 hosts->ipv4_netmask >> 24 & 0xff,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
734 hosts->ipv4_netmask >> 16 & 0xff,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
735 hosts->ipv4_netmask >> 8 & 0xff,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
736 hosts->ipv4_netmask & 0xff);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
737 num = gtk_clist_append (GTK_CLIST (proxy_list), add_data);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
738 g_free (add_data[0]);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
739 g_free (add_data[1]);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
740 }
218
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
741
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
742 gtk_clist_set_row_data (GTK_CLIST (proxy_list), num, (gpointer) templist);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
743 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
744
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
745
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
746 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
747 add_ok (GtkWidget * widget, gpointer data)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
748 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
749 gftp_proxy_hosts *hosts;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
750 const char *edttxt;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
751 GList *templist;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
752 int num;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
753
218
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
754 templist = data;
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
755 if (templist == NULL)
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
756 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
757 hosts = g_malloc0 (sizeof (*hosts));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
758 new_proxy_hosts = g_list_append (new_proxy_hosts, hosts);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
759 for (templist = new_proxy_hosts; templist->next != NULL;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
760 templist = templist->next);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
761 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
762 else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
763 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
764 num = gtk_clist_find_row_from_data (GTK_CLIST (proxy_list), templist);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
765 if (num != -1)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
766 gtk_clist_remove (GTK_CLIST (proxy_list), num);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
767 hosts = templist->data;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
768 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
769
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
770 if (hosts->domain)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
771 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
772 g_free (hosts->domain);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
773 hosts->domain = NULL;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
774 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
775
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
776 if (GTK_TOGGLE_BUTTON (domain_active)->active)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
777 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
778 edttxt = gtk_entry_get_text (GTK_ENTRY (new_proxy_domain));
218
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
779 hosts->domain = g_strdup (edttxt);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
780 hosts->ipv4_netmask = hosts->ipv4_network_address = 0;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
781 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
782 else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
783 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
784 edttxt = gtk_entry_get_text (GTK_ENTRY (network1));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
785 hosts->ipv4_network_address = (strtol (edttxt, NULL, 10) & 0xff) << 24;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
786
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
787 edttxt = gtk_entry_get_text (GTK_ENTRY (network2));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
788 hosts->ipv4_network_address |= (strtol (edttxt, NULL, 10) & 0xff) << 16;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
789
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
790 edttxt = gtk_entry_get_text (GTK_ENTRY (network3));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
791 hosts->ipv4_network_address |= (strtol (edttxt, NULL, 10) & 0xff) << 8;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
792
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
793 edttxt = gtk_entry_get_text (GTK_ENTRY (network4));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
794 hosts->ipv4_network_address |= strtol (edttxt, NULL, 10) & 0xff;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
795
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
796 edttxt = gtk_entry_get_text (GTK_ENTRY (netmask1));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
797 hosts->ipv4_netmask = (strtol (edttxt, NULL, 10) & 0xff) << 24;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
798
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
799 edttxt = gtk_entry_get_text (GTK_ENTRY (netmask2));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
800 hosts->ipv4_netmask |= (strtol (edttxt, NULL, 10) & 0xff) << 16;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
801
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
802 edttxt = gtk_entry_get_text (GTK_ENTRY (netmask3));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
803 hosts->ipv4_netmask |= (strtol (edttxt, NULL, 10) & 0xff) << 8;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
804
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
805 edttxt = gtk_entry_get_text (GTK_ENTRY (netmask4));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
806 hosts->ipv4_netmask |= strtol (edttxt, NULL, 10) & 0xff;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
807 }
218
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
808
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
809 add_host_to_listbox (templist);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
810 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
811
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
812
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
813 #if GTK_MAJOR_VERSION > 1
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
814 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
815 proxyhosts_action (GtkWidget * widget, gint response, gpointer user_data)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
816 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
817 switch (response)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
818 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
819 case GTK_RESPONSE_OK:
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
820 add_ok (widget, user_data);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
821 /* no break */
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
822 default:
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
823 gtk_widget_destroy (widget);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
824 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
825 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
826 #endif
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
827
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
828
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
829 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
830 add_toggle (GtkWidget * widget, gpointer data)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
831 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
832 gtk_widget_set_sensitive (new_proxy_domain, data != NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
833 gtk_widget_set_sensitive (network1, data == NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
834 gtk_widget_set_sensitive (network2, data == NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
835 gtk_widget_set_sensitive (network3, data == NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
836 gtk_widget_set_sensitive (network4, data == NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
837 gtk_widget_set_sensitive (netmask1, data == NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
838 gtk_widget_set_sensitive (netmask2, data == NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
839 gtk_widget_set_sensitive (netmask3, data == NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
840 gtk_widget_set_sensitive (netmask4, data == NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
841 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
842
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
843
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
844 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
845 delete_proxy_host (GtkWidget * widget, gpointer data)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
846 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
847 GList *templist;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
848 int num;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
849
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
850 if ((templist = GTK_CLIST (proxy_list)->selection) == NULL)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
851 return;
195
3fa7b4f4ab78 2003-6-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 168
diff changeset
852 num = GPOINTER_TO_INT (templist->data);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
853 templist = gtk_clist_get_row_data (GTK_CLIST (proxy_list), num);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
854 new_proxy_hosts = g_list_remove_link (new_proxy_hosts, templist);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
855 gtk_clist_remove (GTK_CLIST (proxy_list), num);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
856 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
857
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
858
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
859 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
860 add_proxy_host (GtkWidget * widget, gpointer data)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
861 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
862 GtkWidget *tempwid, *dialog, *frame, *box, *table;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
863 gftp_proxy_hosts *hosts;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
864 char *tempstr, *title;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
865 GList *templist;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
866
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
867 if (data)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
868 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
869 if ((templist = GTK_CLIST (proxy_list)->selection) == NULL)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
870 return;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
871 templist = gtk_clist_get_row_data (GTK_CLIST (proxy_list),
195
3fa7b4f4ab78 2003-6-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 168
diff changeset
872 GPOINTER_TO_INT (templist->data));
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
873 hosts = templist->data;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
874 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
875 else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
876 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
877 hosts = NULL;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
878 templist = NULL;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
879 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
880
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
881 title = hosts ? _("Edit Host") : _("Add Host");
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
882 #if GTK_MAJOR_VERSION == 1
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
883 dialog = gtk_dialog_new ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
884 gtk_window_set_title (GTK_WINDOW (dialog), title);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
885 gtk_container_border_width (GTK_CONTAINER
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
886 (GTK_DIALOG (dialog)->action_area), 5);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
887 gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->action_area), 15);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
888 gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dialog)->action_area), TRUE);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
889 gtk_grab_add (dialog);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
890 #else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
891 dialog = gtk_dialog_new_with_buttons (title, NULL, 0,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
892 GTK_STOCK_SAVE,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
893 GTK_RESPONSE_OK,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
894 GTK_STOCK_CANCEL,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
895 GTK_RESPONSE_CANCEL,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
896 NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
897 #endif
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
898 gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 10);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
899 gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 2);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
900 gtk_window_set_wmclass (GTK_WINDOW(dialog), "hostinfo", "Gftp");
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
901 gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
902
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
903 frame = gtk_frame_new (NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
904 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), frame, TRUE, TRUE,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
905 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
906 gtk_widget_show (frame);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
907
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
908 box = gtk_hbox_new (FALSE, 5);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
909 gtk_container_border_width (GTK_CONTAINER (box), 5);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
910 gtk_container_add (GTK_CONTAINER (frame), box);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
911 gtk_widget_show (box);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
912
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
913 tempwid = gtk_label_new (_("Domain"));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
914 gtk_box_pack_start (GTK_BOX (box), tempwid, TRUE, TRUE, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
915 gtk_widget_show (tempwid);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
916
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
917 new_proxy_domain = gtk_entry_new ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
918 gtk_box_pack_start (GTK_BOX (box), new_proxy_domain, TRUE, TRUE, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
919 gtk_widget_show (new_proxy_domain);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
920
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
921 frame = gtk_frame_new (NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
922 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), frame, TRUE, TRUE,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
923 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
924 gtk_widget_show (frame);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
925
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
926 table = gtk_table_new (4, 2, FALSE);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
927 gtk_container_border_width (GTK_CONTAINER (table), 5);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
928 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
929 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
930 gtk_container_add (GTK_CONTAINER (frame), table);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
931 gtk_widget_show (table);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
932
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
933 tempwid = gtk_label_new (_("Network Address"));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
934 gtk_misc_set_alignment (GTK_MISC (tempwid), 1, 0.5);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
935 gtk_table_attach_defaults (GTK_TABLE (table), tempwid, 0, 1, 0, 1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
936 gtk_widget_show (tempwid);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
937
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
938 box = gtk_hbox_new (FALSE, 5);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
939 gtk_table_attach_defaults (GTK_TABLE (table), box, 1, 2, 0, 1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
940 gtk_widget_show (box);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
941
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
942 network1 = gtk_entry_new ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
943 gtk_widget_set_size_request (network1, 28, -1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
944
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
945 gtk_box_pack_start (GTK_BOX (box), network1, TRUE, TRUE, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
946 gtk_widget_show (network1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
947
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
948 network2 = gtk_entry_new ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
949 gtk_widget_set_size_request (network2, 28, -1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
950
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
951 gtk_box_pack_start (GTK_BOX (box), network2, TRUE, TRUE, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
952 gtk_widget_show (network2);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
953
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
954 network3 = gtk_entry_new ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
955 gtk_widget_set_size_request (network3, 28, -1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
956
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
957 gtk_box_pack_start (GTK_BOX (box), network3, TRUE, TRUE, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
958 gtk_widget_show (network3);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
959
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
960 network4 = gtk_entry_new ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
961 gtk_widget_set_size_request (network4, 28, -1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
962
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
963 gtk_box_pack_start (GTK_BOX (box), network4, TRUE, TRUE, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
964 gtk_widget_show (network4);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
965
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
966 tempwid = gtk_label_new (_("Netmask"));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
967 gtk_misc_set_alignment (GTK_MISC (tempwid), 1, 0.5);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
968 gtk_table_attach_defaults (GTK_TABLE (table), tempwid, 0, 1, 1, 2);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
969 gtk_widget_show (tempwid);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
970
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
971 box = gtk_hbox_new (FALSE, 5);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
972 gtk_table_attach_defaults (GTK_TABLE (table), box, 1, 2, 1, 2);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
973 gtk_widget_show (box);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
974
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
975 netmask1 = gtk_entry_new ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
976 gtk_widget_set_size_request (netmask1, 28, -1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
977
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
978 gtk_box_pack_start (GTK_BOX (box), netmask1, TRUE, TRUE, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
979 gtk_widget_show (netmask1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
980
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
981 netmask2 = gtk_entry_new ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
982 gtk_widget_set_size_request (netmask2, 28, -1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
983
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
984 gtk_box_pack_start (GTK_BOX (box), netmask2, TRUE, TRUE, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
985 gtk_widget_show (netmask2);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
986
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
987 netmask3 = gtk_entry_new ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
988 gtk_widget_set_size_request (netmask3, 28, -1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
989
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
990 gtk_box_pack_start (GTK_BOX (box), netmask3, TRUE, TRUE, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
991 gtk_widget_show (netmask3);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
992
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
993 netmask4 = gtk_entry_new ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
994 gtk_widget_set_size_request (netmask4, 28, -1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
995
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
996 gtk_box_pack_start (GTK_BOX (box), netmask4, TRUE, TRUE, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
997 gtk_widget_show (netmask4);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
998
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
999 box = gtk_hbox_new (FALSE, 5);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1000 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), box, TRUE, TRUE,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1001 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1002 gtk_widget_show (box);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1003
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1004 domain_active = gtk_radio_button_new_with_label (NULL, _("Domain"));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1005 gtk_signal_connect (GTK_OBJECT (domain_active), "toggled",
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1006 GTK_SIGNAL_FUNC (add_toggle), (gpointer) 1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1007 gtk_box_pack_start (GTK_BOX (box), domain_active, TRUE, TRUE, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1008 gtk_widget_show (domain_active);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1009
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1010 tempwid = gtk_radio_button_new_with_label (gtk_radio_button_group
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1011 (GTK_RADIO_BUTTON (domain_active)),
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1012 _("Network"));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1013 gtk_signal_connect (GTK_OBJECT (tempwid), "toggled",
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1014 GTK_SIGNAL_FUNC (add_toggle), NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1015 gtk_box_pack_start (GTK_BOX (box), tempwid, TRUE, TRUE, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1016 gtk_widget_show (tempwid);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1017
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1018 if (!hosts || !hosts->domain)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1019 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1020 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (tempwid), TRUE);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1021 add_toggle (NULL, NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1022 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1023 else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1024 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1025 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (domain_active), TRUE);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1026 add_toggle (NULL, (gpointer) 1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1027 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1028
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1029 if (hosts)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1030 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1031 if (hosts->domain)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1032 gtk_entry_set_text (GTK_ENTRY (new_proxy_domain), hosts->domain);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1033 else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1034 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1035 tempstr = g_strdup_printf ("%d", hosts->ipv4_network_address >> 24 & 0xff);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1036 gtk_entry_set_text (GTK_ENTRY (network1), tempstr);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1037 g_free (tempstr);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1038
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1039 tempstr = g_strdup_printf ("%d", hosts->ipv4_network_address >> 16 & 0xff);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1040 gtk_entry_set_text (GTK_ENTRY (network2), tempstr);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1041 g_free (tempstr);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1042
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1043 tempstr = g_strdup_printf ("%d", hosts->ipv4_network_address >> 8 & 0xff);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1044 gtk_entry_set_text (GTK_ENTRY (network3), tempstr);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1045 g_free (tempstr);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1046
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1047 tempstr = g_strdup_printf ("%d", hosts->ipv4_network_address & 0xff);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1048 gtk_entry_set_text (GTK_ENTRY (network4), tempstr);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1049 g_free (tempstr);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1050
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1051 tempstr = g_strdup_printf ("%d", hosts->ipv4_netmask >> 24 & 0xff);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1052 gtk_entry_set_text (GTK_ENTRY (netmask1), tempstr);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1053 g_free (tempstr);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1054
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1055 tempstr = g_strdup_printf ("%d", hosts->ipv4_netmask >> 16 & 0xff);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1056 gtk_entry_set_text (GTK_ENTRY (netmask2), tempstr);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1057 g_free (tempstr);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1058
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1059 tempstr = g_strdup_printf ("%d", hosts->ipv4_netmask >> 8 & 0xff);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1060 gtk_entry_set_text (GTK_ENTRY (netmask3), tempstr);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1061 g_free (tempstr);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1062
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1063 tempstr = g_strdup_printf ("%d", hosts->ipv4_netmask & 0xff);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1064 gtk_entry_set_text (GTK_ENTRY (netmask4), tempstr);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1065 g_free (tempstr);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1066 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1067 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1068
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1069 #if GTK_MAJOR_VERSION == 1
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1070 tempwid = gtk_button_new_with_label (_("OK"));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1071 GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1072 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), tempwid,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1073 TRUE, TRUE, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1074 gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1075 GTK_SIGNAL_FUNC (add_ok), (gpointer) templist);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1076 gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked",
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1077 GTK_SIGNAL_FUNC (gtk_widget_destroy),
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1078 GTK_OBJECT (dialog));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1079 gtk_widget_show (tempwid);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1080
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1081 tempwid = gtk_button_new_with_label (_(" Cancel "));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1082 GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1083 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), tempwid,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1084 TRUE, TRUE, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1085 gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked",
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1086 GTK_SIGNAL_FUNC (gtk_widget_destroy),
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1087 GTK_OBJECT (dialog));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1088 gtk_widget_show (tempwid);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1089 #else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1090 g_signal_connect (GTK_OBJECT (dialog), "response",
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1091 G_CALLBACK (proxyhosts_action), NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1092 #endif
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1093
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1094 gtk_widget_show (dialog);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1095 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1096
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1097 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1098 make_proxy_hosts_tab (GtkWidget * notebook)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1099 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1100 GtkWidget *tempwid, *box, *hbox, *scroll;
218
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1101 gftp_config_list_vars * proxy_hosts;
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1102 char *add_data[2];
218
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1103 GList * templist;
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1104
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1105 add_data[0] = _("Network");
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1106 add_data[1] = _("Netmask");
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1107
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1108 box = gtk_vbox_new (FALSE, 5);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1109 gtk_container_border_width (GTK_CONTAINER (box), 10);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1110 gtk_widget_show (box);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1111
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1112 tempwid = gtk_label_new (_("Local Hosts"));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1113 gtk_widget_show (tempwid);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1114 gtk_notebook_append_page (GTK_NOTEBOOK (notebook), box, tempwid);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1115
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1116 scroll = gtk_scrolled_window_new (NULL, NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1117 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1118 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1119 gtk_box_pack_start (GTK_BOX (box), scroll, TRUE, TRUE, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1120
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1121 proxy_list = gtk_clist_new_with_titles (2, add_data);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1122 gtk_container_add (GTK_CONTAINER (scroll), proxy_list);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1123 gtk_clist_set_column_auto_resize (GTK_CLIST (proxy_list), 0, TRUE);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1124 gtk_clist_set_column_auto_resize (GTK_CLIST (proxy_list), 1, TRUE);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1125 gtk_widget_show (proxy_list);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1126 gtk_widget_show (scroll);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1127
218
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1128 gftp_lookup_global_option ("dont_use_proxy", &proxy_hosts);
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1129 new_proxy_hosts = gftp_copy_proxy_hosts (proxy_hosts->list);
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1130
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1131 for (templist = new_proxy_hosts;
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1132 templist != NULL;
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1133 templist = templist->next)
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1134 add_host_to_listbox (templist);
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1135
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1136 hbox = gtk_hbox_new (TRUE, 15);
218
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1137
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1138 gtk_box_pack_start (GTK_BOX (box), hbox, FALSE, FALSE, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1139 gtk_widget_show (hbox);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1140
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1141 tempwid = gtk_button_new_with_label (_("Add"));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1142 GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1143 gtk_box_pack_start (GTK_BOX (hbox), tempwid, TRUE, TRUE, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1144 gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1145 GTK_SIGNAL_FUNC (add_proxy_host), NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1146 gtk_widget_show (tempwid);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1147
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1148 tempwid = gtk_button_new_with_label (_("Edit"));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1149 GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1150 gtk_box_pack_start (GTK_BOX (hbox), tempwid, TRUE, TRUE, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1151 gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1152 GTK_SIGNAL_FUNC (add_proxy_host), (gpointer) 1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1153 gtk_widget_show (tempwid);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1154
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1155 tempwid = gtk_button_new_with_label (_("Delete"));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1156 GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1157 gtk_box_pack_start (GTK_BOX (hbox), tempwid, TRUE, TRUE, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1158 gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1159 GTK_SIGNAL_FUNC (delete_proxy_host), NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1160 gtk_widget_show (tempwid);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1161 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1162
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1163
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1164 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1165 options_dialog (gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1166 {
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1167 gftp_options_dialog_data option_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1168 gftp_config_vars * cv;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1169 GList * templist;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1170 int i;
151
2f15b3000dbc 2003-4-27 Brian Masney <masneyb@gftp.org>
masneyb
parents: 139
diff changeset
1171 #if GTK_MAJOR_VERSION == 1
2f15b3000dbc 2003-4-27 Brian Masney <masneyb@gftp.org>
masneyb
parents: 139
diff changeset
1172 GtkWidget * tempwid;
2f15b3000dbc 2003-4-27 Brian Masney <masneyb@gftp.org>
masneyb
parents: 139
diff changeset
1173 #endif
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1174
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1175 memset (&option_data, 0, sizeof (option_data));
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1176 _setup_option (gftp_option_type_text, &option_data,
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
1177 _print_option_type_text, _save_option_type_text, NULL);
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1178 _setup_option (gftp_option_type_textcombo, &option_data,
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
1179 _print_option_type_textcombo, _save_option_type_textcombo,
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
1180 NULL);
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1181 _setup_option (gftp_option_type_textcomboedt, &option_data,
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1182 _print_option_type_textcomboedt,
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
1183 _save_option_type_textcomboedt,
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
1184 _cancel_option_type_textcomboedt);
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1185 _setup_option (gftp_option_type_hidetext, &option_data,
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
1186 _print_option_type_hidetext, _save_option_type_text, NULL);
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1187 _setup_option (gftp_option_type_int, &option_data,
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
1188 _print_option_type_int, _save_option_type_int, NULL);
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1189 _setup_option (gftp_option_type_checkbox, &option_data,
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
1190 _print_option_type_checkbox, _save_option_type_checkbox, NULL);
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1191 _setup_option (gftp_option_type_float, &option_data,
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
1192 _print_option_type_float, _save_option_type_float, NULL);
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1193 _setup_option (gftp_option_type_notebook, &option_data,
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
1194 _print_option_type_notebook, NULL, NULL);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1195
45
311e29c40ed6 2002-10-31 Brian Masney <masneyb@gftp.org>
masneyb
parents: 37
diff changeset
1196 #if GTK_MAJOR_VERSION == 1
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1197 option_data.dialog = gtk_dialog_new ();
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1198 gtk_window_set_title (GTK_WINDOW (option_data.dialog), _("Options"));
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1199 gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (option_data.dialog)->action_area), 5);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1200 gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (option_data.dialog)->action_area), 15);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1201 gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (option_data.dialog)->action_area), TRUE);
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
1202 #else
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1203 option_data.dialog = gtk_dialog_new_with_buttons (_("Options"), NULL, 0,
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1204 GTK_STOCK_OK,
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
1205 GTK_RESPONSE_OK,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
1206 GTK_STOCK_CANCEL,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
1207 GTK_RESPONSE_CANCEL,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
1208 GTK_STOCK_APPLY,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
1209 GTK_RESPONSE_APPLY,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
1210 NULL);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
1211 #endif
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1212 gtk_window_set_wmclass (GTK_WINDOW(option_data.dialog), "options", "gFTP");
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1213 gtk_window_set_position (GTK_WINDOW (option_data.dialog), GTK_WIN_POS_MOUSE);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1214 gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (option_data.dialog)->vbox), 10);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1215 gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (option_data.dialog)->vbox), 2);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1216 gtk_widget_realize (option_data.dialog);
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
1217
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
1218 if (gftp_icon != NULL)
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
1219 {
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1220 gdk_window_set_icon (option_data.dialog->window, NULL, gftp_icon->pixmap,
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
1221 gftp_icon->bitmap);
168
c505d9ba9d53 2003-6-6 Brian Masney <masneyb@gftp.org>
masneyb
parents: 151
diff changeset
1222 gdk_window_set_icon_name (option_data.dialog->window, gftp_version);
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
1223 }
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1224
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1225 option_data.notebook = gtk_notebook_new ();
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1226 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (option_data.dialog)->vbox),
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1227 option_data.notebook, TRUE, TRUE, 0);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1228 gtk_widget_show (option_data.notebook);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1229
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1230 cv = gftp_options_list->data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1231 option_data.last_option = cv[0].otype;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1232 for (templist = gftp_options_list;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1233 templist != NULL;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1234 templist = templist->next)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1235 {
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1236 cv = templist->data;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1237
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1238 for (i=0; cv[i].key != NULL; i++)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1239 {
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1240 if (!(cv[i].ports_shown & GFTP_PORT_GTK))
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1241 continue;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1242
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1243 if (gftp_option_types[cv[i].otype].ui_print_function == NULL)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1244 continue;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1245
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1246 cv[i].user_data = gftp_option_types[cv[i].otype].ui_print_function (&cv[i], gftp_option_types[cv[i].otype].user_data);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1247
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1248 option_data.last_option = cv[i].otype;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1249 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1250 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1251
218
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1252 make_proxy_hosts_tab (option_data.notebook);
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1253
45
311e29c40ed6 2002-10-31 Brian Masney <masneyb@gftp.org>
masneyb
parents: 37
diff changeset
1254 #if GTK_MAJOR_VERSION == 1
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1255 tempwid = gtk_button_new_with_label (_("OK"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1256 GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1257 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (option_data.dialog)->action_area),
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1258 tempwid, TRUE, TRUE, 0);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1259 gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1260 GTK_SIGNAL_FUNC (apply_changes), NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1261 gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1262 GTK_SIGNAL_FUNC (gtk_widget_destroy),
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1263 GTK_OBJECT (option_data.dialog));
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1264 gtk_widget_show (tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1265
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1266 tempwid = gtk_button_new_with_label (_(" Cancel "));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1267 GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1268 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (option_data.dialog)->action_area),
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1269 tempwid, TRUE, TRUE, 0);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1270 gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1271 GTK_SIGNAL_FUNC (clean_old_changes), NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1272 gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1273 GTK_SIGNAL_FUNC (gtk_widget_destroy),
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1274 GTK_OBJECT (option_data.dialog));
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1275 gtk_widget_show (tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1276
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1277 tempwid = gtk_button_new_with_label (_("Apply"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1278 GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1279 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (option_data.dialog)->action_area),
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1280 tempwid, TRUE, TRUE, 0);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1281 gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1282 GTK_SIGNAL_FUNC (apply_changes), NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1283 gtk_widget_grab_default (tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1284 gtk_widget_show (tempwid);
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
1285 #else
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1286 g_signal_connect (GTK_OBJECT (option_data.dialog), "response",
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
1287 G_CALLBACK (options_action), NULL);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
1288 #endif
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1289
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1290 gtk_widget_show (option_data.dialog);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1291 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1292