annotate src/gtk/options_dialog.c @ 219:b9584a877daf

2003-7-9 Brian Masney <masneyb@gftp.org> * lib/sshv2.c - if we are logging in to the server, and the message size is too big from the server, assume that an error message follows and log the ASCII text to the log window * src/gtk/options_dialog.c - make sure the value is set properly for the textcomboedt option types (the FTP proxy server type uses this) * lib/rfc2068.c - HTTP proxy bug fixes. Also, moved rfc2068_connect() call to rfc2068_send_command() and removed it from the now unneeded places. Also, fix in call to HEAD command * src/text/gftp-text.c - fixed NULL pointer deference in changing directory * docs/sample.gftp/gftprc - enable require SSH user/pass by default
author masneyb
date Wed, 09 Jul 2003 23:25:57 +0000
parents de6a2e8e51cb
children a85a097bbb02
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;
219
b9584a877daf 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 218
diff changeset
289
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
290 for (stpos = str;
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
291 (endpos = strstr (stpos, "%n")) != NULL;
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
292 stpos = endpos + 2)
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
293 {
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
294 savechar = *endpos;
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
295 *endpos = '\0';
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
296
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
297 len += strlen (stpos) + 1;
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
298 ret = g_realloc (ret, len + 1);
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
299 strcat (ret, stpos);
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
300 strcat (ret, "\n");
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
301
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
302 *endpos = savechar;
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
219
b9584a877daf 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 218
diff changeset
305 if (stpos != NULL && *stpos != '\0')
b9584a877daf 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 218
diff changeset
306 {
b9584a877daf 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 218
diff changeset
307 len += strlen (stpos);
b9584a877daf 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 218
diff changeset
308 ret = g_realloc (ret, len + 1);
b9584a877daf 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 218
diff changeset
309 strcat (ret, stpos);
b9584a877daf 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 218
diff changeset
310 }
b9584a877daf 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 218
diff changeset
311
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
312 return (ret);
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
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
315
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
316 static char *
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
317 _gftp_convert_from_newlines (char *str)
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
318 {
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
319 char *stpos, *endpos, *ret, savechar;
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
320 size_t len;
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
321
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
322 ret = g_strdup ("");
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
323 len = 0;
219
b9584a877daf 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 218
diff changeset
324
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
325 for (stpos = str;
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
326 (endpos = strchr (stpos, '\n')) != NULL;
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
327 stpos = endpos + 1)
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
328 {
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
329 savechar = *endpos;
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
330 *endpos = '\0';
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
331
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
332 len += strlen (stpos) + 2;
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
333 ret = g_realloc (ret, len + 1);
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
334 strcat (ret, stpos);
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
335 strcat (ret, "%n");
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
336
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
337 *endpos = savechar;
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
338 }
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
339
219
b9584a877daf 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 218
diff changeset
340 if (stpos != NULL && *stpos != '\0')
b9584a877daf 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 218
diff changeset
341 {
b9584a877daf 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 218
diff changeset
342 len += strlen (stpos);
b9584a877daf 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 218
diff changeset
343 ret = g_realloc (ret, len + 1);
b9584a877daf 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 218
diff changeset
344 strcat (ret, stpos);
b9584a877daf 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 218
diff changeset
345 }
b9584a877daf 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 218
diff changeset
346
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
347 return (ret);
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
348 }
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
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
351 static void *
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
352 _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
353 {
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
354 gftp_textcomboedt_widget_data * widdata;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
355 GtkWidget * combo, * textwid, * tempwid;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
356 gftp_options_dialog_data * option_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
357 gftp_textcomboedt_data * tedata;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
358 int i, selitem, edititem;
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
359 GtkTooltips * tooltip;
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
360 GList * widget_list;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
361 char *tempstr;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
362
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
363 option_data = user_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
364 combo = _gen_combo_widget (option_data, cv->description);
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
365
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
366 tempstr = NULL;
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
367 if (cv->value != NULL)
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
368 tempstr = _gftp_convert_to_newlines (cv->value);
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
369 if (tempstr == NULL)
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
370 tempstr = g_strdup ("");
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
371
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
372 edititem = selitem = -1;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
373 if (cv->listdata != NULL)
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 widget_list = NULL;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
376
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
377 tedata = cv->listdata;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
378 for (i=0; tedata[i].description != NULL; i++)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
379 {
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
380 if (tedata[i].flags & GFTP_TEXTCOMBOEDT_EDITABLE)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
381 edititem = i;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
382
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
383 if (selitem == -1 &&
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
384 strcasecmp (tempstr, tedata[i].text) == 0)
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
385 selitem = i;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
386
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
387 tempwid = gtk_list_item_new_with_label (tedata[i].description);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
388 gtk_widget_show (tempwid);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
389 widget_list = g_list_append (widget_list, tempwid);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
390 }
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
391
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
392 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
393
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
394 if (selitem == -1 && edititem != -1)
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
395 selitem = edititem;
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
396 }
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
397
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
398 if (selitem == -1)
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
399 selitem = 0;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
400
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
401 option_data->tbl_row_num++;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
402 gtk_table_resize (GTK_TABLE (option_data->table),
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
403 option_data->tbl_row_num, 2);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
404
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
405 #if GTK_MAJOR_VERSION == 1
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
406 textwid = gtk_text_new (NULL, NULL);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
407 #else
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
408 textwid = gtk_text_view_new ();
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
409 #endif
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
410 gtk_widget_set_size_request (textwid, -1, 75);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
411 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
412 option_data->tbl_row_num - 1,
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
413 option_data->tbl_row_num);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
414 gtk_widget_show (textwid);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
415
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
416 widdata = g_malloc0 (sizeof (*widdata));
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
417 widdata->combo = combo;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
418 widdata->text = textwid;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
419 widdata->cv = cv;
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
420 widdata->custom_edit_value = tempstr;
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
421
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
422 gtk_signal_connect (GTK_OBJECT (GTK_COMBO (combo)->list),
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
423 "select_child",
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
424 GTK_SIGNAL_FUNC (_textcomboedt_toggle), widdata);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
425 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
426 gtk_widget_show (combo);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
427
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
428 if (cv->comment != NULL)
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 tooltip = gtk_tooltips_new ();
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
431 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
432
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
433 tooltip = gtk_tooltips_new ();
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
434 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
435 }
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
436
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
437 return (widdata);
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
438 }
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
439
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
440
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
441 static void
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
442 _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
443 {
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
444 gftp_textcomboedt_widget_data * widdata;
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
445
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
446 widdata = cv->user_data;
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
447 if (widdata != NULL)
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
448 {
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
449 if (widdata->custom_edit_value != NULL)
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
450 g_free (widdata->custom_edit_value);
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
451 g_free (widdata);
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
452 }
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
453 }
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
454
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 static void
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
457 _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
458 {
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
459 gftp_textcomboedt_widget_data * widdata;
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
460 char *newstr;
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
461 int freeit;
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
462 #if GTK_MAJOR_VERSION == 1
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
463 char tmp[128];
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
464 #else
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
465 GtkTextBuffer * textbuf;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
466 GtkTextIter iter, iter2;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
467 size_t len;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
468 #endif
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 widdata = cv->user_data;
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
471
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
472 #if GTK_MAJOR_VERSION == 1
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
473 /*
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
474 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
475 locale (ex Japanese), so we must convert from wide character
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
476 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
477 */
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
478 if (GTK_TEXT (widdata->text)->use_wchar)
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
479 {
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
480 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
481 newstr = tmp;
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
482 }
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
483 else
219
b9584a877daf 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 218
diff changeset
484 newstr = (char *) GTK_TEXT (widdata->text)->text.ch;
b9584a877daf 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 218
diff changeset
485
b9584a877daf 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 218
diff changeset
486 freeit = 0;
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
487 #else
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
488 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
489 len = gtk_text_buffer_get_char_count (textbuf);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
490 gtk_text_buffer_get_iter_at_offset (textbuf, &iter, 0);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
491 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
492 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
493 freeit = 1;
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
494 #endif
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
495
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
496 if (cv->flags & GFTP_CVARS_FLAGS_DYNMEM)
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
497 g_free (cv->value);
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
498
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
499 cv->value = _gftp_convert_from_newlines (newstr);
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
500 cv->flags |= GFTP_CVARS_FLAGS_DYNMEM;
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
501
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
502 if (freeit)
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
503 g_free (newstr);
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
504
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
505 _cancel_option_type_textcomboedt (cv, user_data);
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
506 }
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 static void *
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
510 _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
511 {
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
512 gftp_options_dialog_data * option_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
513 GtkWidget * tempwid;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
514
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
515 option_data = user_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
516
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
517 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
518 gtk_entry_set_visibility (GTK_ENTRY (tempwid), 0);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
519 gtk_entry_set_text (GTK_ENTRY (tempwid), (char *) cv->value);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
520 return (tempwid);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
521 }
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
522
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 static void *
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
525 _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
526 {
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
527 gftp_options_dialog_data * option_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
528 GtkWidget * tempwid;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
529 char tempstr[20];
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
530
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
531 option_data = user_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
532
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
533 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
534 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
535 gtk_entry_set_text (GTK_ENTRY (tempwid), tempstr);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
536 return (tempwid);
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
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
539
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
540 static void
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
541 _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
542 {
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
543 gftp_options_dialog_data * option_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
544 const char *tempstr;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
545
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
546 option_data = user_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
547 tempstr = gtk_entry_get_text (GTK_ENTRY (cv->user_data));
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
548 cv->value = GINT_TO_POINTER(strtol (tempstr, NULL, 10));
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
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 static void *
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
553 _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
554 {
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
555 gftp_options_dialog_data * option_data;
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
556 GtkTooltips * tooltip;
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
557 GtkWidget * tempwid;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
558
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
559 option_data = user_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
560
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
561 if (option_data->last_option != gftp_option_type_checkbox)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
562 _print_option_type_newtable (NULL, user_data);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
563
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
564 if (option_data->tbl_col_num == 0)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
565 {
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
566 option_data->tbl_row_num++;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
567 gtk_table_resize (GTK_TABLE (option_data->table),
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
568 option_data->tbl_row_num + 1, 2);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
569 }
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
570
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
571 tempwid = gtk_check_button_new_with_label (_(cv->description));
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
572 gtk_table_attach_defaults (GTK_TABLE (option_data->table), tempwid,
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
573 option_data->tbl_col_num,
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
574 option_data->tbl_col_num + 1,
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
575 option_data->tbl_row_num,
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
576 option_data->tbl_row_num + 1);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
577 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (tempwid),
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
578 GPOINTER_TO_INT(cv->value));
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
579 gtk_widget_show (tempwid);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
580
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
581 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
582
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
583 if (cv->comment != NULL)
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
584 {
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
585 tooltip = gtk_tooltips_new ();
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
586 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
587 }
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
588
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
589 return (tempwid);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
590 }
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
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
593 static void
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
594 _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
595 {
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
596 gftp_options_dialog_data * option_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
597
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
598 option_data = user_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
599 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
600 }
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
601
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
602
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
603 static void *
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
604 _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
605 {
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
606 gftp_options_dialog_data * option_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
607 GtkWidget * tempwid;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
608 char tempstr[20];
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
609 float f;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
610
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
611 option_data = user_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
612
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
613 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
614 memcpy (&f, &cv->value, sizeof (f));
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
615 g_snprintf (tempstr, sizeof (tempstr), "%.2f", f);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
616 gtk_entry_set_text (GTK_ENTRY (tempwid), tempstr);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
617 return (tempwid);
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 _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
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 const char *tempstr;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
626 float f;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
627
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
628 option_data = user_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
629 tempstr = gtk_entry_get_text (GTK_ENTRY (cv->user_data));
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
630 f = strtod (tempstr, NULL);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
631 memcpy (&cv->value, &f, sizeof (cv->value));
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
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
634
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
635 static void *
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
636 _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
637 {
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
638 gftp_options_dialog_data * option_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
639 GtkWidget * tempwid;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
640
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
641 option_data = user_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
642
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
643 option_data->box = gtk_vbox_new (FALSE, 0);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
644 gtk_container_border_width (GTK_CONTAINER (option_data->box), 10);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
645 gtk_widget_show (option_data->box);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
646
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
647 tempwid = gtk_label_new (_(cv->description));
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
648 gtk_widget_show (tempwid);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
649 gtk_notebook_append_page (GTK_NOTEBOOK (option_data->notebook),
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
650 option_data->box, tempwid);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
651
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
652 _print_option_type_newtable (NULL, user_data);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
653
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
654 return (NULL);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
655 }
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
656
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
657
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
658 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
659 clean_old_changes (GtkWidget * widget, gpointer data)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
660 {
218
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
661 if (new_proxy_hosts != NULL)
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
662 {
218
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
663 gftp_free_proxy_hosts (new_proxy_hosts);
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
664 new_proxy_hosts = NULL;
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
665 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
666 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
667
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
668
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
669 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
670 apply_changes (GtkWidget * widget, gpointer data)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
671 {
218
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
672 gftp_config_list_vars * proxy_hosts;
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
673 gftp_config_vars * cv;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
674 GList * templist;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
675 int i;
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
676
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
677 for (templist = gftp_options_list;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
678 templist != NULL;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
679 templist = templist->next)
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
680 {
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
681 cv = templist->data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
682
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
683 for (i=0; cv[i].key != NULL; i++)
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
684 {
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
685 if (!(cv[i].ports_shown & GFTP_PORT_GTK))
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
686 continue;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
687
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
688 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
689 continue;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
690
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
691 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
692 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
693 }
218
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
694
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
695 gftp_lookup_global_option ("dont_use_proxy", &proxy_hosts);
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
696
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
697 if (proxy_hosts->list != NULL)
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
698 gftp_free_proxy_hosts (proxy_hosts->list);
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
699
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
700 proxy_hosts->list = new_proxy_hosts;
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
701 new_proxy_hosts = NULL;
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
702 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
703
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
704
45
311e29c40ed6 2002-10-31 Brian Masney <masneyb@gftp.org>
masneyb
parents: 37
diff changeset
705 #if GTK_MAJOR_VERSION > 1
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
706 static void
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
707 options_action (GtkWidget * widget, gint response, gpointer user_data)
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
708 {
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
709 switch (response)
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
710 {
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
711 case GTK_RESPONSE_APPLY:
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
712 apply_changes (widget, NULL);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
713 break;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
714 case GTK_RESPONSE_OK:
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
715 apply_changes (widget, NULL);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
716 /* no break */
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
717 default:
218
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
718 clean_old_changes (widget, user_data);
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
719 gtk_widget_destroy (widget);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
720 }
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
721 }
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
722 #endif
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
723
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
724
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
725 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
726 add_host_to_listbox (GList * templist)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
727 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
728 gftp_proxy_hosts *hosts;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
729 char *add_data[2];
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
730 int num;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
731
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
732 hosts = templist->data;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
733 if (hosts->domain)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
734 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
735 add_data[0] = hosts->domain;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
736 add_data[1] = NULL;
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 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
739 else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
740 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
741 add_data[0] = g_strdup_printf ("%d.%d.%d.%d",
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
742 hosts->ipv4_network_address >> 24 & 0xff,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
743 hosts->ipv4_network_address >> 16 & 0xff,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
744 hosts->ipv4_network_address >> 8 & 0xff,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
745 hosts->ipv4_network_address & 0xff);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
746 add_data[1] = g_strdup_printf ("%d.%d.%d.%d",
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
747 hosts->ipv4_netmask >> 24 & 0xff,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
748 hosts->ipv4_netmask >> 16 & 0xff,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
749 hosts->ipv4_netmask >> 8 & 0xff,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
750 hosts->ipv4_netmask & 0xff);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
751 num = gtk_clist_append (GTK_CLIST (proxy_list), add_data);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
752 g_free (add_data[0]);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
753 g_free (add_data[1]);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
754 }
218
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
755
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
756 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
757 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
758
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
759
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
760 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
761 add_ok (GtkWidget * widget, gpointer data)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
762 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
763 gftp_proxy_hosts *hosts;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
764 const char *edttxt;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
765 GList *templist;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
766 int num;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
767
218
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
768 templist = data;
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
769 if (templist == NULL)
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
770 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
771 hosts = g_malloc0 (sizeof (*hosts));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
772 new_proxy_hosts = g_list_append (new_proxy_hosts, hosts);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
773 for (templist = new_proxy_hosts; templist->next != NULL;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
774 templist = templist->next);
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 else
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 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
779 if (num != -1)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
780 gtk_clist_remove (GTK_CLIST (proxy_list), num);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
781 hosts = templist->data;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
782 }
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 if (hosts->domain)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
785 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
786 g_free (hosts->domain);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
787 hosts->domain = NULL;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
788 }
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 if (GTK_TOGGLE_BUTTON (domain_active)->active)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
791 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
792 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
793 hosts->domain = g_strdup (edttxt);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
794 hosts->ipv4_netmask = hosts->ipv4_network_address = 0;
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 else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
797 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
798 edttxt = gtk_entry_get_text (GTK_ENTRY (network1));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
799 hosts->ipv4_network_address = (strtol (edttxt, NULL, 10) & 0xff) << 24;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
800
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
801 edttxt = gtk_entry_get_text (GTK_ENTRY (network2));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
802 hosts->ipv4_network_address |= (strtol (edttxt, NULL, 10) & 0xff) << 16;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
803
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
804 edttxt = gtk_entry_get_text (GTK_ENTRY (network3));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
805 hosts->ipv4_network_address |= (strtol (edttxt, NULL, 10) & 0xff) << 8;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
806
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
807 edttxt = gtk_entry_get_text (GTK_ENTRY (network4));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
808 hosts->ipv4_network_address |= strtol (edttxt, NULL, 10) & 0xff;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
809
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
810 edttxt = gtk_entry_get_text (GTK_ENTRY (netmask1));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
811 hosts->ipv4_netmask = (strtol (edttxt, NULL, 10) & 0xff) << 24;
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 edttxt = gtk_entry_get_text (GTK_ENTRY (netmask2));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
814 hosts->ipv4_netmask |= (strtol (edttxt, NULL, 10) & 0xff) << 16;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
815
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
816 edttxt = gtk_entry_get_text (GTK_ENTRY (netmask3));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
817 hosts->ipv4_netmask |= (strtol (edttxt, NULL, 10) & 0xff) << 8;
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 edttxt = gtk_entry_get_text (GTK_ENTRY (netmask4));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
820 hosts->ipv4_netmask |= strtol (edttxt, NULL, 10) & 0xff;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
821 }
218
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
822
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
823 add_host_to_listbox (templist);
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
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
827 #if GTK_MAJOR_VERSION > 1
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
828 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
829 proxyhosts_action (GtkWidget * widget, gint response, gpointer user_data)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
830 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
831 switch (response)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
832 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
833 case GTK_RESPONSE_OK:
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
834 add_ok (widget, user_data);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
835 /* no break */
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
836 default:
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
837 gtk_widget_destroy (widget);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
838 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
839 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
840 #endif
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 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
844 add_toggle (GtkWidget * widget, gpointer data)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
845 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
846 gtk_widget_set_sensitive (new_proxy_domain, data != NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
847 gtk_widget_set_sensitive (network1, data == NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
848 gtk_widget_set_sensitive (network2, data == NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
849 gtk_widget_set_sensitive (network3, data == NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
850 gtk_widget_set_sensitive (network4, data == NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
851 gtk_widget_set_sensitive (netmask1, data == NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
852 gtk_widget_set_sensitive (netmask2, data == NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
853 gtk_widget_set_sensitive (netmask3, data == NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
854 gtk_widget_set_sensitive (netmask4, data == NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
855 }
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 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
859 delete_proxy_host (GtkWidget * widget, gpointer data)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
860 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
861 GList *templist;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
862 int num;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
863
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
864 if ((templist = GTK_CLIST (proxy_list)->selection) == NULL)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
865 return;
195
3fa7b4f4ab78 2003-6-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 168
diff changeset
866 num = GPOINTER_TO_INT (templist->data);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
867 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
868 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
869 gtk_clist_remove (GTK_CLIST (proxy_list), num);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
870 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
871
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
872
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
873 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
874 add_proxy_host (GtkWidget * widget, gpointer data)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
875 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
876 GtkWidget *tempwid, *dialog, *frame, *box, *table;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
877 gftp_proxy_hosts *hosts;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
878 char *tempstr, *title;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
879 GList *templist;
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 if (data)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
882 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
883 if ((templist = GTK_CLIST (proxy_list)->selection) == NULL)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
884 return;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
885 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
886 GPOINTER_TO_INT (templist->data));
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
887 hosts = templist->data;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
888 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
889 else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
890 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
891 hosts = NULL;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
892 templist = NULL;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
893 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
894
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
895 title = hosts ? _("Edit Host") : _("Add Host");
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
896 #if GTK_MAJOR_VERSION == 1
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
897 dialog = gtk_dialog_new ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
898 gtk_window_set_title (GTK_WINDOW (dialog), title);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
899 gtk_container_border_width (GTK_CONTAINER
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
900 (GTK_DIALOG (dialog)->action_area), 5);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
901 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
902 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
903 gtk_grab_add (dialog);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
904 #else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
905 dialog = gtk_dialog_new_with_buttons (title, NULL, 0,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
906 GTK_STOCK_SAVE,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
907 GTK_RESPONSE_OK,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
908 GTK_STOCK_CANCEL,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
909 GTK_RESPONSE_CANCEL,
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
910 NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
911 #endif
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
912 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
913 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
914 gtk_window_set_wmclass (GTK_WINDOW(dialog), "hostinfo", "Gftp");
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
915 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
916
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
917 frame = gtk_frame_new (NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
918 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
919 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
920 gtk_widget_show (frame);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
921
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
922 box = gtk_hbox_new (FALSE, 5);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
923 gtk_container_border_width (GTK_CONTAINER (box), 5);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
924 gtk_container_add (GTK_CONTAINER (frame), box);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
925 gtk_widget_show (box);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
926
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
927 tempwid = gtk_label_new (_("Domain"));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
928 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
929 gtk_widget_show (tempwid);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
930
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
931 new_proxy_domain = gtk_entry_new ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
932 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
933 gtk_widget_show (new_proxy_domain);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
934
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
935 frame = gtk_frame_new (NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
936 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
937 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
938 gtk_widget_show (frame);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
939
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
940 table = gtk_table_new (4, 2, FALSE);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
941 gtk_container_border_width (GTK_CONTAINER (table), 5);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
942 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
943 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
944 gtk_container_add (GTK_CONTAINER (frame), table);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
945 gtk_widget_show (table);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
946
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
947 tempwid = gtk_label_new (_("Network Address"));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
948 gtk_misc_set_alignment (GTK_MISC (tempwid), 1, 0.5);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
949 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
950 gtk_widget_show (tempwid);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
951
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
952 box = gtk_hbox_new (FALSE, 5);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
953 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
954 gtk_widget_show (box);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
955
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
956 network1 = gtk_entry_new ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
957 gtk_widget_set_size_request (network1, 28, -1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
958
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
959 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
960 gtk_widget_show (network1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
961
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
962 network2 = gtk_entry_new ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
963 gtk_widget_set_size_request (network2, 28, -1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
964
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
965 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
966 gtk_widget_show (network2);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
967
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
968 network3 = gtk_entry_new ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
969 gtk_widget_set_size_request (network3, 28, -1);
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 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
972 gtk_widget_show (network3);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
973
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
974 network4 = gtk_entry_new ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
975 gtk_widget_set_size_request (network4, 28, -1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
976
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
977 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
978 gtk_widget_show (network4);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
979
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
980 tempwid = gtk_label_new (_("Netmask"));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
981 gtk_misc_set_alignment (GTK_MISC (tempwid), 1, 0.5);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
982 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
983 gtk_widget_show (tempwid);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
984
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
985 box = gtk_hbox_new (FALSE, 5);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
986 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
987 gtk_widget_show (box);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
988
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
989 netmask1 = gtk_entry_new ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
990 gtk_widget_set_size_request (netmask1, 28, -1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
991
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
992 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
993 gtk_widget_show (netmask1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
994
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
995 netmask2 = gtk_entry_new ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
996 gtk_widget_set_size_request (netmask2, 28, -1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
997
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
998 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
999 gtk_widget_show (netmask2);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1000
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1001 netmask3 = gtk_entry_new ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1002 gtk_widget_set_size_request (netmask3, 28, -1);
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 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
1005 gtk_widget_show (netmask3);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1006
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1007 netmask4 = gtk_entry_new ();
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1008 gtk_widget_set_size_request (netmask4, 28, -1);
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 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
1011 gtk_widget_show (netmask4);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1012
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1013 box = gtk_hbox_new (FALSE, 5);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1014 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
1015 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1016 gtk_widget_show (box);
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 domain_active = gtk_radio_button_new_with_label (NULL, _("Domain"));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1019 gtk_signal_connect (GTK_OBJECT (domain_active), "toggled",
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1020 GTK_SIGNAL_FUNC (add_toggle), (gpointer) 1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1021 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
1022 gtk_widget_show (domain_active);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1023
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1024 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
1025 (GTK_RADIO_BUTTON (domain_active)),
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1026 _("Network"));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1027 gtk_signal_connect (GTK_OBJECT (tempwid), "toggled",
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1028 GTK_SIGNAL_FUNC (add_toggle), NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1029 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
1030 gtk_widget_show (tempwid);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1031
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1032 if (!hosts || !hosts->domain)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1033 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1034 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (tempwid), TRUE);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1035 add_toggle (NULL, NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1036 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1037 else
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 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
1040 add_toggle (NULL, (gpointer) 1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1041 }
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 if (hosts)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1044 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1045 if (hosts->domain)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1046 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
1047 else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1048 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1049 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
1050 gtk_entry_set_text (GTK_ENTRY (network1), tempstr);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1051 g_free (tempstr);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1052
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1053 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
1054 gtk_entry_set_text (GTK_ENTRY (network2), tempstr);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1055 g_free (tempstr);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1056
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1057 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
1058 gtk_entry_set_text (GTK_ENTRY (network3), tempstr);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1059 g_free (tempstr);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1060
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1061 tempstr = g_strdup_printf ("%d", hosts->ipv4_network_address & 0xff);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1062 gtk_entry_set_text (GTK_ENTRY (network4), tempstr);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1063 g_free (tempstr);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1064
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1065 tempstr = g_strdup_printf ("%d", hosts->ipv4_netmask >> 24 & 0xff);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1066 gtk_entry_set_text (GTK_ENTRY (netmask1), tempstr);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1067 g_free (tempstr);
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 tempstr = g_strdup_printf ("%d", hosts->ipv4_netmask >> 16 & 0xff);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1070 gtk_entry_set_text (GTK_ENTRY (netmask2), tempstr);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1071 g_free (tempstr);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1072
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1073 tempstr = g_strdup_printf ("%d", hosts->ipv4_netmask >> 8 & 0xff);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1074 gtk_entry_set_text (GTK_ENTRY (netmask3), tempstr);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1075 g_free (tempstr);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1076
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1077 tempstr = g_strdup_printf ("%d", hosts->ipv4_netmask & 0xff);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1078 gtk_entry_set_text (GTK_ENTRY (netmask4), tempstr);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1079 g_free (tempstr);
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 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1082
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1083 #if GTK_MAJOR_VERSION == 1
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1084 tempwid = gtk_button_new_with_label (_("OK"));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1085 GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1086 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
1087 TRUE, TRUE, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1088 gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1089 GTK_SIGNAL_FUNC (add_ok), (gpointer) templist);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1090 gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked",
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1091 GTK_SIGNAL_FUNC (gtk_widget_destroy),
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1092 GTK_OBJECT (dialog));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1093 gtk_widget_show (tempwid);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1094
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1095 tempwid = gtk_button_new_with_label (_(" Cancel "));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1096 GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1097 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
1098 TRUE, TRUE, 0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1099 gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked",
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1100 GTK_SIGNAL_FUNC (gtk_widget_destroy),
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1101 GTK_OBJECT (dialog));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1102 gtk_widget_show (tempwid);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1103 #else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1104 g_signal_connect (GTK_OBJECT (dialog), "response",
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1105 G_CALLBACK (proxyhosts_action), NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1106 #endif
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 gtk_widget_show (dialog);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1109 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1110
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1111 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1112 make_proxy_hosts_tab (GtkWidget * notebook)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1113 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1114 GtkWidget *tempwid, *box, *hbox, *scroll;
218
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1115 gftp_config_list_vars * proxy_hosts;
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1116 char *add_data[2];
218
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1117 GList * templist;
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1118
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1119 add_data[0] = _("Network");
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1120 add_data[1] = _("Netmask");
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1121
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1122 box = gtk_vbox_new (FALSE, 5);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1123 gtk_container_border_width (GTK_CONTAINER (box), 10);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1124 gtk_widget_show (box);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1125
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1126 tempwid = gtk_label_new (_("Local Hosts"));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1127 gtk_widget_show (tempwid);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1128 gtk_notebook_append_page (GTK_NOTEBOOK (notebook), box, tempwid);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1129
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1130 scroll = gtk_scrolled_window_new (NULL, NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1131 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1132 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1133 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
1134
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1135 proxy_list = gtk_clist_new_with_titles (2, add_data);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1136 gtk_container_add (GTK_CONTAINER (scroll), proxy_list);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1137 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
1138 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
1139 gtk_widget_show (proxy_list);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1140 gtk_widget_show (scroll);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1141
218
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1142 gftp_lookup_global_option ("dont_use_proxy", &proxy_hosts);
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1143 new_proxy_hosts = gftp_copy_proxy_hosts (proxy_hosts->list);
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1144
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1145 for (templist = new_proxy_hosts;
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1146 templist != NULL;
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1147 templist = templist->next)
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1148 add_host_to_listbox (templist);
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1149
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1150 hbox = gtk_hbox_new (TRUE, 15);
218
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1151
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1152 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
1153 gtk_widget_show (hbox);
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 (_("Add"));
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 (add_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 tempwid = gtk_button_new_with_label (_("Edit"));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1163 GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1164 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
1165 gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1166 GTK_SIGNAL_FUNC (add_proxy_host), (gpointer) 1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1167 gtk_widget_show (tempwid);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1168
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1169 tempwid = gtk_button_new_with_label (_("Delete"));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1170 GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1171 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
1172 gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1173 GTK_SIGNAL_FUNC (delete_proxy_host), NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1174 gtk_widget_show (tempwid);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1175 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1176
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
1177
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1178 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1179 options_dialog (gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1180 {
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1181 gftp_options_dialog_data option_data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1182 gftp_config_vars * cv;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1183 GList * templist;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1184 int i;
151
2f15b3000dbc 2003-4-27 Brian Masney <masneyb@gftp.org>
masneyb
parents: 139
diff changeset
1185 #if GTK_MAJOR_VERSION == 1
2f15b3000dbc 2003-4-27 Brian Masney <masneyb@gftp.org>
masneyb
parents: 139
diff changeset
1186 GtkWidget * tempwid;
2f15b3000dbc 2003-4-27 Brian Masney <masneyb@gftp.org>
masneyb
parents: 139
diff changeset
1187 #endif
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1188
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1189 memset (&option_data, 0, sizeof (option_data));
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1190 _setup_option (gftp_option_type_text, &option_data,
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
1191 _print_option_type_text, _save_option_type_text, NULL);
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1192 _setup_option (gftp_option_type_textcombo, &option_data,
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
1193 _print_option_type_textcombo, _save_option_type_textcombo,
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
1194 NULL);
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1195 _setup_option (gftp_option_type_textcomboedt, &option_data,
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1196 _print_option_type_textcomboedt,
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
1197 _save_option_type_textcomboedt,
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
1198 _cancel_option_type_textcomboedt);
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1199 _setup_option (gftp_option_type_hidetext, &option_data,
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
1200 _print_option_type_hidetext, _save_option_type_text, NULL);
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1201 _setup_option (gftp_option_type_int, &option_data,
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
1202 _print_option_type_int, _save_option_type_int, NULL);
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1203 _setup_option (gftp_option_type_checkbox, &option_data,
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
1204 _print_option_type_checkbox, _save_option_type_checkbox, NULL);
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1205 _setup_option (gftp_option_type_float, &option_data,
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
1206 _print_option_type_float, _save_option_type_float, NULL);
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1207 _setup_option (gftp_option_type_notebook, &option_data,
139
c363b08e0118 2003-4-21 Brian Masney <masneyb@gftp.org>
masneyb
parents: 136
diff changeset
1208 _print_option_type_notebook, NULL, NULL);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1209
45
311e29c40ed6 2002-10-31 Brian Masney <masneyb@gftp.org>
masneyb
parents: 37
diff changeset
1210 #if GTK_MAJOR_VERSION == 1
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1211 option_data.dialog = gtk_dialog_new ();
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1212 gtk_window_set_title (GTK_WINDOW (option_data.dialog), _("Options"));
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1213 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
1214 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
1215 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
1216 #else
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1217 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
1218 GTK_STOCK_OK,
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
1219 GTK_RESPONSE_OK,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
1220 GTK_STOCK_CANCEL,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
1221 GTK_RESPONSE_CANCEL,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
1222 GTK_STOCK_APPLY,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
1223 GTK_RESPONSE_APPLY,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
1224 NULL);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
1225 #endif
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1226 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
1227 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
1228 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
1229 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
1230 gtk_widget_realize (option_data.dialog);
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
1231
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
1232 if (gftp_icon != NULL)
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
1233 {
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1234 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
1235 gftp_icon->bitmap);
168
c505d9ba9d53 2003-6-6 Brian Masney <masneyb@gftp.org>
masneyb
parents: 151
diff changeset
1236 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
1237 }
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1238
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1239 option_data.notebook = gtk_notebook_new ();
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1240 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
1241 option_data.notebook, TRUE, TRUE, 0);
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1242 gtk_widget_show (option_data.notebook);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1243
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1244 cv = gftp_options_list->data;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1245 option_data.last_option = cv[0].otype;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1246 for (templist = gftp_options_list;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1247 templist != NULL;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1248 templist = templist->next)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1249 {
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1250 cv = templist->data;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1251
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1252 for (i=0; cv[i].key != NULL; i++)
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1253 {
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1254 if (!(cv[i].ports_shown & GFTP_PORT_GTK))
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1255 continue;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1256
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1257 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
1258 continue;
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1259
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1260 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
1261
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1262 option_data.last_option = cv[i].otype;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1263 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1264 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1265
218
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1266 make_proxy_hosts_tab (option_data.notebook);
de6a2e8e51cb 2003-7-9 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
1267
45
311e29c40ed6 2002-10-31 Brian Masney <masneyb@gftp.org>
masneyb
parents: 37
diff changeset
1268 #if GTK_MAJOR_VERSION == 1
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1269 tempwid = gtk_button_new_with_label (_("OK"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1270 GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1271 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
1272 tempwid, TRUE, TRUE, 0);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1273 gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1274 GTK_SIGNAL_FUNC (apply_changes), NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1275 gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1276 GTK_SIGNAL_FUNC (gtk_widget_destroy),
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1277 GTK_OBJECT (option_data.dialog));
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1278 gtk_widget_show (tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1279
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1280 tempwid = gtk_button_new_with_label (_(" Cancel "));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1281 GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1282 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
1283 tempwid, TRUE, TRUE, 0);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1284 gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1285 GTK_SIGNAL_FUNC (clean_old_changes), NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1286 gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1287 GTK_SIGNAL_FUNC (gtk_widget_destroy),
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1288 GTK_OBJECT (option_data.dialog));
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1289 gtk_widget_show (tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1290
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1291 tempwid = gtk_button_new_with_label (_("Apply"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1292 GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1293 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
1294 tempwid, TRUE, TRUE, 0);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1295 gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1296 GTK_SIGNAL_FUNC (apply_changes), NULL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1297 gtk_widget_grab_default (tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1298 gtk_widget_show (tempwid);
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
1299 #else
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1300 g_signal_connect (GTK_OBJECT (option_data.dialog), "response",
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
1301 G_CALLBACK (options_action), NULL);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
1302 #endif
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1303
136
84b3e69807a2 2003-4-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
1304 gtk_widget_show (option_data.dialog);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1305 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1306