Mercurial > pidgin.yaz
comparison src/multi.c @ 1250:b5783215b245
[gaim-migrate @ 1260]
decklin's clean up of the account editor, much needed.
indent -kr -i8 -l105 -ncs -cp7 -npcs -T GtkWidget -T gpointer -T AppletCallbackFunc -T GtkFunction -T gaim_plugin_remove -T name -T FILE -T gchar -T user_opts -T GdkEvent -T GtkObject ...
did about.c, aim.c, away.c, browser.c, buddy_chat.c, gaimrc.c, html.c, idle.c, multi.c. Need to do buddy.c, conversation.c, dialogs.c, oscar.c, perl.c, plugins.c, prefs.c, proxy.c, prpl.c, rvous.c, server.c, sound.c, toc.c, util.c. not doing gtkhtml.c because it's a piece of crap anyway, or *ticker.c because they're syd's.
got rid of debug_buff, just debug_printf now.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Wed, 13 Dec 2000 20:18:35 +0000 |
parents | 4135d8fc7b4e |
children | 9da444224f0e |
comparison
equal
deleted
inserted
replaced
1249:3e44de27622d | 1250:b5783215b245 |
---|---|
36 #define LOGIN_STEPS 5 | 36 #define LOGIN_STEPS 5 |
37 | 37 |
38 GSList *connections; | 38 GSList *connections; |
39 | 39 |
40 static GtkWidget *acctedit = NULL; | 40 static GtkWidget *acctedit = NULL; |
41 static GtkWidget *list = NULL; /* the clist of names in the accteditor */ | 41 static GtkWidget *list = NULL; /* the clist of names in the accteditor */ |
42 static GtkWidget *newmod = NULL; /* the dialog for creating a new account */ | 42 static GtkWidget *newmod = NULL; /* the dialog for creating a new account */ |
43 static GtkWidget *newmain = NULL; /* the frame that holds the possible notebook for options */ | 43 static GtkWidget *newmain = NULL; /* the notebook that holds options */ |
44 static struct aim_user tmpusr; | 44 static struct aim_user tmpusr; |
45 | |
46 static void generate_prpl_options(struct aim_user *, GtkWidget *); | |
45 | 47 |
46 struct mod_usr_opt { | 48 struct mod_usr_opt { |
47 struct aim_user *user; | 49 struct aim_user *user; |
48 int opt; | 50 int opt; |
49 }; | 51 }; |
95 if (!connections && mainwindow) | 97 if (!connections && mainwindow) |
96 gtk_widget_show(mainwindow); | 98 gtk_widget_show(mainwindow); |
97 #endif | 99 #endif |
98 } | 100 } |
99 | 101 |
100 struct gaim_connection *find_gaim_conn_by_name(char *name) { | 102 struct gaim_connection *find_gaim_conn_by_name(char *name) |
103 { | |
101 char *who = g_strdup(normalize(name)); | 104 char *who = g_strdup(normalize(name)); |
102 GSList *c = connections; | 105 GSList *c = connections; |
103 struct gaim_connection *g = NULL; | 106 struct gaim_connection *g = NULL; |
104 | 107 |
105 while (c) { | 108 while (c) { |
144 } | 147 } |
145 | 148 |
146 static GtkWidget *generate_list() | 149 static GtkWidget *generate_list() |
147 { | 150 { |
148 GtkWidget *win; | 151 GtkWidget *win; |
149 char *titles[4] = {"Screenname", "Currently Online", "Auto-login", "Protocol"}; | 152 char *titles[4] = { "Screenname", "Currently Online", "Auto-login", "Protocol" }; |
150 GList *u = aim_users; | 153 GList *u = aim_users; |
151 struct aim_user *a; | 154 struct aim_user *a; |
152 int i; | 155 int i; |
153 | 156 |
154 win = gtk_scrolled_window_new(0, 0); | 157 win = gtk_scrolled_window_new(0, 0); |
155 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(win), GTK_POLICY_AUTOMATIC, | 158 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(win), GTK_POLICY_AUTOMATIC, |
156 GTK_POLICY_ALWAYS); | 159 GTK_POLICY_ALWAYS); |
157 | 160 |
158 list = gtk_clist_new_with_titles(4, titles); | 161 list = gtk_clist_new_with_titles(4, titles); |
159 gtk_clist_set_column_width(GTK_CLIST(list), 0, 90); | 162 gtk_clist_set_column_width(GTK_CLIST(list), 0, 90); |
160 gtk_clist_set_selection_mode(GTK_CLIST(list), GTK_SELECTION_BROWSE); | 163 gtk_clist_set_selection_mode(GTK_CLIST(list), GTK_SELECTION_BROWSE); |
161 gtk_clist_column_titles_passive(GTK_CLIST(list)); | 164 gtk_clist_column_titles_passive(GTK_CLIST(list)); |
194 } else { | 197 } else { |
195 tmpusr.options = tmpusr.options ^ m->opt; | 198 tmpusr.options = tmpusr.options ^ m->opt; |
196 } | 199 } |
197 } | 200 } |
198 | 201 |
199 static void free_muo(GtkWidget *b, struct mod_usr_opt *m) { | 202 static void free_muo(GtkWidget *b, struct mod_usr_opt *m) |
203 { | |
200 g_free(m); | 204 g_free(m); |
201 } | 205 } |
202 | 206 |
203 static GtkWidget *acct_button(const char *text, struct aim_user *u, int option, GtkWidget *box) | 207 static GtkWidget *acct_button(const char *text, struct aim_user *u, int option, GtkWidget *box) |
204 { | 208 { |
209 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), (u->options & option)); | 213 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), (u->options & option)); |
210 } else { | 214 } else { |
211 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), (tmpusr.options & option)); | 215 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), (tmpusr.options & option)); |
212 } | 216 } |
213 gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 0); | 217 gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 0); |
214 muo->user = u; muo->opt = option; | 218 muo->user = u; |
219 muo->opt = option; | |
215 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(mod_opt), muo); | 220 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(mod_opt), muo); |
216 gtk_signal_connect(GTK_OBJECT(button), "destroy", GTK_SIGNAL_FUNC(free_muo), muo); | 221 gtk_signal_connect(GTK_OBJECT(button), "destroy", GTK_SIGNAL_FUNC(free_muo), muo); |
217 gtk_widget_show(button); | 222 gtk_widget_show(button); |
218 return button; | 223 return button; |
219 } | 224 } |
230 g_snprintf(u->password, sizeof(u->password), "%s", txt); | 235 g_snprintf(u->password, sizeof(u->password), "%s", txt); |
231 else | 236 else |
232 u->password[0] = '\0'; | 237 u->password[0] = '\0'; |
233 gtk_widget_destroy(u->mod); | 238 gtk_widget_destroy(u->mod); |
234 i = gtk_clist_find_row_from_data(GTK_CLIST(list), u); | 239 i = gtk_clist_find_row_from_data(GTK_CLIST(list), u); |
235 gtk_clist_set_text(GTK_CLIST(list), i, 2, (u->options & OPT_USR_AUTO) ? "True" : "False"); | 240 gtk_clist_set_text(GTK_CLIST(list), i, 2, |
241 (u->options & OPT_USR_AUTO) ? "True" : "False"); | |
236 gtk_clist_set_text(GTK_CLIST(list), i, 3, proto_name(u->protocol)); | 242 gtk_clist_set_text(GTK_CLIST(list), i, 3, proto_name(u->protocol)); |
237 } else { | 243 } else { |
238 char *titles[4]; | 244 char *titles[4]; |
239 int i; | 245 int i; |
240 txt = gtk_entry_get_text(GTK_ENTRY(tmpusr.name)); | 246 txt = gtk_entry_get_text(GTK_ENTRY(tmpusr.name)); |
265 } else { | 271 } else { |
266 gtk_widget_destroy(newmod); | 272 gtk_widget_destroy(newmod); |
267 } | 273 } |
268 } | 274 } |
269 | 275 |
270 static void generate_options(struct aim_user *, GtkWidget *); | |
271 | |
272 static void set_prot(GtkWidget *opt, int proto) | 276 static void set_prot(GtkWidget *opt, int proto) |
273 { | 277 { |
274 struct aim_user *u = gtk_object_get_user_data(GTK_OBJECT(opt)); | 278 struct aim_user *u = gtk_object_get_user_data(GTK_OBJECT(opt)); |
275 if (u && (u->tmp_protocol != proto)) { | 279 if (u && (u->tmp_protocol != proto)) { |
276 int i; | 280 int i; |
277 for (i = 0; i < 6; i++) | 281 for (i = 0; i < 6; i++) |
278 u->proto_opt[i][0] = '\0'; | 282 u->proto_opt[i][0] = '\0'; |
279 u->tmp_protocol = proto; | 283 u->tmp_protocol = proto; |
280 generate_options(u, u->main); | 284 generate_prpl_options(u, u->main); |
281 } else if (tmpusr.tmp_protocol != proto) { | 285 } else if (tmpusr.tmp_protocol != proto) { |
282 int i; | 286 int i; |
283 for (i = 0; i < 6; i++) | 287 for (i = 0; i < 6; i++) |
284 tmpusr.proto_opt[i][0] = '\0'; | 288 tmpusr.proto_opt[i][0] = '\0'; |
285 tmpusr.tmp_protocol = tmpusr.protocol = proto; | 289 tmpusr.tmp_protocol = tmpusr.protocol = proto; |
286 generate_options(NULL, newmain); | 290 generate_prpl_options(NULL, newmain); |
287 } | 291 } |
288 } | 292 } |
289 | 293 |
290 static GtkWidget *make_protocol_menu(GtkWidget *box, struct aim_user *u, GtkWidget *frame) | 294 static GtkWidget *make_protocol_menu(GtkWidget *box, struct aim_user *u) |
291 { | 295 { |
292 GtkWidget *optmenu; | 296 GtkWidget *optmenu; |
293 GtkWidget *menu; | 297 GtkWidget *menu; |
294 GtkWidget *opt; | 298 GtkWidget *opt; |
295 GSList *p = protocols; | 299 GSList *p = protocols; |
332 gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), count); | 336 gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), count); |
333 | 337 |
334 return optmenu; | 338 return optmenu; |
335 } | 339 } |
336 | 340 |
337 static void generate_options(struct aim_user *u, GtkWidget *frame) { | 341 static void generate_general_options(struct aim_user *u, GtkWidget *book) |
338 GList *tmp; | 342 { |
339 GtkWidget *book; | |
340 GtkWidget *vbox; | 343 GtkWidget *vbox; |
341 GtkWidget *hbox; | 344 GtkWidget *hbox; |
342 GtkWidget *label; | 345 GtkWidget *label; |
343 GtkWidget *name; | 346 GtkWidget *name; |
344 GtkWidget *pass; | 347 GtkWidget *pass; |
345 struct prpl *p; | 348 |
346 | 349 vbox = gtk_vbox_new(FALSE, 5); |
347 tmp = gtk_container_children(GTK_CONTAINER(frame)); | 350 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
348 | 351 gtk_notebook_append_page(GTK_NOTEBOOK(book), vbox, gtk_label_new(_("General Options"))); |
349 if (u) | 352 |
350 p = find_prpl(u->tmp_protocol); | 353 hbox = gtk_hbox_new(FALSE, 5); |
351 else | 354 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
352 p = find_prpl(tmpusr.protocol); | 355 |
353 | 356 label = gtk_label_new(_("Screenname:")); |
354 if (p && p->user_opts) { | 357 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
355 if (tmp && !GTK_IS_NOTEBOOK(tmp->data)) { | 358 |
356 gtk_widget_destroy(tmp->data); | 359 name = gtk_entry_new(); |
357 tmp = NULL; | 360 gtk_box_pack_start(GTK_BOX(hbox), name, TRUE, TRUE, 0); |
358 } | 361 |
359 | 362 hbox = gtk_hbox_new(FALSE, 5); |
360 if (!tmp) { | 363 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
361 book = gtk_notebook_new(); | 364 |
362 gtk_container_add(GTK_CONTAINER(frame), book); | 365 label = gtk_label_new(_("Password:")); |
363 gtk_widget_show(book); | 366 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
364 | 367 |
365 vbox = gtk_vbox_new(FALSE, 0); | 368 pass = gtk_entry_new(); |
366 gtk_notebook_append_page(GTK_NOTEBOOK(book), vbox, | 369 gtk_box_pack_start(GTK_BOX(hbox), pass, TRUE, TRUE, 0); |
367 gtk_label_new(_("General Options"))); | 370 gtk_entry_set_visibility(GTK_ENTRY(pass), FALSE); |
368 gtk_widget_show(vbox); | 371 |
369 | 372 hbox = gtk_hbox_new(FALSE, 5); |
370 if (u) | 373 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
371 (*p->user_opts)(book, u); | |
372 else | |
373 (*p->user_opts)(book, &tmpusr); | |
374 } else { | |
375 book = (GtkWidget *)tmp->data; | |
376 gtk_notebook_remove_page(GTK_NOTEBOOK(book), 1); | |
377 if (u) | |
378 (*p->user_opts)(book, u); | |
379 else | |
380 (*p->user_opts)(book, &tmpusr); | |
381 return; | |
382 } | |
383 } else { | |
384 if (tmp && GTK_IS_NOTEBOOK(tmp->data)) { | |
385 gtk_widget_destroy(tmp->data); | |
386 tmp = NULL; | |
387 } | |
388 | |
389 if (!tmp) { | |
390 vbox = gtk_vbox_new(FALSE, 0); | |
391 gtk_container_add(GTK_CONTAINER(frame), vbox); | |
392 gtk_widget_show(vbox); | |
393 } else { | |
394 return; | |
395 } | |
396 } | |
397 | |
398 hbox = gtk_hbox_new(FALSE, 0); | |
399 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
400 gtk_widget_show(hbox); | 374 gtk_widget_show(hbox); |
401 | 375 |
402 label = gtk_label_new(_("Screenname:")); | 376 label = gtk_label_new(_("Protocol:")); |
403 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | 377 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
404 gtk_widget_show(label); | 378 |
405 | 379 make_protocol_menu(hbox, u); |
406 name = gtk_entry_new(); | |
407 gtk_box_pack_start(GTK_BOX(hbox), name, FALSE, FALSE, 5); | |
408 gtk_widget_show(name); | |
409 | |
410 hbox = gtk_hbox_new(FALSE, 5); | |
411 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
412 gtk_widget_show(hbox); | |
413 | |
414 label = gtk_label_new(_("Password:")); | |
415 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
416 gtk_widget_show(label); | |
417 | |
418 pass = gtk_entry_new(); | |
419 gtk_box_pack_start(GTK_BOX(hbox), pass, FALSE, FALSE, 5); | |
420 gtk_entry_set_visibility(GTK_ENTRY(pass), FALSE); | |
421 gtk_widget_show(pass); | |
422 | |
423 hbox = gtk_hbox_new(FALSE, 5); | |
424 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
425 gtk_widget_show(hbox); | |
426 | |
427 make_protocol_menu(hbox, u, frame); | |
428 | 380 |
429 acct_button(_("Remember Password"), u, OPT_USR_REM_PASS, vbox); | 381 acct_button(_("Remember Password"), u, OPT_USR_REM_PASS, vbox); |
430 acct_button(_("Auto-Login"), u, OPT_USR_AUTO, vbox); | 382 acct_button(_("Auto-Login"), u, OPT_USR_AUTO, vbox); |
431 acct_button(_("Send KeepAlive packet (6 bytes/second)"), u, OPT_USR_KEEPALV, vbox); | 383 acct_button(_("Send KeepAlive packet (6 bytes/second)"), u, OPT_USR_KEEPALV, vbox); |
432 | 384 |
438 gtk_entry_set_editable(GTK_ENTRY(name), FALSE); | 390 gtk_entry_set_editable(GTK_ENTRY(name), FALSE); |
439 } else { | 391 } else { |
440 tmpusr.name = name; | 392 tmpusr.name = name; |
441 tmpusr.pass = pass; | 393 tmpusr.pass = pass; |
442 } | 394 } |
395 | |
396 gtk_widget_show_all(vbox); | |
397 } | |
398 | |
399 static void generate_prpl_options(struct aim_user *u, GtkWidget *book) | |
400 { | |
401 struct prpl *p; | |
402 | |
403 if (u) | |
404 p = find_prpl(u->tmp_protocol); | |
405 else | |
406 p = find_prpl(tmpusr.protocol); | |
407 | |
408 /* page 0 is general, keep it. page 1 is options for our | |
409 * particular protocol, so clear it out and make a new one. */ | |
410 | |
411 gtk_notebook_remove_page(GTK_NOTEBOOK(book), 1); | |
412 | |
413 if (p && p->user_opts) { | |
414 if (u) | |
415 (*p->user_opts)(book, u); | |
416 else | |
417 (*p->user_opts)(book, &tmpusr); | |
418 } | |
443 } | 419 } |
444 | 420 |
445 static void show_acct_mod(struct aim_user *u) | 421 static void show_acct_mod(struct aim_user *u) |
446 { | 422 { |
447 /* here we can have all the aim_user options, including ones not shown in the main acctedit | 423 /* here we can have all the aim_user options, including ones not shown in the main acctedit |
450 * also have toggles (and even more complex options) like whether to autologin or whether | 426 * also have toggles (and even more complex options) like whether to autologin or whether |
451 * to send keepalives or whatever. this would be the perfect place to specify which protocol | 427 * to send keepalives or whatever. this would be the perfect place to specify which protocol |
452 * to use. make sure to account for the possibility of protocol plugins. */ | 428 * to use. make sure to account for the possibility of protocol plugins. */ |
453 GtkWidget *mod; | 429 GtkWidget *mod; |
454 GtkWidget *box; | 430 GtkWidget *box; |
455 GtkWidget *frame; | 431 GtkWidget *book; |
456 GtkWidget *hbox; | 432 GtkWidget *hbox; |
457 GtkWidget *button; | 433 GtkWidget *button; |
458 | 434 |
459 if (!u && newmod) { | 435 if (!u && newmod) { |
460 gtk_widget_show(newmod); | 436 gtk_widget_show(newmod); |
467 | 443 |
468 mod = gtk_window_new(GTK_WINDOW_TOPLEVEL); | 444 mod = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
469 gtk_window_set_wmclass(GTK_WINDOW(mod), "account", "Gaim"); | 445 gtk_window_set_wmclass(GTK_WINDOW(mod), "account", "Gaim"); |
470 gtk_widget_realize(mod); | 446 gtk_widget_realize(mod); |
471 aol_icon(mod->window); | 447 aol_icon(mod->window); |
472 gtk_container_border_width(GTK_CONTAINER(mod), 10); | |
473 gtk_window_set_title(GTK_WINDOW(mod), _("Gaim - Modify Account")); | 448 gtk_window_set_title(GTK_WINDOW(mod), _("Gaim - Modify Account")); |
474 gtk_window_set_policy(GTK_WINDOW(mod), 0, 1, 1); /* i know, i'm odd */ | 449 gtk_window_set_policy(GTK_WINDOW(mod), FALSE, TRUE, TRUE); /* nothing odd here :) */ |
475 gtk_signal_connect(GTK_OBJECT(mod), "destroy", | 450 gtk_signal_connect(GTK_OBJECT(mod), "destroy", GTK_SIGNAL_FUNC(delmod), u); |
476 GTK_SIGNAL_FUNC(delmod), u); | 451 |
477 | 452 box = gtk_vbox_new(FALSE, 5); |
478 box = gtk_vbox_new(FALSE, 0); | 453 gtk_container_border_width(GTK_CONTAINER(mod), 5); |
479 gtk_container_add(GTK_CONTAINER(mod), box); | 454 gtk_container_add(GTK_CONTAINER(mod), box); |
480 gtk_widget_show(box); | 455 |
481 | 456 book = gtk_notebook_new(); |
482 frame = gtk_frame_new(_("Modify Account")); | 457 gtk_box_pack_start(GTK_BOX(box), book, FALSE, FALSE, 0); |
483 gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 5); | 458 |
484 gtk_widget_show(frame); | 459 if (u) |
485 | 460 u->tmp_protocol = u->protocol; |
486 if (u) u->tmp_protocol = u->protocol; | 461 else |
487 else tmpusr.tmp_protocol = tmpusr.protocol; | 462 tmpusr.tmp_protocol = tmpusr.protocol; |
488 generate_options(u, frame); | 463 generate_general_options(u, book); |
464 generate_prpl_options(u, book); | |
489 | 465 |
490 hbox = gtk_hbox_new(FALSE, 5); | 466 hbox = gtk_hbox_new(FALSE, 5); |
491 gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 5); | 467 gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0); |
492 gtk_widget_show(hbox); | |
493 | 468 |
494 button = picture_button(mod, _("Cancel"), cancel_xpm); | 469 button = picture_button(mod, _("Cancel"), cancel_xpm); |
495 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5); | 470 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); |
496 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(cancel_mod), u); | 471 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(cancel_mod), u); |
497 gtk_widget_show(button); | |
498 | 472 |
499 button = picture_button(mod, _("OK"), ok_xpm); | 473 button = picture_button(mod, _("OK"), ok_xpm); |
500 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5); | 474 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); |
501 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(ok_mod), u); | 475 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(ok_mod), u); |
502 gtk_widget_show(button); | |
503 | 476 |
504 if (u) { | 477 if (u) { |
505 u->mod = mod; | 478 u->mod = mod; |
506 u->main = frame; /* ha, get it? :) */ | 479 u->main = book; /* sorry, i think i broke the joke :) */ |
507 u->tmp_options = u->options; | 480 u->tmp_options = u->options; |
508 } else { | 481 } else { |
509 newmod = mod; | 482 newmod = mod; |
510 newmain = frame; | 483 newmain = book; |
511 } | 484 } |
512 | 485 |
513 gtk_widget_show(mod); | 486 gtk_widget_show_all(mod); |
514 } | 487 } |
515 | 488 |
516 static void add_acct(GtkWidget *w, gpointer d) | 489 static void add_acct(GtkWidget *w, gpointer d) |
517 { | 490 { |
518 show_acct_mod(NULL); | 491 show_acct_mod(NULL); |
563 GtkWidget *hbox; | 536 GtkWidget *hbox; |
564 char buf[96]; | 537 char buf[96]; |
565 GtkWidget *label; | 538 GtkWidget *label; |
566 GtkWidget *button; | 539 GtkWidget *button; |
567 | 540 |
568 if (u->passprmt) { gtk_widget_show(u->passprmt); return; } | 541 if (u->passprmt) { |
542 gtk_widget_show(u->passprmt); | |
543 return; | |
544 } | |
569 u->passprmt = gtk_window_new(GTK_WINDOW_DIALOG); | 545 u->passprmt = gtk_window_new(GTK_WINDOW_DIALOG); |
570 gtk_window_set_wmclass(GTK_WINDOW(u->passprmt), "password", "Gaim"); | 546 gtk_window_set_wmclass(GTK_WINDOW(u->passprmt), "password", "Gaim"); |
571 gtk_container_border_width(GTK_CONTAINER(u->passprmt), 5); | 547 gtk_container_border_width(GTK_CONTAINER(u->passprmt), 5); |
572 gtk_signal_connect(GTK_OBJECT(u->passprmt), "destroy", GTK_SIGNAL_FUNC(pass_des), u); | 548 gtk_signal_connect(GTK_OBJECT(u->passprmt), "destroy", GTK_SIGNAL_FUNC(pass_des), u); |
573 gtk_widget_realize(u->passprmt); | 549 gtk_widget_realize(u->passprmt); |
633 } else { | 609 } else { |
634 signoff(u->gc); | 610 signoff(u->gc); |
635 } | 611 } |
636 } | 612 } |
637 } | 613 } |
638 | 614 |
639 static void del_acct(GtkWidget *w, gpointer d) | 615 static void del_acct(GtkWidget *w, gpointer d) |
640 { | 616 { |
641 int row = -1; | 617 int row = -1; |
642 struct aim_user *u; | 618 struct aim_user *u; |
643 if (GTK_CLIST(list)->selection) | 619 if (GTK_CLIST(list)->selection) |
655 } | 631 } |
656 | 632 |
657 void account_editor(GtkWidget *w, GtkWidget *W) | 633 void account_editor(GtkWidget *w, GtkWidget *W) |
658 { | 634 { |
659 /* please kill me */ | 635 /* please kill me */ |
660 GtkWidget *frame; | 636 GtkWidget *vbox; |
661 GtkWidget *box; | 637 GtkWidget *hbox; |
662 GtkWidget *list; | 638 GtkWidget *list; |
663 GtkWidget *hbox; | 639 GtkWidget *button; /* used for many things */ |
664 GtkWidget *button; /* used for many things */ | 640 |
665 | 641 if (acctedit) { |
666 if (acctedit) { gtk_widget_show(acctedit); return; } | 642 gtk_widget_show(acctedit); |
643 return; | |
644 } | |
667 | 645 |
668 acctedit = gtk_window_new(GTK_WINDOW_TOPLEVEL); | 646 acctedit = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
669 gtk_window_set_title(GTK_WINDOW(acctedit), _("Gaim - Account Editor")); | 647 gtk_window_set_title(GTK_WINDOW(acctedit), _("Gaim - Account Editor")); |
670 gtk_window_set_wmclass(GTK_WINDOW(acctedit), "accounteditor", "Gaim"); | 648 gtk_window_set_wmclass(GTK_WINDOW(acctedit), "accounteditor", "Gaim"); |
671 gtk_widget_realize(acctedit); | 649 gtk_widget_realize(acctedit); |
672 aol_icon(acctedit->window); | 650 aol_icon(acctedit->window); |
673 gtk_container_border_width(GTK_CONTAINER(acctedit), 10); | |
674 gtk_widget_set_usize(acctedit, -1, 200); | 651 gtk_widget_set_usize(acctedit, -1, 200); |
675 gtk_signal_connect(GTK_OBJECT(acctedit), "destroy", | 652 gtk_signal_connect(GTK_OBJECT(acctedit), "destroy", GTK_SIGNAL_FUNC(delete_acctedit), W); |
676 GTK_SIGNAL_FUNC(delete_acctedit), W); | 653 |
677 | 654 vbox = gtk_vbox_new(FALSE, 5); |
678 frame = gtk_frame_new(_("Account Editor")); | 655 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
679 gtk_container_add(GTK_CONTAINER(acctedit), frame); | 656 gtk_container_add(GTK_CONTAINER(acctedit), vbox); |
680 gtk_widget_show(frame); | |
681 | |
682 box = gtk_vbox_new(FALSE, 5); | |
683 gtk_container_add(GTK_CONTAINER(frame), box); | |
684 gtk_widget_show(box); | |
685 | 657 |
686 list = generate_list(); | 658 list = generate_list(); |
687 gtk_box_pack_start(GTK_BOX(box), list, TRUE, TRUE, 5); | 659 gtk_box_pack_start(GTK_BOX(vbox), list, TRUE, TRUE, 0); |
688 | 660 |
689 hbox = gtk_hbox_new(TRUE, 5); | 661 hbox = gtk_hbox_new(TRUE, 5); |
690 gtk_box_pack_end(GTK_BOX(box), hbox, FALSE, FALSE, 5); | 662 gtk_box_pack_end(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
691 gtk_widget_show(hbox); | |
692 | 663 |
693 button = picture_button(acctedit, _("Add"), gnome_add_xpm); | 664 button = picture_button(acctedit, _("Add"), gnome_add_xpm); |
694 gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 5); | 665 gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); |
695 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(add_acct), NULL); | 666 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(add_acct), NULL); |
696 | 667 |
697 button = picture_button(acctedit, _("Modify"), gnome_preferences_xpm); | 668 button = picture_button(acctedit, _("Modify"), gnome_preferences_xpm); |
698 gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 5); | 669 gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); |
699 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(mod_acct), NULL); | 670 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(mod_acct), NULL); |
700 | 671 |
701 button = picture_button(acctedit, _("Sign On/Off"), join_xpm); | 672 button = picture_button(acctedit, _("Sign On/Off"), join_xpm); |
702 gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 5); | 673 gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); |
703 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(acct_signin), NULL); | 674 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(acct_signin), NULL); |
704 | 675 |
705 button = picture_button(acctedit, _("Delete"), gnome_remove_xpm); | 676 button = picture_button(acctedit, _("Delete"), gnome_remove_xpm); |
706 gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 5); | 677 gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); |
707 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(del_acct), NULL); | 678 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(del_acct), NULL); |
708 | 679 |
709 button = picture_button(acctedit, _("Close"), gnome_close_xpm); | 680 button = picture_button(acctedit, _("Close"), gnome_close_xpm); |
710 gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 5); | 681 gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); |
711 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(acctedit_close), W); | 682 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(acctedit_close), W); |
712 | 683 |
713 gtk_widget_show(acctedit); | 684 gtk_widget_show_all(acctedit); |
714 } | 685 } |
715 | 686 |
716 void account_online(struct gaim_connection *gc) | 687 void account_online(struct gaim_connection *gc) |
717 { | 688 { |
718 int i; | 689 int i; |
719 | 690 |
720 /* first we hide the login progress meter */ | 691 /* first we hide the login progress meter */ |
721 if (gc->meter) | 692 if (gc->meter) |
722 gtk_widget_destroy(gc->meter); | 693 gtk_widget_destroy(gc->meter); |
723 gc->meter = NULL; | 694 gc->meter = NULL; |
724 | 695 |
725 /* then we do the buddy list stuff */ | 696 /* then we do the buddy list stuff */ |
726 if (mainwindow) | 697 if (mainwindow) |
727 gtk_widget_hide(mainwindow); | 698 gtk_widget_hide(mainwindow); |
728 show_buddy_list(); | 699 show_buddy_list(); |
729 | 700 |
730 #ifdef USE_APPLET | 701 #ifdef USE_APPLET |
731 if (general_options & OPT_GEN_APP_BUDDY_SHOW) { | 702 if (general_options & OPT_GEN_APP_BUDDY_SHOW) { |
732 refresh_buddy_window(); | 703 refresh_buddy_window(); |
733 createOnlinePopup(); | 704 createOnlinePopup(); |
734 applet_buddy_show = TRUE; | 705 applet_buddy_show = TRUE; |
747 gaim_setup(gc); | 718 gaim_setup(gc); |
748 | 719 |
749 plugin_event(event_signon, gc, 0, 0, 0); | 720 plugin_event(event_signon, gc, 0, 0, 0); |
750 | 721 |
751 /* everything for the account editor */ | 722 /* everything for the account editor */ |
752 if (!acctedit) return; | 723 if (!acctedit) |
724 return; | |
753 i = gtk_clist_find_row_from_data(GTK_CLIST(list), gc->user); | 725 i = gtk_clist_find_row_from_data(GTK_CLIST(list), gc->user); |
754 gtk_clist_set_text(GTK_CLIST(list), i, 1, "Yes"); | 726 gtk_clist_set_text(GTK_CLIST(list), i, 1, "Yes"); |
755 gtk_clist_set_text(GTK_CLIST(list), i, 3, proto_name(gc->protocol)); | 727 gtk_clist_set_text(GTK_CLIST(list), i, 3, proto_name(gc->protocol)); |
756 | 728 |
757 return; | 729 return; |
761 { | 733 { |
762 int i; | 734 int i; |
763 if (gc->meter) | 735 if (gc->meter) |
764 gtk_widget_destroy(gc->meter); | 736 gtk_widget_destroy(gc->meter); |
765 gc->meter = NULL; | 737 gc->meter = NULL; |
766 gc->user->gc = NULL; /* wasn't that awkward? */ | 738 gc->user->gc = NULL; /* wasn't that awkward? */ |
767 if (!acctedit) return; | 739 if (!acctedit) |
740 return; | |
768 i = gtk_clist_find_row_from_data(GTK_CLIST(list), gc->user); | 741 i = gtk_clist_find_row_from_data(GTK_CLIST(list), gc->user); |
769 gtk_clist_set_text(GTK_CLIST(list), i, 1, "No"); | 742 gtk_clist_set_text(GTK_CLIST(list), i, 1, "No"); |
770 redo_convo_menus(); | 743 redo_convo_menus(); |
771 } | 744 } |
772 | 745 |
785 } | 758 } |
786 u = u->next; | 759 u = u->next; |
787 } | 760 } |
788 } | 761 } |
789 | 762 |
790 static void cancel_signon(GtkWidget *button, struct gaim_connection *gc) { | 763 static void cancel_signon(GtkWidget *button, struct gaim_connection *gc) |
764 { | |
791 signoff(gc); | 765 signoff(gc); |
792 } | 766 } |
793 | 767 |
794 static gint meter_destroy(GtkWidget *meter, GdkEvent *evt, struct gaim_connection *gc) { | 768 static gint meter_destroy(GtkWidget *meter, GdkEvent *evt, struct gaim_connection *gc) |
769 { | |
795 return TRUE; | 770 return TRUE; |
796 } | 771 } |
797 | 772 |
798 void set_login_progress(struct gaim_connection *gc, float howfar, char *message) { | 773 void set_login_progress(struct gaim_connection *gc, float howfar, char *message) |
774 { | |
799 if (mainwindow) | 775 if (mainwindow) |
800 gtk_widget_hide(mainwindow); | 776 gtk_widget_hide(mainwindow); |
801 | 777 |
802 if (!gc->meter) { | 778 if (!gc->meter) { |
803 GtkWidget *box, *label, *button; | 779 GtkWidget *box, *label, *button; |