Mercurial > pidgin.yaz
annotate src/multi.c @ 1081:efcacae6acdb
[gaim-migrate @ 1091]
libfaim connects non-blocking
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Fri, 10 Nov 2000 22:49:02 +0000 |
parents | 2fe18b2d6105 |
children | ce201056e7a6 |
rev | line source |
---|---|
960 | 1 /* |
2 * gaim | |
3 * | |
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> | |
5 * | |
6 * This program is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program; if not, write to the Free Software | |
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
19 * | |
20 */ | |
21 | |
22 #include <gtk/gtk.h> | |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
23 #include "prpl.h" |
960 | 24 #include "multi.h" |
25 #include "gaim.h" | |
966
f7886476f9d9
[gaim-migrate @ 976]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
26 #include "gnome_applet_mgr.h" |
960 | 27 |
28 #include "pixmaps/gnome_add.xpm" | |
29 #include "pixmaps/gnome_preferences.xpm" | |
30 #include "pixmaps/join.xpm" | |
31 #include "pixmaps/gnome_remove.xpm" | |
32 #include "pixmaps/gnome_close.xpm" | |
33 #include "pixmaps/cancel.xpm" | |
34 #include "pixmaps/ok.xpm" | |
35 | |
36 GSList *connections; | |
37 | |
38 static GtkWidget *acctedit = NULL; | |
39 static GtkWidget *list = NULL; /* the clist of names in the accteditor */ | |
40 static GtkWidget *newmod = NULL; /* the dialog for creating a new account */ | |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
41 static GtkWidget *newmain = NULL; /* the frame that holds the possible notebook for options */ |
960 | 42 static struct aim_user tmpusr; |
43 | |
44 struct mod_usr_opt { | |
45 struct aim_user *user; | |
46 int opt; | |
47 }; | |
48 | |
49 struct gaim_connection *new_gaim_conn(int proto, char *username, char *password) | |
50 { | |
51 struct gaim_connection *gc = g_new0(struct gaim_connection, 1); | |
52 gc->protocol = proto; | |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
53 gc->prpl = find_prpl(proto); |
960 | 54 g_snprintf(gc->username, sizeof(gc->username), "%s", username); |
55 g_snprintf(gc->password, sizeof(gc->password), "%s", password); | |
56 gc->keepalive = -1; | |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
993
diff
changeset
|
57 gc->inpa = -1; |
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
993
diff
changeset
|
58 gc->buddy_chats = NULL; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
59 gc->groups = NULL; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
60 gc->permit = NULL; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
61 gc->deny = NULL; |
960 | 62 |
63 connections = g_slist_append(connections, gc); | |
64 | |
65 return gc; | |
66 } | |
67 | |
68 void destroy_gaim_conn(struct gaim_connection *gc) | |
69 { | |
1063
e1408fb04c36
[gaim-migrate @ 1073]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1058
diff
changeset
|
70 GSList *g = gc->groups; |
e1408fb04c36
[gaim-migrate @ 1073]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1058
diff
changeset
|
71 GSList *h; |
e1408fb04c36
[gaim-migrate @ 1073]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1058
diff
changeset
|
72 struct group *m; |
e1408fb04c36
[gaim-migrate @ 1073]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1058
diff
changeset
|
73 struct buddy *n; |
960 | 74 connections = g_slist_remove(connections, gc); |
1063
e1408fb04c36
[gaim-migrate @ 1073]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1058
diff
changeset
|
75 while (g) { |
e1408fb04c36
[gaim-migrate @ 1073]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1058
diff
changeset
|
76 m = (struct group *)g->data; |
e1408fb04c36
[gaim-migrate @ 1073]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1058
diff
changeset
|
77 g = g_slist_remove(g, m); |
e1408fb04c36
[gaim-migrate @ 1073]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1058
diff
changeset
|
78 h = m->members; |
e1408fb04c36
[gaim-migrate @ 1073]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1058
diff
changeset
|
79 while (h) { |
e1408fb04c36
[gaim-migrate @ 1073]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1058
diff
changeset
|
80 n = (struct buddy *)h->data; |
e1408fb04c36
[gaim-migrate @ 1073]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1058
diff
changeset
|
81 h = g_slist_remove(h, n); |
e1408fb04c36
[gaim-migrate @ 1073]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1058
diff
changeset
|
82 g_free(n); |
e1408fb04c36
[gaim-migrate @ 1073]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1058
diff
changeset
|
83 } |
e1408fb04c36
[gaim-migrate @ 1073]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1058
diff
changeset
|
84 g_free(m); |
e1408fb04c36
[gaim-migrate @ 1073]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1058
diff
changeset
|
85 } |
960 | 86 g_free(gc); |
87 redo_convo_menus(); | |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
88 if (!connections && mainwindow) |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
89 gtk_widget_show(mainwindow); |
960 | 90 } |
91 | |
92 struct gaim_connection *find_gaim_conn_by_name(char *name) { | |
93 char *who = g_strdup(normalize(name)); | |
94 GSList *c = connections; | |
95 struct gaim_connection *g = NULL; | |
96 | |
97 while (c) { | |
98 g = (struct gaim_connection *)c->data; | |
99 if (!strcmp(normalize(g->username), who)) { | |
100 g_free(who); | |
101 return g; | |
102 } | |
103 c = c->next; | |
104 } | |
105 | |
106 g_free(who); | |
107 return NULL; | |
108 } | |
109 | |
110 static void delete_acctedit(GtkWidget *w, gpointer d) | |
111 { | |
112 if (acctedit) { | |
113 save_prefs(); | |
114 gtk_widget_destroy(acctedit); | |
115 } | |
116 acctedit = NULL; | |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1005
diff
changeset
|
117 if (d == NULL && blist == NULL) |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1005
diff
changeset
|
118 exit(0); |
960 | 119 } |
120 | |
121 static gint acctedit_close(GtkWidget *w, gpointer d) | |
122 { | |
123 gtk_widget_destroy(acctedit); | |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1005
diff
changeset
|
124 if (d == NULL && blist == NULL) |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1005
diff
changeset
|
125 exit(0); |
960 | 126 return FALSE; |
127 } | |
128 | |
129 static char *proto_name(int proto) | |
130 { | |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
131 struct prpl *p = find_prpl(proto); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
132 if (p && p->name) |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
133 return (*p->name)(); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
134 else |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
135 return "Unknown"; |
960 | 136 } |
137 | |
138 static GtkWidget *generate_list() | |
139 { | |
140 GtkWidget *win; | |
141 char *titles[4] = {"Screenname", "Currently Online", "Auto-login", "Protocol"}; | |
142 GList *u = aim_users; | |
143 struct aim_user *a; | |
144 int i; | |
145 | |
146 win = gtk_scrolled_window_new(0, 0); | |
147 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(win), GTK_POLICY_AUTOMATIC, | |
148 GTK_POLICY_ALWAYS); | |
149 | |
150 list = gtk_clist_new_with_titles(4, titles); | |
151 gtk_clist_set_column_width(GTK_CLIST(list), 0, 90); | |
152 gtk_clist_set_selection_mode(GTK_CLIST(list), GTK_SELECTION_BROWSE); | |
153 gtk_clist_column_titles_passive(GTK_CLIST(list)); | |
154 gtk_container_add(GTK_CONTAINER(win), list); | |
155 gtk_widget_show(list); | |
156 | |
157 while (u) { | |
158 a = (struct aim_user *)u->data; | |
159 titles[0] = a->username; | |
1074
2cff18c2f9c6
[gaim-migrate @ 1084]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1063
diff
changeset
|
160 titles[1] = a->gc ? "Yes" : "No"; |
960 | 161 titles[2] = (a->options & OPT_USR_AUTO) ? "True" : "False"; |
162 titles[3] = proto_name(a->protocol); | |
163 i = gtk_clist_append(GTK_CLIST(list), titles); | |
164 gtk_clist_set_row_data(GTK_CLIST(list), i, a); | |
165 u = u->next; | |
166 } | |
167 | |
168 gtk_widget_show(win); | |
169 return win; | |
170 } | |
171 | |
172 static void delmod(GtkWidget *w, struct aim_user *u) | |
173 { | |
174 gtk_widget_destroy(w); | |
175 if (u) { | |
176 u->mod = NULL; | |
177 } else { | |
178 newmod = NULL; | |
179 } | |
180 } | |
181 | |
182 static void mod_opt(GtkWidget *b, struct mod_usr_opt *m) | |
183 { | |
184 if (m->user) { | |
185 m->user->tmp_options = m->user->tmp_options ^ m->opt; | |
186 } else { | |
187 tmpusr.options = tmpusr.options ^ m->opt; | |
188 } | |
189 } | |
190 | |
1051
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
191 static void free_muo(GtkWidget *b, struct mod_usr_opt *m) { |
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
192 g_free(m); |
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
193 } |
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
194 |
960 | 195 static GtkWidget *acct_button(const char *text, struct aim_user *u, int option, GtkWidget *box) |
196 { | |
197 GtkWidget *button; | |
198 struct mod_usr_opt *muo = g_new0(struct mod_usr_opt, 1); | |
199 button = gtk_check_button_new_with_label(text); | |
200 if (u) { | |
201 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), (u->options & option)); | |
202 } else { | |
203 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), (tmpusr.options & option)); | |
204 } | |
205 gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 0); | |
206 muo->user = u; muo->opt = option; | |
207 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(mod_opt), muo); | |
1051
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
208 gtk_signal_connect(GTK_OBJECT(button), "destroy", GTK_SIGNAL_FUNC(free_muo), muo); |
960 | 209 gtk_widget_show(button); |
210 return button; | |
211 } | |
212 | |
213 static void ok_mod(GtkWidget *w, struct aim_user *u) | |
214 { | |
215 char *txt; | |
216 int i; | |
217 if (u) { | |
218 u->options = u->tmp_options; | |
219 u->protocol = u->tmp_protocol; | |
220 txt = gtk_entry_get_text(GTK_ENTRY(u->pass)); | |
221 if (u->options & OPT_USR_REM_PASS) | |
222 g_snprintf(u->password, sizeof(u->password), "%s", txt); | |
223 else | |
224 u->password[0] = '\0'; | |
225 gtk_widget_destroy(u->mod); | |
226 i = gtk_clist_find_row_from_data(GTK_CLIST(list), u); | |
227 gtk_clist_set_text(GTK_CLIST(list), i, 2, (u->options & OPT_USR_AUTO) ? "True" : "False"); | |
228 gtk_clist_set_text(GTK_CLIST(list), i, 3, proto_name(u->protocol)); | |
229 } else { | |
230 char *titles[4]; | |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
231 int i; |
960 | 232 txt = gtk_entry_get_text(GTK_ENTRY(tmpusr.name)); |
233 u = g_new0(struct aim_user, 1); | |
234 g_snprintf(u->username, sizeof(u->username), "%s", txt); | |
235 txt = gtk_entry_get_text(GTK_ENTRY(tmpusr.pass)); | |
236 g_snprintf(u->password, sizeof(u->password), "%s", txt); | |
237 u->options = tmpusr.options; | |
238 u->protocol = tmpusr.protocol; | |
239 gtk_widget_destroy(newmod); | |
240 titles[0] = u->username; | |
1074
2cff18c2f9c6
[gaim-migrate @ 1084]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1063
diff
changeset
|
241 titles[1] = u->gc ? "Yes" : "No"; |
960 | 242 titles[2] = (u->options & OPT_USR_AUTO) ? "True" : "False"; |
243 titles[3] = proto_name(u->protocol); | |
244 i = gtk_clist_append(GTK_CLIST(list), titles); | |
245 gtk_clist_set_row_data(GTK_CLIST(list), i, u); | |
984
7ec6b092f227
[gaim-migrate @ 994]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
982
diff
changeset
|
246 aim_users = g_list_append(aim_users, u); |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
247 for (i = 0; i < 6; i++) |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
248 g_snprintf(u->proto_opt[i], sizeof(u->proto_opt[i]), "%s", tmpusr.proto_opt[i]); |
960 | 249 } |
250 save_prefs(); | |
251 } | |
252 | |
253 static void cancel_mod(GtkWidget *w, struct aim_user *u) | |
254 { | |
255 if (u) { | |
256 gtk_widget_destroy(u->mod); | |
257 } else { | |
258 gtk_widget_destroy(newmod); | |
259 } | |
260 } | |
261 | |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
262 static void generate_options(struct aim_user *, GtkWidget *); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
263 |
960 | 264 static void set_prot(GtkWidget *opt, int proto) |
265 { | |
266 struct aim_user *u = gtk_object_get_user_data(GTK_OBJECT(opt)); | |
267 if (u) { | |
268 u->tmp_protocol = proto; | |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
269 generate_options(u, u->main); |
960 | 270 } else { |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
271 tmpusr.tmp_protocol = tmpusr.protocol = proto; |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
272 generate_options(NULL, newmain); |
960 | 273 } |
274 } | |
275 | |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
276 static GtkWidget *make_protocol_menu(GtkWidget *box, struct aim_user *u, GtkWidget *frame) |
960 | 277 { |
278 GtkWidget *optmenu; | |
279 GtkWidget *menu; | |
280 GtkWidget *opt; | |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
281 GSList *p = protocols; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
282 struct prpl *e; |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
283 int count = 0; |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
284 gboolean found = FALSE; |
960 | 285 |
286 optmenu = gtk_option_menu_new(); | |
287 gtk_box_pack_start(GTK_BOX(box), optmenu, FALSE, FALSE, 5); | |
288 gtk_widget_show(optmenu); | |
289 | |
290 menu = gtk_menu_new(); | |
291 | |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
292 while (p) { |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
293 e = (struct prpl *)p->data; |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
294 if (u) { |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
295 if (e->protocol == u->tmp_protocol) |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
296 found = TRUE; |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
297 if (!found) |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
298 count++; |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
299 } else { |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
300 if (e->protocol == tmpusr.tmp_protocol) |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
301 found = TRUE; |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
302 if (!found) |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
303 count++; |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
304 } |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
305 if (e->name) |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
306 opt = gtk_menu_item_new_with_label((*e->name)()); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
307 else |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
308 opt = gtk_menu_item_new_with_label("Unknown"); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
309 gtk_object_set_user_data(GTK_OBJECT(opt), u); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
310 gtk_signal_connect(GTK_OBJECT(opt), "activate", |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
311 GTK_SIGNAL_FUNC(set_prot), (void *)e->protocol); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
312 gtk_menu_append(GTK_MENU(menu), opt); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
313 gtk_widget_show(opt); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
314 p = p->next; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
315 } |
960 | 316 |
317 gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu); | |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
318 gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), count); |
960 | 319 |
320 return optmenu; | |
321 } | |
322 | |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
323 static void generate_options(struct aim_user *u, GtkWidget *frame) { |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
324 GList *tmp; |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
325 GtkWidget *book; |
960 | 326 GtkWidget *vbox; |
327 GtkWidget *hbox; | |
328 GtkWidget *label; | |
329 GtkWidget *name; | |
330 GtkWidget *pass; | |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
331 struct prpl *p; |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
332 |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
333 tmp = gtk_container_children(GTK_CONTAINER(frame)); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
334 |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
335 if (u) |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
336 p = find_prpl(u->tmp_protocol); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
337 else |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
338 p = find_prpl(tmpusr.protocol); |
960 | 339 |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
340 if (p && p->user_opts) { |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
341 if (tmp && !GTK_IS_NOTEBOOK(tmp->data)) { |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
342 gtk_widget_destroy(tmp->data); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
343 tmp = NULL; |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
344 } |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
345 |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
346 if (!tmp) { |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
347 book = gtk_notebook_new(); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
348 gtk_container_add(GTK_CONTAINER(frame), book); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
349 gtk_widget_show(book); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
350 |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
351 vbox = gtk_vbox_new(FALSE, 0); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
352 gtk_notebook_append_page(GTK_NOTEBOOK(book), vbox, |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
353 gtk_label_new(_("General Options"))); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
354 gtk_widget_show(vbox); |
960 | 355 |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
356 if (u) |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
357 (*p->user_opts)(book, u); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
358 else |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
359 (*p->user_opts)(book, &tmpusr); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
360 } else { |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
361 book = (GtkWidget *)tmp->data; |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
362 gtk_notebook_remove_page(GTK_NOTEBOOK(book), 1); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
363 if (u) |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
364 (*p->user_opts)(book, u); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
365 else |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
366 (*p->user_opts)(book, &tmpusr); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
367 return; |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
368 } |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
369 } else { |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
370 if (tmp && GTK_IS_NOTEBOOK(tmp->data)) { |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
371 gtk_widget_destroy(tmp->data); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
372 tmp = NULL; |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
373 } |
960 | 374 |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
375 if (!tmp) { |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
376 vbox = gtk_vbox_new(FALSE, 0); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
377 gtk_container_add(GTK_CONTAINER(frame), vbox); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
378 gtk_widget_show(vbox); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
379 } else { |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
380 return; |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
381 } |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
382 } |
960 | 383 |
384 hbox = gtk_hbox_new(FALSE, 0); | |
385 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
386 gtk_widget_show(hbox); | |
387 | |
388 label = gtk_label_new(_("Screenname:")); | |
389 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
390 gtk_widget_show(label); | |
391 | |
392 name = gtk_entry_new(); | |
393 gtk_box_pack_start(GTK_BOX(hbox), name, FALSE, FALSE, 5); | |
394 gtk_widget_show(name); | |
395 | |
396 hbox = gtk_hbox_new(FALSE, 5); | |
397 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
398 gtk_widget_show(hbox); | |
399 | |
400 label = gtk_label_new(_("Password:")); | |
401 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
402 gtk_widget_show(label); | |
403 | |
404 pass = gtk_entry_new(); | |
405 gtk_box_pack_start(GTK_BOX(hbox), pass, FALSE, FALSE, 5); | |
406 gtk_entry_set_visibility(GTK_ENTRY(pass), FALSE); | |
407 gtk_widget_show(pass); | |
408 | |
409 hbox = gtk_hbox_new(FALSE, 5); | |
410 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
411 gtk_widget_show(hbox); | |
412 | |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
413 make_protocol_menu(hbox, u, frame); |
960 | 414 |
415 acct_button(_("Remember Password"), u, OPT_USR_REM_PASS, vbox); | |
416 acct_button(_("Auto-Login"), u, OPT_USR_AUTO, vbox); | |
417 acct_button(_("Send KeepAlive packet (6 bytes/second)"), u, OPT_USR_KEEPALV, vbox); | |
418 | |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
419 if (u) { |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
420 u->name = name; |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
421 u->pass = pass; |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
422 gtk_entry_set_text(GTK_ENTRY(name), u->username); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
423 gtk_entry_set_text(GTK_ENTRY(pass), u->password); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
424 gtk_entry_set_editable(GTK_ENTRY(name), FALSE); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
425 } else { |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
426 tmpusr.name = name; |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
427 tmpusr.pass = pass; |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
428 } |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
429 } |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
430 |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
431 static void show_acct_mod(struct aim_user *u) |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
432 { |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
433 /* here we can have all the aim_user options, including ones not shown in the main acctedit |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
434 * window. this can keep the size of the acctedit window small and readable, and make this |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
435 * one the powerful editor. this is where things like name/password are edited, but can |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
436 * also have toggles (and even more complex options) like whether to autologin or whether |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
437 * to send keepalives or whatever. this would be the perfect place to specify which protocol |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
438 * to use. make sure to account for the possibility of protocol plugins. */ |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
439 GtkWidget *mod; |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
440 GtkWidget *box; |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
441 GtkWidget *frame; |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
442 GtkWidget *hbox; |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
443 GtkWidget *button; |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
444 |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
445 if (!u && newmod) { |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
446 gtk_widget_show(newmod); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
447 return; |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
448 } |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
449 if (u && u->mod) { |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
450 gtk_widget_show(u->mod); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
451 return; |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
452 } |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
453 |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
454 mod = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
455 gtk_window_set_wmclass(GTK_WINDOW(mod), "account", "Gaim"); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
456 gtk_widget_realize(mod); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
457 aol_icon(mod->window); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
458 gtk_container_border_width(GTK_CONTAINER(mod), 10); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
459 gtk_window_set_title(GTK_WINDOW(mod), _("Gaim - Modify Account")); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
460 gtk_window_set_policy(GTK_WINDOW(mod), 0, 1, 1); /* i know, i'm odd */ |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
461 gtk_signal_connect(GTK_OBJECT(mod), "destroy", |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
462 GTK_SIGNAL_FUNC(delmod), u); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
463 |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
464 box = gtk_vbox_new(FALSE, 0); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
465 gtk_container_add(GTK_CONTAINER(mod), box); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
466 gtk_widget_show(box); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
467 |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
468 frame = gtk_frame_new(_("Modify Account")); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
469 gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 5); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
470 gtk_widget_show(frame); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
471 |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
472 if (u) u->tmp_protocol = u->protocol; |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
473 else tmpusr.tmp_protocol = tmpusr.protocol; |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
474 generate_options(u, frame); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
475 |
960 | 476 hbox = gtk_hbox_new(FALSE, 5); |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
477 gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 5); |
960 | 478 gtk_widget_show(hbox); |
479 | |
480 button = picture_button(mod, _("Cancel"), cancel_xpm); | |
481 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5); | |
482 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(cancel_mod), u); | |
483 gtk_widget_show(button); | |
484 | |
485 button = picture_button(mod, _("OK"), ok_xpm); | |
486 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5); | |
487 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(ok_mod), u); | |
488 gtk_widget_show(button); | |
489 | |
490 if (u) { | |
491 u->mod = mod; | |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
492 u->main = frame; /* ha, get it? :) */ |
960 | 493 u->tmp_options = u->options; |
494 } else { | |
495 newmod = mod; | |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
496 newmain = frame; |
960 | 497 } |
498 | |
499 gtk_widget_show(mod); | |
500 } | |
501 | |
502 static void add_acct(GtkWidget *w, gpointer d) | |
503 { | |
504 show_acct_mod(NULL); | |
505 } | |
506 | |
507 static void mod_acct(GtkWidget *w, gpointer d) | |
508 { | |
509 int row = -1; | |
510 struct aim_user *u; | |
511 if (GTK_CLIST(list)->selection) | |
512 row = (int)GTK_CLIST(list)->selection->data; | |
513 if (row != -1) { | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
514 u = g_list_nth_data(aim_users, row); |
960 | 515 if (u) |
516 show_acct_mod(u); | |
517 } | |
518 } | |
519 | |
520 static void pass_des(GtkWidget *w, struct aim_user *u) | |
521 { | |
522 gtk_widget_destroy(w); | |
523 u->passprmt = NULL; | |
524 } | |
525 | |
526 static void pass_cancel(GtkWidget *w, struct aim_user *u) | |
527 { | |
528 gtk_widget_destroy(u->passprmt); | |
529 u->passprmt = NULL; | |
530 } | |
531 | |
532 static void pass_signon(GtkWidget *w, struct aim_user *u) | |
533 { | |
534 char *txt = gtk_entry_get_text(GTK_ENTRY(u->passentry)); | |
980
82c5865f7cfe
[gaim-migrate @ 990]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
977
diff
changeset
|
535 g_snprintf(u->password, sizeof(u->password), "%s", txt); |
960 | 536 #ifdef USE_APPLET |
537 set_user_state(signing_on); | |
538 #endif | |
539 gtk_widget_destroy(u->passprmt); | |
540 u->passprmt = NULL; | |
980
82c5865f7cfe
[gaim-migrate @ 990]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
977
diff
changeset
|
541 serv_login(u); |
960 | 542 } |
543 | |
544 static void do_pass_dlg(struct aim_user *u) | |
545 { | |
546 /* we can safely assume that u is not NULL */ | |
547 GtkWidget *frame; | |
548 GtkWidget *vbox; | |
549 GtkWidget *hbox; | |
550 char buf[96]; | |
551 GtkWidget *label; | |
552 GtkWidget *button; | |
553 | |
554 if (u->passprmt) { gtk_widget_show(u->passprmt); return; } | |
555 u->passprmt = gtk_window_new(GTK_WINDOW_DIALOG); | |
556 gtk_window_set_wmclass(GTK_WINDOW(u->passprmt), "password", "Gaim"); | |
557 gtk_container_border_width(GTK_CONTAINER(u->passprmt), 5); | |
558 gtk_signal_connect(GTK_OBJECT(u->passprmt), "destroy", GTK_SIGNAL_FUNC(pass_des), u); | |
559 gtk_widget_realize(u->passprmt); | |
560 aol_icon(u->passprmt->window); | |
561 | |
562 frame = gtk_frame_new(_("Enter Password")); | |
563 gtk_container_add(GTK_CONTAINER(u->passprmt), frame); | |
564 gtk_widget_show(frame); | |
565 | |
566 vbox = gtk_vbox_new(FALSE, 5); | |
567 gtk_container_add(GTK_CONTAINER(frame), vbox); | |
568 gtk_widget_show(vbox); | |
569 | |
570 hbox = gtk_hbox_new(FALSE, 5); | |
571 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
572 gtk_widget_show(hbox); | |
573 | |
574 g_snprintf(buf, sizeof(buf), "Password for %s:", u->username); | |
575 label = gtk_label_new(buf); | |
576 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
577 gtk_widget_show(label); | |
578 | |
579 u->passentry = gtk_entry_new(); | |
580 gtk_entry_set_visibility(GTK_ENTRY(u->passentry), FALSE); | |
581 gtk_box_pack_start(GTK_BOX(hbox), u->passentry, FALSE, FALSE, 5); | |
582 gtk_signal_connect(GTK_OBJECT(u->passentry), "activate", GTK_SIGNAL_FUNC(pass_signon), u); | |
583 gtk_widget_grab_focus(u->passentry); | |
584 gtk_widget_show(u->passentry); | |
585 | |
586 hbox = gtk_hbox_new(FALSE, 5); | |
587 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
588 gtk_widget_show(hbox); | |
589 | |
590 button = picture_button(u->passprmt, _("Cancel"), cancel_xpm); | |
591 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(pass_cancel), u); | |
592 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5); | |
593 | |
594 button = picture_button(u->passprmt, _("Signon"), ok_xpm); | |
595 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(pass_signon), u); | |
596 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5); | |
597 | |
598 gtk_widget_show(u->passprmt); | |
599 } | |
600 | |
601 static void acct_signin(GtkWidget *w, gpointer d) | |
602 { | |
603 int row = -1; | |
604 struct aim_user *u; | |
605 if (GTK_CLIST(list)->selection) | |
606 row = (int)GTK_CLIST(list)->selection->data; | |
607 if (row != -1) { | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
608 u = g_list_nth_data(aim_users, row); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
609 if (!u->gc) { |
960 | 610 if (!u->password[0]) { |
611 do_pass_dlg(u); | |
612 } else { | |
613 #ifdef USE_APPLET | |
614 set_user_state(signing_on); | |
615 #endif /* USE_APPLET */ | |
980
82c5865f7cfe
[gaim-migrate @ 990]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
977
diff
changeset
|
616 serv_login(u); |
960 | 617 } |
618 } else { | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
619 signoff(u->gc); |
960 | 620 } |
621 } | |
622 } | |
623 | |
624 static void del_acct(GtkWidget *w, gpointer d) | |
625 { | |
626 int row = -1; | |
627 struct aim_user *u; | |
628 if (GTK_CLIST(list)->selection) | |
629 row = (int)GTK_CLIST(list)->selection->data; | |
630 if (row != -1) { | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
631 u = g_list_nth_data(aim_users, row); |
960 | 632 if (u) { |
1058
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
633 if (u->gc) |
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
634 signoff(u->gc); |
960 | 635 aim_users = g_list_remove(aim_users, u); |
636 save_prefs(); | |
637 } | |
638 gtk_clist_remove(GTK_CLIST(list), row); | |
639 } | |
640 } | |
641 | |
642 void account_editor(GtkWidget *w, GtkWidget *W) | |
643 { | |
644 /* please kill me */ | |
645 GtkWidget *frame; | |
646 GtkWidget *box; | |
647 GtkWidget *list; | |
648 GtkWidget *hbox; | |
649 GtkWidget *button; /* used for many things */ | |
650 | |
651 if (acctedit) { gtk_widget_show(acctedit); return; } | |
652 | |
653 acctedit = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
654 gtk_window_set_title(GTK_WINDOW(acctedit), _("Gaim - Account Editor")); | |
655 gtk_window_set_wmclass(GTK_WINDOW(acctedit), "accounteditor", "Gaim"); | |
656 gtk_widget_realize(acctedit); | |
657 aol_icon(acctedit->window); | |
658 gtk_container_border_width(GTK_CONTAINER(acctedit), 10); | |
659 gtk_widget_set_usize(acctedit, -1, 200); | |
660 gtk_signal_connect(GTK_OBJECT(acctedit), "destroy", | |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1005
diff
changeset
|
661 GTK_SIGNAL_FUNC(delete_acctedit), W); |
960 | 662 |
663 frame = gtk_frame_new(_("Account Editor")); | |
664 gtk_container_add(GTK_CONTAINER(acctedit), frame); | |
665 gtk_widget_show(frame); | |
666 | |
667 box = gtk_vbox_new(FALSE, 5); | |
668 gtk_container_add(GTK_CONTAINER(frame), box); | |
669 gtk_widget_show(box); | |
670 | |
671 list = generate_list(); | |
672 gtk_box_pack_start(GTK_BOX(box), list, TRUE, TRUE, 5); | |
673 | |
674 hbox = gtk_hbox_new(TRUE, 5); | |
675 gtk_box_pack_end(GTK_BOX(box), hbox, FALSE, FALSE, 5); | |
676 gtk_widget_show(hbox); | |
677 | |
678 button = picture_button(acctedit, _("Add"), gnome_add_xpm); | |
679 gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 5); | |
680 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(add_acct), NULL); | |
681 | |
682 button = picture_button(acctedit, _("Modify"), gnome_preferences_xpm); | |
683 gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 5); | |
684 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(mod_acct), NULL); | |
685 | |
686 button = picture_button(acctedit, _("Sign On/Off"), join_xpm); | |
687 gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 5); | |
688 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(acct_signin), NULL); | |
689 | |
690 button = picture_button(acctedit, _("Delete"), gnome_remove_xpm); | |
691 gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 5); | |
692 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(del_acct), NULL); | |
693 | |
694 button = picture_button(acctedit, _("Close"), gnome_close_xpm); | |
695 gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 5); | |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1005
diff
changeset
|
696 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(acctedit_close), W); |
960 | 697 |
698 gtk_widget_show(acctedit); | |
699 } | |
700 | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
701 void account_online(struct aim_user *u, struct gaim_connection *gc) |
960 | 702 { |
703 int i; | |
1002
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
704 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
705 gc->user = u; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
706 u->gc = gc; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
707 |
1002
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
708 /* first we hide the login progress meter */ |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
709 if (gc->meter) |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
710 gtk_widget_destroy(gc->meter); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
711 gc->meter = NULL; |
1002
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
712 |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
713 /* then we do the buddy list stuff */ |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
714 if (mainwindow) |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
715 gtk_widget_hide(mainwindow); |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
716 show_buddy_list(); |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
717 |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
718 #ifdef USE_APPLET |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
719 if (general_options & OPT_GEN_APP_BUDDY_SHOW) { |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
720 refresh_buddy_window(); |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
721 createOnlinePopup(); |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
722 applet_buddy_show = TRUE; |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
723 } else { |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
724 gtk_widget_hide(blist); |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
725 applet_buddy_show = FALSE; |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
726 } |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
727 set_user_state(online); |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
728 #else |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
729 refresh_buddy_window(); |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
730 #endif |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
731 setup_buddy_chats(); |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
732 |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
733 redo_convo_menus(); |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
734 gaim_setup(gc); |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
735 |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
736 plugin_event(event_signon, gc, 0, 0, 0); |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
737 |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
738 /* everything for the account editor */ |
960 | 739 if (!acctedit) return; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
740 i = gtk_clist_find_row_from_data(GTK_CLIST(list), gc->user); |
977
e5eac6b236f1
[gaim-migrate @ 987]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
969
diff
changeset
|
741 gtk_clist_set_text(GTK_CLIST(list), i, 1, "Yes"); |
960 | 742 gtk_clist_set_text(GTK_CLIST(list), i, 3, proto_name(gc->protocol)); |
1002
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
743 |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
744 return; |
960 | 745 } |
746 | |
747 void account_offline(struct gaim_connection *gc) | |
748 { | |
749 int i; | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
750 gc->user->gc = NULL; /* wasn't that awkward? */ |
960 | 751 if (!acctedit) return; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
752 i = gtk_clist_find_row_from_data(GTK_CLIST(list), gc->user); |
977
e5eac6b236f1
[gaim-migrate @ 987]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
969
diff
changeset
|
753 gtk_clist_set_text(GTK_CLIST(list), i, 1, "No"); |
993
eacd93d0089a
[gaim-migrate @ 1003]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
754 redo_convo_menus(); |
960 | 755 } |
756 | |
757 void auto_login() | |
758 { | |
759 GList *u = aim_users; | |
760 struct aim_user *a = NULL; | |
761 | |
762 while (u) { | |
763 a = (struct aim_user *)u->data; | |
764 if ((a->options & OPT_USR_AUTO) && (a->options & OPT_USR_REM_PASS)) { | |
765 #ifdef USE_APPLET | |
766 set_user_state(signing_on); | |
767 #endif /* USE_APPLET */ | |
980
82c5865f7cfe
[gaim-migrate @ 990]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
977
diff
changeset
|
768 serv_login(a); |
960 | 769 } |
770 u = u->next; | |
771 } | |
772 } | |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
773 |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
774 static void meter_destroy(GtkWidget *meter, struct gaim_connection *gc) { |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
775 gtk_widget_destroy(meter); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
776 gc->meter = NULL; |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
777 } |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
778 |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
779 void set_login_progress(struct gaim_connection *gc, float howfar, char *message) { |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
780 if (mainwindow) |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
781 gtk_widget_hide(mainwindow); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
782 |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
783 if (!gc->meter) { |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
784 GtkWidget *box, *label; |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
785 char buf[256]; |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
786 |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
787 gc->meter = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
788 gtk_window_set_policy(GTK_WINDOW(gc->meter), 0, 0, 1); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
789 gtk_window_set_wmclass(GTK_WINDOW(gc->meter), "signon", "Gaim"); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
790 gtk_container_set_border_width(GTK_CONTAINER(gc->meter), 5); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
791 g_snprintf(buf, sizeof(buf), "%s Signing On", gc->username); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
792 gtk_window_set_title(GTK_WINDOW(gc->meter), buf); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
793 gtk_signal_connect(GTK_OBJECT(gc->meter), "destroy", |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
794 GTK_SIGNAL_FUNC(meter_destroy), gc); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
795 gtk_widget_realize(gc->meter); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
796 aol_icon(gc->meter->window); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
797 |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
798 box = gtk_vbox_new(FALSE, 5); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
799 gtk_container_add(GTK_CONTAINER(gc->meter), box); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
800 gtk_widget_show(box); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
801 |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
802 label = gtk_label_new(buf); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
803 gtk_box_pack_start(GTK_BOX(box), label, 0, 0, 5); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
804 gtk_widget_show(label); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
805 |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
806 gc->progress = gtk_progress_bar_new(); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
807 gtk_widget_set_usize(gc->progress, 150, 0); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
808 gtk_box_pack_start(GTK_BOX(box), gc->progress, 0, 0, 5); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
809 gtk_widget_show(gc->progress); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
810 |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
811 gc->status = gtk_statusbar_new(); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
812 gtk_widget_set_usize(gc->status, 150, 0); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
813 gtk_box_pack_start(GTK_BOX(box), gc->status, 0, 0, 5); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
814 gtk_widget_show(gc->status); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
815 |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
816 gtk_widget_show(gc->meter); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
817 } |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
818 |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
819 gtk_progress_bar_update(GTK_PROGRESS_BAR(gc->progress), howfar / 5); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
820 gtk_statusbar_pop(GTK_STATUSBAR(gc->status), 1); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
821 gtk_statusbar_push(GTK_STATUSBAR(gc->status), 1, message); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
822 } |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
823 |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
824 void hide_login_progress(struct gaim_connection *gc, char *why) |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
825 { |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
826 char buf[2048]; |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
827 sprintf(buf, _("%s was unable to sign on: %s"), gc->username, why); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
828 do_error_dialog(buf, _("Signon Error")); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
829 if (gc->meter) |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
830 gtk_widget_destroy(gc->meter); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
831 gc->meter = NULL; |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
832 } |