annotate src/gtk/options_dialog.c @ 85:1ee3c21c1291

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