Mercurial > pidgin.yaz
annotate src/multi.c @ 1057:d50d3abb9eb7
[gaim-migrate @ 1067]
attempting to pass -Wall (at least for app)
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Fri, 03 Nov 2000 10:46:58 +0000 |
parents | bde34730789c |
children | 4927ce25d8cc |
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 */ | |
41 static struct aim_user tmpusr; | |
42 | |
43 struct mod_usr_opt { | |
44 struct aim_user *user; | |
45 int opt; | |
46 }; | |
47 | |
48 struct gaim_connection *new_gaim_conn(int proto, char *username, char *password) | |
49 { | |
50 struct gaim_connection *gc = g_new0(struct gaim_connection, 1); | |
51 gc->protocol = proto; | |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
52 gc->prpl = find_prpl(proto); |
960 | 53 g_snprintf(gc->username, sizeof(gc->username), "%s", username); |
54 g_snprintf(gc->password, sizeof(gc->password), "%s", password); | |
55 gc->keepalive = -1; | |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
993
diff
changeset
|
56 gc->inpa = -1; |
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
993
diff
changeset
|
57 gc->buddy_chats = NULL; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
58 gc->groups = NULL; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
59 gc->permit = NULL; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
60 gc->deny = NULL; |
960 | 61 |
62 connections = g_slist_append(connections, gc); | |
63 | |
64 return gc; | |
65 } | |
66 | |
67 void destroy_gaim_conn(struct gaim_connection *gc) | |
68 { | |
69 connections = g_slist_remove(connections, gc); | |
70 g_free(gc); | |
71 redo_convo_menus(); | |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
72 if (!connections && mainwindow) |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
73 gtk_widget_show(mainwindow); |
960 | 74 } |
75 | |
76 struct gaim_connection *find_gaim_conn_by_name(char *name) { | |
77 char *who = g_strdup(normalize(name)); | |
78 GSList *c = connections; | |
79 struct gaim_connection *g = NULL; | |
80 | |
81 while (c) { | |
82 g = (struct gaim_connection *)c->data; | |
83 if (!strcmp(normalize(g->username), who)) { | |
84 g_free(who); | |
85 return g; | |
86 } | |
87 c = c->next; | |
88 } | |
89 | |
90 g_free(who); | |
91 return NULL; | |
92 } | |
93 | |
94 static void delete_acctedit(GtkWidget *w, gpointer d) | |
95 { | |
96 if (acctedit) { | |
97 save_prefs(); | |
98 gtk_widget_destroy(acctedit); | |
99 } | |
100 acctedit = NULL; | |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1005
diff
changeset
|
101 if (d == NULL && blist == NULL) |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1005
diff
changeset
|
102 exit(0); |
960 | 103 } |
104 | |
105 static gint acctedit_close(GtkWidget *w, gpointer d) | |
106 { | |
107 gtk_widget_destroy(acctedit); | |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1005
diff
changeset
|
108 if (d == NULL && blist == NULL) |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1005
diff
changeset
|
109 exit(0); |
960 | 110 return FALSE; |
111 } | |
112 | |
113 static char *proto_name(int proto) | |
114 { | |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
115 struct prpl *p = find_prpl(proto); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
116 if (p && p->name) |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
117 return (*p->name)(); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
118 else |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
119 return "Unknown"; |
960 | 120 } |
121 | |
122 static GtkWidget *generate_list() | |
123 { | |
124 GtkWidget *win; | |
125 char *titles[4] = {"Screenname", "Currently Online", "Auto-login", "Protocol"}; | |
126 GList *u = aim_users; | |
127 struct aim_user *a; | |
128 int i; | |
129 | |
130 win = gtk_scrolled_window_new(0, 0); | |
131 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(win), GTK_POLICY_AUTOMATIC, | |
132 GTK_POLICY_ALWAYS); | |
133 | |
134 list = gtk_clist_new_with_titles(4, titles); | |
135 gtk_clist_set_column_width(GTK_CLIST(list), 0, 90); | |
136 gtk_clist_set_selection_mode(GTK_CLIST(list), GTK_SELECTION_BROWSE); | |
137 gtk_clist_column_titles_passive(GTK_CLIST(list)); | |
138 gtk_container_add(GTK_CONTAINER(win), list); | |
139 gtk_widget_show(list); | |
140 | |
141 while (u) { | |
142 a = (struct aim_user *)u->data; | |
143 titles[0] = a->username; | |
977
e5eac6b236f1
[gaim-migrate @ 987]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
969
diff
changeset
|
144 titles[1] = find_gaim_conn_by_name(a->username) ? "Yes" : "No"; |
960 | 145 titles[2] = (a->options & OPT_USR_AUTO) ? "True" : "False"; |
146 titles[3] = proto_name(a->protocol); | |
147 i = gtk_clist_append(GTK_CLIST(list), titles); | |
148 gtk_clist_set_row_data(GTK_CLIST(list), i, a); | |
149 u = u->next; | |
150 } | |
151 | |
152 gtk_widget_show(win); | |
153 return win; | |
154 } | |
155 | |
156 static void delmod(GtkWidget *w, struct aim_user *u) | |
157 { | |
158 gtk_widget_destroy(w); | |
159 if (u) { | |
160 u->mod = NULL; | |
161 } else { | |
162 newmod = NULL; | |
163 } | |
164 } | |
165 | |
166 static void mod_opt(GtkWidget *b, struct mod_usr_opt *m) | |
167 { | |
168 if (m->user) { | |
169 m->user->tmp_options = m->user->tmp_options ^ m->opt; | |
170 } else { | |
171 tmpusr.options = tmpusr.options ^ m->opt; | |
172 } | |
173 } | |
174 | |
1051
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
175 static void free_muo(GtkWidget *b, struct mod_usr_opt *m) { |
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
176 g_free(m); |
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
177 } |
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
178 |
960 | 179 static GtkWidget *acct_button(const char *text, struct aim_user *u, int option, GtkWidget *box) |
180 { | |
181 GtkWidget *button; | |
182 struct mod_usr_opt *muo = g_new0(struct mod_usr_opt, 1); | |
183 button = gtk_check_button_new_with_label(text); | |
184 if (u) { | |
185 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), (u->options & option)); | |
186 } else { | |
187 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), (tmpusr.options & option)); | |
188 } | |
189 gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 0); | |
190 muo->user = u; muo->opt = option; | |
191 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
|
192 gtk_signal_connect(GTK_OBJECT(button), "destroy", GTK_SIGNAL_FUNC(free_muo), muo); |
960 | 193 gtk_widget_show(button); |
194 return button; | |
195 } | |
196 | |
197 static void ok_mod(GtkWidget *w, struct aim_user *u) | |
198 { | |
199 char *txt; | |
200 int i; | |
201 if (u) { | |
202 u->options = u->tmp_options; | |
203 u->protocol = u->tmp_protocol; | |
204 txt = gtk_entry_get_text(GTK_ENTRY(u->pass)); | |
205 if (u->options & OPT_USR_REM_PASS) | |
206 g_snprintf(u->password, sizeof(u->password), "%s", txt); | |
207 else | |
208 u->password[0] = '\0'; | |
209 gtk_widget_destroy(u->mod); | |
210 i = gtk_clist_find_row_from_data(GTK_CLIST(list), u); | |
211 gtk_clist_set_text(GTK_CLIST(list), i, 2, (u->options & OPT_USR_AUTO) ? "True" : "False"); | |
212 gtk_clist_set_text(GTK_CLIST(list), i, 3, proto_name(u->protocol)); | |
213 } else { | |
214 char *titles[4]; | |
215 txt = gtk_entry_get_text(GTK_ENTRY(tmpusr.name)); | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
216 if (find_user(txt, tmpusr.protocol)) { |
960 | 217 gtk_widget_destroy(newmod); |
218 return; | |
219 } | |
220 u = g_new0(struct aim_user, 1); | |
221 g_snprintf(u->username, sizeof(u->username), "%s", txt); | |
222 txt = gtk_entry_get_text(GTK_ENTRY(tmpusr.pass)); | |
223 g_snprintf(u->password, sizeof(u->password), "%s", txt); | |
224 u->options = tmpusr.options; | |
225 u->protocol = tmpusr.protocol; | |
226 gtk_widget_destroy(newmod); | |
227 titles[0] = u->username; | |
977
e5eac6b236f1
[gaim-migrate @ 987]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
969
diff
changeset
|
228 titles[1] = find_gaim_conn_by_name(u->username) ? "Yes" : "No"; |
960 | 229 titles[2] = (u->options & OPT_USR_AUTO) ? "True" : "False"; |
230 titles[3] = proto_name(u->protocol); | |
231 i = gtk_clist_append(GTK_CLIST(list), titles); | |
232 gtk_clist_set_row_data(GTK_CLIST(list), i, u); | |
984
7ec6b092f227
[gaim-migrate @ 994]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
982
diff
changeset
|
233 aim_users = g_list_append(aim_users, u); |
960 | 234 } |
235 save_prefs(); | |
236 } | |
237 | |
238 static void cancel_mod(GtkWidget *w, struct aim_user *u) | |
239 { | |
240 if (u) { | |
241 gtk_widget_destroy(u->mod); | |
242 } else { | |
243 gtk_widget_destroy(newmod); | |
244 } | |
245 } | |
246 | |
247 static void set_prot(GtkWidget *opt, int proto) | |
248 { | |
249 struct aim_user *u = gtk_object_get_user_data(GTK_OBJECT(opt)); | |
250 if (u) { | |
251 u->tmp_protocol = proto; | |
252 } else { | |
253 tmpusr.protocol = proto; | |
254 } | |
255 } | |
256 | |
257 static GtkWidget *make_protocol_menu(GtkWidget *box, struct aim_user *u) | |
258 { | |
259 GtkWidget *optmenu; | |
260 GtkWidget *menu; | |
261 GtkWidget *opt; | |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
262 GSList *p = protocols; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
263 struct prpl *e; |
960 | 264 |
265 /* PRPL: should we set some way to update these when new protocols get added? */ | |
266 optmenu = gtk_option_menu_new(); | |
267 gtk_box_pack_start(GTK_BOX(box), optmenu, FALSE, FALSE, 5); | |
268 gtk_widget_show(optmenu); | |
269 | |
270 menu = gtk_menu_new(); | |
271 | |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
272 while (p) { |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
273 e = (struct prpl *)p->data; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
274 if (e->name) |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
275 opt = gtk_menu_item_new_with_label((*e->name)()); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
276 else |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
277 opt = gtk_menu_item_new_with_label("Unknown"); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
278 gtk_object_set_user_data(GTK_OBJECT(opt), u); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
279 gtk_signal_connect(GTK_OBJECT(opt), "activate", |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
280 GTK_SIGNAL_FUNC(set_prot), (void *)e->protocol); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
281 gtk_menu_append(GTK_MENU(menu), opt); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
282 gtk_widget_show(opt); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
283 p = p->next; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
284 } |
960 | 285 |
286 gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu); | |
287 if (u) { | |
288 gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), u->protocol); | |
982
09e5065fe22c
[gaim-migrate @ 992]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
289 u->tmp_protocol = u->protocol; |
960 | 290 } else { |
1005
b1572ac4246c
[gaim-migrate @ 1015]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
291 gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), |
b1572ac4246c
[gaim-migrate @ 1015]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
292 ((struct prpl *)protocols->data)->protocol); |
960 | 293 } |
294 | |
295 return optmenu; | |
296 } | |
297 | |
298 static void show_acct_mod(struct aim_user *u) | |
299 { | |
300 /* here we can have all the aim_user options, including ones not shown in the main acctedit | |
301 * window. this can keep the size of the acctedit window small and readable, and make this | |
302 * one the powerful editor. this is where things like name/password are edited, but can | |
303 * also have toggles (and even more complex options) like whether to autologin or whether | |
304 * to send keepalives or whatever. this would be the perfect place to specify which protocol | |
305 * to use. make sure to account for the possibility of protocol plugins. */ | |
306 GtkWidget *mod; | |
307 GtkWidget *frame; | |
308 GtkWidget *vbox; | |
309 GtkWidget *hbox; | |
310 GtkWidget *label; | |
311 GtkWidget *name; | |
312 GtkWidget *pass; | |
313 GtkWidget *button; | |
314 | |
315 if (!u && newmod) { | |
316 gtk_widget_show(newmod); | |
317 return; | |
318 } | |
319 if (u && u->mod) { | |
320 gtk_widget_show(u->mod); | |
321 return; | |
322 } | |
323 | |
324 mod = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
325 gtk_window_set_wmclass(GTK_WINDOW(mod), "account", "Gaim"); | |
326 gtk_widget_realize(mod); | |
327 aol_icon(mod->window); | |
328 gtk_container_border_width(GTK_CONTAINER(mod), 10); | |
329 gtk_window_set_title(GTK_WINDOW(mod), _("Gaim - Modify Account")); | |
330 gtk_signal_connect(GTK_OBJECT(mod), "destroy", | |
331 GTK_SIGNAL_FUNC(delmod), u); | |
332 | |
333 frame = gtk_frame_new(_("Modify Account")); | |
334 gtk_container_add(GTK_CONTAINER(mod), frame); | |
335 gtk_widget_show(frame); | |
336 | |
337 vbox = gtk_vbox_new(FALSE, 0); | |
338 gtk_container_add(GTK_CONTAINER(frame), vbox); | |
339 gtk_widget_show(vbox); | |
340 | |
341 hbox = gtk_hbox_new(FALSE, 0); | |
342 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
343 gtk_widget_show(hbox); | |
344 | |
345 label = gtk_label_new(_("Screenname:")); | |
346 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
347 gtk_widget_show(label); | |
348 | |
349 name = gtk_entry_new(); | |
350 gtk_box_pack_start(GTK_BOX(hbox), name, FALSE, FALSE, 5); | |
351 gtk_widget_show(name); | |
352 | |
353 hbox = gtk_hbox_new(FALSE, 5); | |
354 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
355 gtk_widget_show(hbox); | |
356 | |
357 label = gtk_label_new(_("Password:")); | |
358 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
359 gtk_widget_show(label); | |
360 | |
361 pass = gtk_entry_new(); | |
362 gtk_box_pack_start(GTK_BOX(hbox), pass, FALSE, FALSE, 5); | |
363 gtk_entry_set_visibility(GTK_ENTRY(pass), FALSE); | |
364 gtk_widget_show(pass); | |
365 | |
366 hbox = gtk_hbox_new(FALSE, 5); | |
367 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
368 gtk_widget_show(hbox); | |
369 | |
370 make_protocol_menu(hbox, u); | |
371 | |
372 acct_button(_("Remember Password"), u, OPT_USR_REM_PASS, vbox); | |
373 acct_button(_("Auto-Login"), u, OPT_USR_AUTO, vbox); | |
374 acct_button(_("Send KeepAlive packet (6 bytes/second)"), u, OPT_USR_KEEPALV, vbox); | |
375 | |
376 hbox = gtk_hbox_new(FALSE, 5); | |
377 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
378 gtk_widget_show(hbox); | |
379 | |
380 button = picture_button(mod, _("Cancel"), cancel_xpm); | |
381 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5); | |
382 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(cancel_mod), u); | |
383 gtk_widget_show(button); | |
384 | |
385 button = picture_button(mod, _("OK"), ok_xpm); | |
386 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5); | |
387 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(ok_mod), u); | |
388 gtk_widget_show(button); | |
389 | |
390 if (u) { | |
391 u->mod = mod; | |
392 u->name = name; | |
393 u->pass = pass; | |
394 u->tmp_options = u->options; | |
395 gtk_entry_set_text(GTK_ENTRY(name), u->username); | |
396 gtk_entry_set_text(GTK_ENTRY(pass), u->password); | |
397 gtk_entry_set_editable(GTK_ENTRY(name), FALSE); | |
398 } else { | |
399 newmod = mod; | |
400 tmpusr.name = name; | |
401 tmpusr.pass = pass; | |
402 } | |
403 | |
404 gtk_widget_show(mod); | |
405 } | |
406 | |
407 static void add_acct(GtkWidget *w, gpointer d) | |
408 { | |
409 show_acct_mod(NULL); | |
410 } | |
411 | |
412 static void mod_acct(GtkWidget *w, gpointer d) | |
413 { | |
414 int row = -1; | |
415 struct aim_user *u; | |
416 if (GTK_CLIST(list)->selection) | |
417 row = (int)GTK_CLIST(list)->selection->data; | |
418 if (row != -1) { | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
419 u = g_list_nth_data(aim_users, row); |
960 | 420 if (u) |
421 show_acct_mod(u); | |
422 } | |
423 } | |
424 | |
425 static void pass_des(GtkWidget *w, struct aim_user *u) | |
426 { | |
427 gtk_widget_destroy(w); | |
428 u->passprmt = NULL; | |
429 } | |
430 | |
431 static void pass_cancel(GtkWidget *w, struct aim_user *u) | |
432 { | |
433 gtk_widget_destroy(u->passprmt); | |
434 u->passprmt = NULL; | |
435 } | |
436 | |
437 static void pass_signon(GtkWidget *w, struct aim_user *u) | |
438 { | |
439 char *txt = gtk_entry_get_text(GTK_ENTRY(u->passentry)); | |
980
82c5865f7cfe
[gaim-migrate @ 990]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
977
diff
changeset
|
440 g_snprintf(u->password, sizeof(u->password), "%s", txt); |
960 | 441 #ifdef USE_APPLET |
442 set_user_state(signing_on); | |
443 #endif | |
444 gtk_widget_destroy(u->passprmt); | |
445 u->passprmt = NULL; | |
980
82c5865f7cfe
[gaim-migrate @ 990]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
977
diff
changeset
|
446 serv_login(u); |
960 | 447 } |
448 | |
449 static void do_pass_dlg(struct aim_user *u) | |
450 { | |
451 /* we can safely assume that u is not NULL */ | |
452 GtkWidget *frame; | |
453 GtkWidget *vbox; | |
454 GtkWidget *hbox; | |
455 char buf[96]; | |
456 GtkWidget *label; | |
457 GtkWidget *button; | |
458 | |
459 if (u->passprmt) { gtk_widget_show(u->passprmt); return; } | |
460 u->passprmt = gtk_window_new(GTK_WINDOW_DIALOG); | |
461 gtk_window_set_wmclass(GTK_WINDOW(u->passprmt), "password", "Gaim"); | |
462 gtk_container_border_width(GTK_CONTAINER(u->passprmt), 5); | |
463 gtk_signal_connect(GTK_OBJECT(u->passprmt), "destroy", GTK_SIGNAL_FUNC(pass_des), u); | |
464 gtk_widget_realize(u->passprmt); | |
465 aol_icon(u->passprmt->window); | |
466 | |
467 frame = gtk_frame_new(_("Enter Password")); | |
468 gtk_container_add(GTK_CONTAINER(u->passprmt), frame); | |
469 gtk_widget_show(frame); | |
470 | |
471 vbox = gtk_vbox_new(FALSE, 5); | |
472 gtk_container_add(GTK_CONTAINER(frame), vbox); | |
473 gtk_widget_show(vbox); | |
474 | |
475 hbox = gtk_hbox_new(FALSE, 5); | |
476 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
477 gtk_widget_show(hbox); | |
478 | |
479 g_snprintf(buf, sizeof(buf), "Password for %s:", u->username); | |
480 label = gtk_label_new(buf); | |
481 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
482 gtk_widget_show(label); | |
483 | |
484 u->passentry = gtk_entry_new(); | |
485 gtk_entry_set_visibility(GTK_ENTRY(u->passentry), FALSE); | |
486 gtk_box_pack_start(GTK_BOX(hbox), u->passentry, FALSE, FALSE, 5); | |
487 gtk_signal_connect(GTK_OBJECT(u->passentry), "activate", GTK_SIGNAL_FUNC(pass_signon), u); | |
488 gtk_widget_grab_focus(u->passentry); | |
489 gtk_widget_show(u->passentry); | |
490 | |
491 hbox = gtk_hbox_new(FALSE, 5); | |
492 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
493 gtk_widget_show(hbox); | |
494 | |
495 button = picture_button(u->passprmt, _("Cancel"), cancel_xpm); | |
496 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(pass_cancel), u); | |
497 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5); | |
498 | |
499 button = picture_button(u->passprmt, _("Signon"), ok_xpm); | |
500 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(pass_signon), u); | |
501 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5); | |
502 | |
503 gtk_widget_show(u->passprmt); | |
504 } | |
505 | |
506 static void acct_signin(GtkWidget *w, gpointer d) | |
507 { | |
508 int row = -1; | |
509 struct aim_user *u; | |
510 if (GTK_CLIST(list)->selection) | |
511 row = (int)GTK_CLIST(list)->selection->data; | |
512 if (row != -1) { | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
513 u = g_list_nth_data(aim_users, row); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
514 if (!u->gc) { |
960 | 515 if (!u->password[0]) { |
516 do_pass_dlg(u); | |
517 } else { | |
518 #ifdef USE_APPLET | |
519 set_user_state(signing_on); | |
520 #endif /* USE_APPLET */ | |
980
82c5865f7cfe
[gaim-migrate @ 990]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
977
diff
changeset
|
521 serv_login(u); |
960 | 522 } |
523 } else { | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
524 signoff(u->gc); |
960 | 525 } |
526 } | |
527 } | |
528 | |
529 static void del_acct(GtkWidget *w, gpointer d) | |
530 { | |
531 int row = -1; | |
532 struct aim_user *u; | |
533 if (GTK_CLIST(list)->selection) | |
534 row = (int)GTK_CLIST(list)->selection->data; | |
535 if (row != -1) { | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
536 u = g_list_nth_data(aim_users, row); |
960 | 537 if (u) { |
538 aim_users = g_list_remove(aim_users, u); | |
539 save_prefs(); | |
540 } | |
541 gtk_clist_remove(GTK_CLIST(list), row); | |
542 } | |
543 } | |
544 | |
545 void account_editor(GtkWidget *w, GtkWidget *W) | |
546 { | |
547 /* please kill me */ | |
548 GtkWidget *frame; | |
549 GtkWidget *box; | |
550 GtkWidget *list; | |
551 GtkWidget *hbox; | |
552 GtkWidget *button; /* used for many things */ | |
553 | |
554 if (acctedit) { gtk_widget_show(acctedit); return; } | |
555 | |
556 acctedit = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
557 gtk_window_set_title(GTK_WINDOW(acctedit), _("Gaim - Account Editor")); | |
558 gtk_window_set_wmclass(GTK_WINDOW(acctedit), "accounteditor", "Gaim"); | |
559 gtk_widget_realize(acctedit); | |
560 aol_icon(acctedit->window); | |
561 gtk_container_border_width(GTK_CONTAINER(acctedit), 10); | |
562 gtk_widget_set_usize(acctedit, -1, 200); | |
563 gtk_signal_connect(GTK_OBJECT(acctedit), "destroy", | |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1005
diff
changeset
|
564 GTK_SIGNAL_FUNC(delete_acctedit), W); |
960 | 565 |
566 frame = gtk_frame_new(_("Account Editor")); | |
567 gtk_container_add(GTK_CONTAINER(acctedit), frame); | |
568 gtk_widget_show(frame); | |
569 | |
570 box = gtk_vbox_new(FALSE, 5); | |
571 gtk_container_add(GTK_CONTAINER(frame), box); | |
572 gtk_widget_show(box); | |
573 | |
574 list = generate_list(); | |
575 gtk_box_pack_start(GTK_BOX(box), list, TRUE, TRUE, 5); | |
576 | |
577 hbox = gtk_hbox_new(TRUE, 5); | |
578 gtk_box_pack_end(GTK_BOX(box), hbox, FALSE, FALSE, 5); | |
579 gtk_widget_show(hbox); | |
580 | |
581 button = picture_button(acctedit, _("Add"), gnome_add_xpm); | |
582 gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 5); | |
583 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(add_acct), NULL); | |
584 | |
585 button = picture_button(acctedit, _("Modify"), gnome_preferences_xpm); | |
586 gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 5); | |
587 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(mod_acct), NULL); | |
588 | |
589 button = picture_button(acctedit, _("Sign On/Off"), join_xpm); | |
590 gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 5); | |
591 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(acct_signin), NULL); | |
592 | |
593 button = picture_button(acctedit, _("Delete"), gnome_remove_xpm); | |
594 gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 5); | |
595 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(del_acct), NULL); | |
596 | |
597 button = picture_button(acctedit, _("Close"), gnome_close_xpm); | |
598 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
|
599 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(acctedit_close), W); |
960 | 600 |
601 gtk_widget_show(acctedit); | |
602 } | |
603 | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
604 void account_online(struct aim_user *u, struct gaim_connection *gc) |
960 | 605 { |
606 int i; | |
1002
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
607 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
608 gc->user = u; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
609 u->gc = gc; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
610 |
1002
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
611 /* first we hide the login progress meter */ |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
612 if (gc->meter) |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
613 gtk_widget_destroy(gc->meter); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
614 gc->meter = NULL; |
1002
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
615 |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
616 /* then we do the buddy list stuff */ |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
617 if (mainwindow) |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
618 gtk_widget_hide(mainwindow); |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
619 show_buddy_list(); |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
620 |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
621 #ifdef USE_APPLET |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
622 if (general_options & OPT_GEN_APP_BUDDY_SHOW) { |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
623 refresh_buddy_window(); |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
624 createOnlinePopup(); |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
625 applet_buddy_show = TRUE; |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
626 } else { |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
627 gtk_widget_hide(blist); |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
628 applet_buddy_show = FALSE; |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
629 } |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
630 set_user_state(online); |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
631 #else |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
632 refresh_buddy_window(); |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
633 #endif |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
634 setup_buddy_chats(); |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
635 |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
636 redo_convo_menus(); |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
637 gaim_setup(gc); |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
638 |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
639 plugin_event(event_signon, gc, 0, 0, 0); |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
640 |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
641 /* everything for the account editor */ |
960 | 642 if (!acctedit) return; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
643 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
|
644 gtk_clist_set_text(GTK_CLIST(list), i, 1, "Yes"); |
960 | 645 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
|
646 |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
647 return; |
960 | 648 } |
649 | |
650 void account_offline(struct gaim_connection *gc) | |
651 { | |
652 int i; | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
653 gc->user->gc = NULL; /* wasn't that awkward? */ |
960 | 654 if (!acctedit) return; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
655 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
|
656 gtk_clist_set_text(GTK_CLIST(list), i, 1, "No"); |
993
eacd93d0089a
[gaim-migrate @ 1003]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
657 redo_convo_menus(); |
960 | 658 } |
659 | |
660 void auto_login() | |
661 { | |
662 GList *u = aim_users; | |
663 struct aim_user *a = NULL; | |
664 | |
665 while (u) { | |
666 a = (struct aim_user *)u->data; | |
667 if ((a->options & OPT_USR_AUTO) && (a->options & OPT_USR_REM_PASS)) { | |
668 #ifdef USE_APPLET | |
669 set_user_state(signing_on); | |
670 #endif /* USE_APPLET */ | |
980
82c5865f7cfe
[gaim-migrate @ 990]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
977
diff
changeset
|
671 serv_login(a); |
960 | 672 } |
673 u = u->next; | |
674 } | |
675 } | |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
676 |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
677 static void meter_destroy(GtkWidget *meter, struct gaim_connection *gc) { |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
678 gtk_widget_destroy(meter); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
679 gc->meter = NULL; |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
680 } |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
681 |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
682 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
|
683 if (mainwindow) |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
684 gtk_widget_hide(mainwindow); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
685 |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
686 if (!gc->meter) { |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
687 GtkWidget *box, *label; |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
688 char buf[256]; |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
689 |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
690 gc->meter = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
691 gtk_window_set_policy(GTK_WINDOW(gc->meter), 0, 0, 1); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
692 gtk_window_set_wmclass(GTK_WINDOW(gc->meter), "signon", "Gaim"); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
693 gtk_container_set_border_width(GTK_CONTAINER(gc->meter), 5); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
694 g_snprintf(buf, sizeof(buf), "%s Signing On", gc->username); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
695 gtk_window_set_title(GTK_WINDOW(gc->meter), buf); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
696 gtk_signal_connect(GTK_OBJECT(gc->meter), "destroy", |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
697 GTK_SIGNAL_FUNC(meter_destroy), gc); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
698 gtk_widget_realize(gc->meter); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
699 aol_icon(gc->meter->window); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
700 |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
701 box = gtk_vbox_new(FALSE, 5); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
702 gtk_container_add(GTK_CONTAINER(gc->meter), box); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
703 gtk_widget_show(box); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
704 |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
705 label = gtk_label_new(buf); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
706 gtk_box_pack_start(GTK_BOX(box), label, 0, 0, 5); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
707 gtk_widget_show(label); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
708 |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
709 gc->progress = gtk_progress_bar_new(); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
710 gtk_widget_set_usize(gc->progress, 150, 0); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
711 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
|
712 gtk_widget_show(gc->progress); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
713 |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
714 gc->status = gtk_statusbar_new(); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
715 gtk_widget_set_usize(gc->status, 150, 0); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
716 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
|
717 gtk_widget_show(gc->status); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
718 |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
719 gtk_widget_show(gc->meter); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
720 } |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
721 |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
722 gtk_progress_bar_update(GTK_PROGRESS_BAR(gc->progress), howfar / 5); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
723 gtk_statusbar_pop(GTK_STATUSBAR(gc->status), 1); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
724 gtk_statusbar_push(GTK_STATUSBAR(gc->status), 1, message); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
725 } |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
726 |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
727 void hide_login_progress(struct gaim_connection *gc, char *why) |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
728 { |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
729 char buf[2048]; |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
730 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
|
731 do_error_dialog(buf, _("Signon Error")); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
732 if (gc->meter) |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
733 gtk_widget_destroy(gc->meter); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
734 gc->meter = NULL; |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
735 } |