Mercurial > pidgin
comparison src/multi.c @ 3754:599194293ee5
[gaim-migrate @ 3893]
ChipX86 is writing UI out the wazoo!
committer: Tailor Script <tailor@pidgin.im>
| author | Sean Egan <seanegan@gmail.com> |
|---|---|
| date | Sat, 19 Oct 2002 22:15:55 +0000 |
| parents | a20bf3d247ff |
| children | a868e1181321 |
comparison
equal
deleted
inserted
replaced
| 3753:764ecb5f984b | 3754:599194293ee5 |
|---|---|
| 41 | 41 |
| 42 GSList *connections; | 42 GSList *connections; |
| 43 int connecting_count = 0; | 43 int connecting_count = 0; |
| 44 | 44 |
| 45 static GtkWidget *acctedit = NULL; | 45 static GtkWidget *acctedit = NULL; |
| 46 static GtkWidget *list = NULL; /* the clist of names in the accteditor */ | 46 static GtkWidget *treeview = NULL; /* the treeview of names in the accteditor */ |
| 47 static GtkListStore *model = NULL; | |
| 47 | 48 |
| 48 static GSList *mod_users = NULL; | 49 static GSList *mod_users = NULL; |
| 50 | |
| 51 enum | |
| 52 { | |
| 53 COLUMN_SCREENNAME, | |
| 54 COLUMN_ONLINE, | |
| 55 COLUMN_AUTOLOGIN, | |
| 56 COLUMN_PROTOCOL, | |
| 57 COLUMN_DATA, | |
| 58 NUM_COLUMNS | |
| 59 }; | |
| 60 | |
| 61 static void acct_signin(GtkCellRendererToggle *cell, gchar *path_str, | |
| 62 gpointer d); | |
| 63 static void acct_autologin(GtkCellRendererToggle *cell, gchar *path_str, | |
| 64 gpointer d); | |
| 49 | 65 |
| 50 static struct mod_user *find_mod_user(struct aim_user *a) | 66 static struct mod_user *find_mod_user(struct aim_user *a) |
| 51 { | 67 { |
| 52 GSList *m = mod_users; | 68 GSList *m = mod_users; |
| 53 while (m) { | 69 while (m) { |
| 136 if (acctedit) { | 152 if (acctedit) { |
| 137 save_prefs(); | 153 save_prefs(); |
| 138 gtk_widget_destroy(acctedit); | 154 gtk_widget_destroy(acctedit); |
| 139 } | 155 } |
| 140 acctedit = NULL; | 156 acctedit = NULL; |
| 141 list = NULL; | 157 treeview = NULL; |
| 142 if (!d && !blist && !mainwindow && !connections) | 158 if (!d && !blist && !mainwindow && !connections) |
| 143 gtk_main_quit(); | 159 gtk_main_quit(); |
| 144 } | 160 } |
| 145 | 161 |
| 146 static gint acctedit_close(GtkWidget *w, gpointer d) | 162 static gint acctedit_close(GtkWidget *w, gpointer d) |
| 158 return p->name; | 174 return p->name; |
| 159 else | 175 else |
| 160 return "Unknown"; | 176 return "Unknown"; |
| 161 } | 177 } |
| 162 | 178 |
| 163 | |
| 164 static void reorder_list(GtkCList *cl, int from, int to, void *p) | |
| 165 { | |
| 166 struct aim_user *au; | |
| 167 if (from == to) | |
| 168 return; /* This shouldn't happen, but just in case */ | |
| 169 au = (struct aim_user*)g_slist_nth_data(aim_users, from); | |
| 170 aim_users = g_slist_remove (aim_users, au); | |
| 171 aim_users = g_slist_insert(aim_users, au, to); | |
| 172 save_prefs(); | |
| 173 } | |
| 174 | |
| 175 void regenerate_user_list() | 179 void regenerate_user_list() |
| 176 { | 180 { |
| 177 char *titles[4]; | |
| 178 GSList *u = aim_users; | 181 GSList *u = aim_users; |
| 179 struct aim_user *a; | 182 struct aim_user *a; |
| 180 int i; | 183 GtkTreeIter iter; |
| 181 | 184 |
| 182 if (!acctedit) | 185 if (!acctedit) |
| 183 return; | 186 return; |
| 184 | 187 |
| 185 gtk_clist_clear(GTK_CLIST(list)); | 188 gtk_list_store_clear(model); |
| 186 | 189 |
| 187 while (u) { | 190 while (u) { |
| 188 a = (struct aim_user *)u->data; | 191 a = (struct aim_user *)u->data; |
| 189 titles[0] = a->username; | 192 |
| 190 titles[1] = a->gc ? "Yes" : "No"; | 193 gtk_list_store_append(model, &iter); |
| 191 titles[2] = (a->options & OPT_USR_AUTO) ? "True" : "False"; | 194 gtk_list_store_set(model, &iter, |
| 192 titles[3] = proto_name(a->protocol); | 195 COLUMN_SCREENNAME, a->username, |
| 193 i = gtk_clist_append(GTK_CLIST(list), titles); | 196 COLUMN_ONLINE, (a->gc ? TRUE : FALSE), |
| 194 gtk_clist_set_row_data(GTK_CLIST(list), i, a); | 197 COLUMN_AUTOLOGIN, (a->options & OPT_USR_AUTO), |
| 198 COLUMN_PROTOCOL, proto_name(a->protocol), | |
| 199 COLUMN_DATA, a, | |
| 200 -1); | |
| 195 u = u->next; | 201 u = u->next; |
| 196 } | 202 } |
| 197 } | 203 } |
| 198 | 204 |
| 205 static gboolean get_iter_from_data(GtkTreeView *treeview, | |
| 206 struct aim_user *a, GtkTreeIter *iter) | |
| 207 { | |
| 208 return gtk_tree_model_iter_nth_child(gtk_tree_view_get_model(treeview), | |
| 209 iter, NULL, | |
| 210 g_slist_index(aim_users, a)); | |
| 211 #if 0 | |
| 212 GtkListModel *model = gtk_tree_view_get_model(treeview); | |
| 213 struct aim_user *user; | |
| 214 int i; | |
| 215 | |
| 216 rows = gtk_tree_model_iter_n_children(model, NULL); | |
| 217 | |
| 218 for (i = 0; i < rows; i++) | |
| 219 { | |
| 220 gtk_tree_model_get(model, iter, COLUMN_DATA, &user, -1); | |
| 221 | |
| 222 if (user == a) | |
| 223 return TRUE; | |
| 224 } | |
| 225 | |
| 226 return FALSE; | |
| 227 #endif | |
| 228 } | |
| 229 | |
| 230 static void add_columns(GtkWidget *treeview) | |
| 231 { | |
| 232 GtkCellRenderer *renderer; | |
| 233 GtkTreeViewColumn *column; | |
| 234 | |
| 235 /* Screennames */ | |
| 236 renderer = gtk_cell_renderer_text_new(); | |
| 237 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), | |
| 238 -1, _("Screenname"), | |
| 239 renderer, | |
| 240 "text", COLUMN_SCREENNAME, | |
| 241 NULL); | |
| 242 | |
| 243 /* Online? */ | |
| 244 renderer = gtk_cell_renderer_toggle_new(); | |
| 245 g_signal_connect(G_OBJECT(renderer), "toggled", | |
| 246 G_CALLBACK(acct_signin), model); | |
| 247 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), | |
| 248 -1, _("Online"), | |
| 249 renderer, | |
| 250 "active", COLUMN_ONLINE, | |
| 251 NULL); | |
| 252 | |
| 253 /* Auto-login? */ | |
| 254 renderer = gtk_cell_renderer_toggle_new(); | |
| 255 g_signal_connect(G_OBJECT(renderer), "toggled", | |
| 256 G_CALLBACK(acct_autologin), model); | |
| 257 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), | |
| 258 -1, _("Auto-login"), | |
| 259 renderer, | |
| 260 "active", COLUMN_AUTOLOGIN, | |
| 261 NULL); | |
| 262 | |
| 263 /* Protocol */ | |
| 264 renderer = gtk_cell_renderer_text_new(); | |
| 265 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), | |
| 266 -1, _("Protocol"), | |
| 267 renderer, | |
| 268 "text", COLUMN_PROTOCOL, | |
| 269 NULL); | |
| 270 | |
| 271 /* Data */ | |
| 272 column = gtk_tree_view_column_new(); | |
| 273 // gtk_tree_view_insert_column(GTK_TREE_VIEW(treeview), column, -1); | |
| 274 gtk_tree_view_column_set_visible(column, FALSE); | |
| 275 } | |
| 276 | |
| 199 static GtkWidget *generate_list() | 277 static GtkWidget *generate_list() |
| 200 { | 278 { |
| 201 GtkWidget *win; | 279 GtkWidget *win; |
| 202 char *titles[4] = { "Screenname", "Currently Online", "Auto-login", "Protocol" }; | |
| 203 | 280 |
| 204 win = gtk_scrolled_window_new(0, 0); | 281 win = gtk_scrolled_window_new(0, 0); |
| 205 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(win), GTK_POLICY_AUTOMATIC, | 282 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(win), |
| 206 GTK_POLICY_ALWAYS); | 283 GTK_POLICY_AUTOMATIC, |
| 207 | 284 GTK_POLICY_ALWAYS); |
| 208 list = gtk_clist_new_with_titles(4, titles); | 285 |
| 209 gtk_clist_set_column_width(GTK_CLIST(list), 0, 90); | 286 /* Create the list model. */ |
| 210 gtk_clist_set_selection_mode(GTK_CLIST(list), GTK_SELECTION_EXTENDED); | 287 model = gtk_list_store_new(NUM_COLUMNS, G_TYPE_STRING, G_TYPE_BOOLEAN, |
| 211 gtk_clist_column_titles_passive(GTK_CLIST(list)); | 288 G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_POINTER); |
| 212 | 289 |
| 213 gtk_container_add(GTK_CONTAINER(win), list); | 290 treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model)); |
| 214 gtk_widget_show(list); | 291 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(treeview), TRUE); |
| 292 gtk_tree_selection_set_mode( | |
| 293 gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)), | |
| 294 GTK_SELECTION_MULTIPLE); | |
| 295 | |
| 296 add_columns(treeview); | |
| 297 | |
| 298 gtk_container_add(GTK_CONTAINER(win), treeview); | |
| 299 gtk_widget_show(treeview); | |
| 215 | 300 |
| 216 regenerate_user_list(); | 301 regenerate_user_list(); |
| 217 gtk_clist_set_reorderable (GTK_CLIST(list), TRUE); | 302 gtk_tree_view_set_reorderable (GTK_TREE_VIEW(treeview), TRUE); |
| 218 gtk_clist_set_use_drag_icons (GTK_CLIST(list), TRUE); | |
| 219 gtk_signal_connect(GTK_OBJECT(list), "row-move", GTK_SIGNAL_FUNC(reorder_list), NULL); | |
| 220 | |
| 221 gtk_widget_show(win); | 303 gtk_widget_show(win); |
| 222 return win; | 304 return win; |
| 223 } | 305 } |
| 224 | 306 |
| 225 static void delmod(GtkWidget *w, struct mod_user *u) | 307 static void delmod(GtkWidget *w, struct mod_user *u) |
| 255 | 337 |
| 256 static void ok_mod(GtkWidget *w, struct mod_user *u) | 338 static void ok_mod(GtkWidget *w, struct mod_user *u) |
| 257 { | 339 { |
| 258 GList *tmp; | 340 GList *tmp; |
| 259 const char *txt; | 341 const char *txt; |
| 260 int i; | |
| 261 struct aim_user *a; | 342 struct aim_user *a; |
| 262 struct prpl *p; | 343 struct prpl *p; |
| 344 GtkTreeIter iter; | |
| 263 | 345 |
| 264 if (!u->user) { | 346 if (!u->user) { |
| 265 txt = gtk_entry_get_text(GTK_ENTRY(u->name)); | 347 txt = gtk_entry_get_text(GTK_ENTRY(u->name)); |
| 266 u->user = new_user(txt, u->protocol, u->options); | 348 u->user = new_user(txt, u->protocol, u->options); |
| 267 } | 349 } |
| 277 if (a->options & OPT_USR_REM_PASS) | 359 if (a->options & OPT_USR_REM_PASS) |
| 278 g_snprintf(a->password, sizeof(a->password), "%s", txt); | 360 g_snprintf(a->password, sizeof(a->password), "%s", txt); |
| 279 else | 361 else |
| 280 a->password[0] = '\0'; | 362 a->password[0] = '\0'; |
| 281 | 363 |
| 364 if (get_iter_from_data(GTK_TREE_VIEW(treeview), a, &iter)) { | |
| 365 gtk_list_store_set(model, &iter, | |
| 366 COLUMN_SCREENNAME, a->username, | |
| 367 COLUMN_AUTOLOGIN, (a->options & OPT_USR_AUTO), | |
| 368 COLUMN_PROTOCOL, proto_name(a->protocol), | |
| 369 -1); | |
| 370 } | |
| 371 | |
| 372 #if 0 | |
| 282 i = gtk_clist_find_row_from_data(GTK_CLIST(list), a); | 373 i = gtk_clist_find_row_from_data(GTK_CLIST(list), a); |
| 283 gtk_clist_set_text(GTK_CLIST(list), i, 0, a->username); | 374 gtk_clist_set_text(GTK_CLIST(list), i, 0, a->username); |
| 284 gtk_clist_set_text(GTK_CLIST(list), i, 2, | 375 gtk_clist_set_text(GTK_CLIST(list), i, 2, |
| 285 (a->options & OPT_USR_AUTO) ? "True" : "False"); | 376 (a->options & OPT_USR_AUTO) ? "True" : "False"); |
| 286 gtk_clist_set_text(GTK_CLIST(list), i, 3, proto_name(a->protocol)); | 377 gtk_clist_set_text(GTK_CLIST(list), i, 3, proto_name(a->protocol)); |
| 378 #endif | |
| 287 | 379 |
| 288 tmp = u->opt_entries; | 380 tmp = u->opt_entries; |
| 289 while (tmp) { | 381 while (tmp) { |
| 290 GtkEntry *entry = tmp->data; | 382 GtkEntry *entry = tmp->data; |
| 291 int pos = (int)gtk_object_get_user_data(GTK_OBJECT(entry)); | 383 int pos = (int)gtk_object_get_user_data(GTK_OBJECT(entry)); |
| 489 hbox = gtk_hbox_new(FALSE, 0); | 581 hbox = gtk_hbox_new(FALSE, 0); |
| 490 gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 5); | 582 gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 5); |
| 491 gtk_widget_show(hbox); | 583 gtk_widget_show(hbox); |
| 492 | 584 |
| 493 label = gtk_label_new(_("Buddy Icon File:")); | 585 label = gtk_label_new(_("Buddy Icon File:")); |
| 586 gtk_size_group_add_widget(u->sg, label); | |
| 587 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 494 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | 588 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
| 495 gtk_widget_show(label); | 589 gtk_widget_show(label); |
| 496 | 590 |
| 497 name = gtk_entry_new(); | 591 name = gtk_entry_new(); |
| 498 gtk_entry_set_text(GTK_ENTRY(name), u->iconfile); | 592 gtk_entry_set_text(GTK_ENTRY(name), u->iconfile); |
| 521 GtkWidget *hbox; | 615 GtkWidget *hbox; |
| 522 GtkWidget *label; | 616 GtkWidget *label; |
| 523 | 617 |
| 524 struct prpl *p; | 618 struct prpl *p; |
| 525 | 619 |
| 526 frame = gtk_frame_new("Login Options"); | 620 frame = make_frame(box, _("Login Options")); |
| 527 gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 0); | |
| 528 | 621 |
| 529 vbox = gtk_vbox_new(FALSE, 5); | 622 vbox = gtk_vbox_new(FALSE, 5); |
| 530 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); | 623 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
| 531 gtk_container_add(GTK_CONTAINER(frame), vbox); | 624 gtk_container_add(GTK_CONTAINER(frame), vbox); |
| 532 | 625 |
| 533 hbox = gtk_hbox_new(FALSE, 5); | 626 hbox = gtk_hbox_new(FALSE, 5); |
| 534 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | 627 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 535 | 628 |
| 536 label = gtk_label_new(_("Screenname:")); | 629 label = gtk_label_new(_("Screenname:")); |
| 630 gtk_size_group_add_widget(u->sg, label); | |
| 631 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 537 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | 632 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
| 538 | 633 |
| 539 u->name = gtk_entry_new(); | 634 u->name = gtk_entry_new(); |
| 540 gtk_box_pack_start(GTK_BOX(hbox), u->name, TRUE, TRUE, 0); | 635 gtk_box_pack_start(GTK_BOX(hbox), u->name, TRUE, TRUE, 0); |
| 541 | 636 |
| 542 u->pwdbox = gtk_hbox_new(FALSE, 5); | 637 u->pwdbox = gtk_hbox_new(FALSE, 5); |
| 543 gtk_box_pack_start(GTK_BOX(vbox), u->pwdbox, FALSE, FALSE, 0); | 638 gtk_box_pack_start(GTK_BOX(vbox), u->pwdbox, FALSE, FALSE, 0); |
| 544 | 639 |
| 545 label = gtk_label_new(_("Password:")); | 640 label = gtk_label_new(_("Password:")); |
| 641 gtk_size_group_add_widget(u->sg, label); | |
| 642 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 546 gtk_box_pack_start(GTK_BOX(u->pwdbox), label, FALSE, FALSE, 0); | 643 gtk_box_pack_start(GTK_BOX(u->pwdbox), label, FALSE, FALSE, 0); |
| 547 | 644 |
| 548 u->pass = gtk_entry_new(); | 645 u->pass = gtk_entry_new(); |
| 549 gtk_box_pack_start(GTK_BOX(u->pwdbox), u->pass, TRUE, TRUE, 0); | 646 gtk_box_pack_start(GTK_BOX(u->pwdbox), u->pass, TRUE, TRUE, 0); |
| 550 gtk_entry_set_visibility(GTK_ENTRY(u->pass), FALSE); | 647 gtk_entry_set_visibility(GTK_ENTRY(u->pass), FALSE); |
| 551 | 648 |
| 552 hbox = gtk_hbox_new(FALSE, 5); | 649 hbox = gtk_hbox_new(FALSE, 5); |
| 553 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | 650 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 554 | 651 |
| 555 label = gtk_label_new(_("Alias:")); | 652 label = gtk_label_new(_("Alias:")); |
| 653 gtk_size_group_add_widget(u->sg, label); | |
| 654 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 556 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | 655 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
| 557 | 656 |
| 558 u->alias = gtk_entry_new(); | 657 u->alias = gtk_entry_new(); |
| 559 gtk_box_pack_start(GTK_BOX(hbox), u->alias, TRUE, TRUE, 0); | 658 gtk_box_pack_start(GTK_BOX(hbox), u->alias, TRUE, TRUE, 0); |
| 560 | 659 |
| 561 hbox = gtk_hbox_new(FALSE, 5); | 660 hbox = gtk_hbox_new(FALSE, 5); |
| 562 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | 661 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 563 gtk_widget_show(hbox); | 662 gtk_widget_show(hbox); |
| 564 | 663 |
| 565 label = gtk_label_new(_("Protocol:")); | 664 label = gtk_label_new(_("Protocol:")); |
| 665 gtk_size_group_add_widget(u->sg, label); | |
| 666 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 566 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | 667 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
| 567 | 668 |
| 568 make_protocol_menu(hbox, u); | 669 make_protocol_menu(hbox, u); |
| 569 | 670 |
| 570 u->rempass = acct_button(_("Remember Password"), u, OPT_USR_REM_PASS, vbox); | 671 u->rempass = acct_button(_("Remember Password"), u, OPT_USR_REM_PASS, vbox); |
| 598 | 699 |
| 599 GtkWidget *vbox; | 700 GtkWidget *vbox; |
| 600 | 701 |
| 601 struct prpl *p = find_prpl(u->protocol); | 702 struct prpl *p = find_prpl(u->protocol); |
| 602 | 703 |
| 603 u->user_frame = gtk_frame_new("User Options"); | 704 u->user_frame = make_frame(box, _("User Options")); |
| 604 gtk_box_pack_start(GTK_BOX(box), u->user_frame, FALSE, FALSE, 0); | |
| 605 gtk_widget_show(u->user_frame); | 705 gtk_widget_show(u->user_frame); |
| 606 | 706 |
| 607 vbox = gtk_vbox_new(FALSE, 5); | 707 vbox = gtk_vbox_new(FALSE, 5); |
| 608 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); | 708 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
| 609 gtk_container_add(GTK_CONTAINER(u->user_frame), vbox); | 709 gtk_container_add(GTK_CONTAINER(u->user_frame), vbox); |
| 635 | 735 |
| 636 GtkWidget *vbox; | 736 GtkWidget *vbox; |
| 637 GtkWidget *hbox; | 737 GtkWidget *hbox; |
| 638 GtkWidget *label; | 738 GtkWidget *label; |
| 639 GtkWidget *entry; | 739 GtkWidget *entry; |
| 740 GtkWidget *frame; | |
| 640 | 741 |
| 641 char buf[256]; | 742 char buf[256]; |
| 642 | 743 |
| 643 if (u->proto_frame) | 744 if (u->proto_frame) |
| 644 gtk_widget_destroy(u->proto_frame); | 745 gtk_widget_destroy(u->proto_frame); |
| 659 | 760 |
| 660 if (!op) | 761 if (!op) |
| 661 return; | 762 return; |
| 662 | 763 |
| 663 g_snprintf(buf, sizeof(buf), "%s Options", p->name); | 764 g_snprintf(buf, sizeof(buf), "%s Options", p->name); |
| 664 u->proto_frame = gtk_frame_new(buf); | 765 frame = make_frame(box, buf); |
| 665 gtk_box_pack_start(GTK_BOX(box), u->proto_frame, FALSE, FALSE, 0); | 766 |
| 666 gtk_widget_show(u->proto_frame); | 767 /* BLEH */ |
| 768 u->proto_frame = gtk_widget_get_parent(gtk_widget_get_parent(frame)); | |
| 769 gtk_widget_show_all(u->proto_frame); | |
| 667 | 770 |
| 668 vbox = gtk_vbox_new(FALSE, 5); | 771 vbox = gtk_vbox_new(FALSE, 5); |
| 669 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); | 772 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
| 670 gtk_container_add(GTK_CONTAINER(u->proto_frame), vbox); | 773 gtk_container_add(GTK_CONTAINER(frame), vbox); |
| 671 gtk_widget_show(vbox); | 774 gtk_widget_show(vbox); |
| 672 | 775 |
| 673 while (op) { | 776 while (op) { |
| 674 struct proto_user_opt *puo = op->data; | 777 struct proto_user_opt *puo = op->data; |
| 675 | 778 |
| 676 hbox = gtk_hbox_new(FALSE, 5); | 779 hbox = gtk_hbox_new(FALSE, 5); |
| 677 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | 780 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 678 gtk_widget_show(hbox); | 781 gtk_widget_show(hbox); |
| 679 | 782 |
| 680 label = gtk_label_new(puo->label); | 783 label = gtk_label_new(puo->label); |
| 784 gtk_size_group_add_widget(u->sg, label); | |
| 785 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 681 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | 786 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
| 682 gtk_widget_show(label); | 787 gtk_widget_show(label); |
| 683 | 788 |
| 684 entry = gtk_entry_new(); | 789 entry = gtk_entry_new(); |
| 685 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); | 790 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); |
| 712 * three fucking frames: | 817 * three fucking frames: |
| 713 * a fucking Login Options frame, a fucking User Options frame and a fucking | 818 * a fucking Login Options frame, a fucking User Options frame and a fucking |
| 714 * Protcol Options frame. This fucking removes the two fucking tabs, which were | 819 * Protcol Options frame. This fucking removes the two fucking tabs, which were |
| 715 * quite fucking uneccessary. Fuck. */ | 820 * quite fucking uneccessary. Fuck. */ |
| 716 /* -- SeanEgan */ | 821 /* -- SeanEgan */ |
| 717 GtkWidget *hbox; | 822 /* YEAH!! -- ChipX86 */ |
| 823 GtkWidget *hbox, *vbox; | |
| 718 GtkWidget *button; | 824 GtkWidget *button; |
| 825 GtkWidget *sep; | |
| 826 GtkSizeGroup *button_sg; | |
| 719 | 827 |
| 720 struct mod_user *u = find_mod_user(a); | 828 struct mod_user *u = find_mod_user(a); |
| 721 | 829 |
| 722 if (!u) { | 830 if (!u) { |
| 723 u = g_new0(struct mod_user, 1); | 831 u = g_new0(struct mod_user, 1); |
| 756 gtk_widget_realize(u->mod); | 864 gtk_widget_realize(u->mod); |
| 757 gtk_window_set_title(GTK_WINDOW(u->mod), _("Gaim - Modify Account")); | 865 gtk_window_set_title(GTK_WINDOW(u->mod), _("Gaim - Modify Account")); |
| 758 gtk_window_set_policy(GTK_WINDOW(u->mod), FALSE, TRUE, TRUE); /* nothing odd here :) */ | 866 gtk_window_set_policy(GTK_WINDOW(u->mod), FALSE, TRUE, TRUE); /* nothing odd here :) */ |
| 759 gtk_signal_connect(GTK_OBJECT(u->mod), "destroy", GTK_SIGNAL_FUNC(delmod), u); | 867 gtk_signal_connect(GTK_OBJECT(u->mod), "destroy", GTK_SIGNAL_FUNC(delmod), u); |
| 760 | 868 |
| 761 u->main = gtk_vbox_new(FALSE, 5); | 869 vbox = gtk_vbox_new(FALSE, 6); |
| 762 gtk_container_border_width(GTK_CONTAINER(u->main), 5); | 870 gtk_container_border_width(GTK_CONTAINER(vbox), 6); |
| 763 gtk_container_add(GTK_CONTAINER(u->mod), u->main); | 871 gtk_container_add(GTK_CONTAINER(u->mod), vbox); |
| 764 gtk_widget_show(u->main); | 872 |
| 873 u->main = gtk_vbox_new(FALSE, 12); | |
| 874 gtk_container_border_width(GTK_CONTAINER(u->main), 6); | |
| 875 gtk_box_pack_start(GTK_BOX(vbox), u->main, FALSE, FALSE, 0); | |
| 876 | |
| 877 u->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
| 765 | 878 |
| 766 generate_login_options(u, u->main); | 879 generate_login_options(u, u->main); |
| 767 generate_user_options(u, u->main); | 880 generate_user_options(u, u->main); |
| 768 generate_protocol_options(u, u->main); | 881 generate_protocol_options(u, u->main); |
| 769 | 882 |
| 770 hbox = gtk_hbox_new(FALSE, 5); | 883 sep = gtk_hseparator_new(); |
| 771 gtk_box_pack_end(GTK_BOX(u->main), hbox, FALSE, FALSE, 0); | 884 gtk_box_pack_start (GTK_BOX (vbox), sep, FALSE, FALSE, 0); |
| 772 gtk_widget_show(hbox); | 885 |
| 773 | 886 hbox = gtk_hbox_new(FALSE, 6); |
| 774 button = picture_button(u->mod, _("Cancel"), cancel_xpm); | 887 gtk_container_set_border_width (GTK_CONTAINER (hbox), 6); |
| 888 gtk_box_pack_end(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
| 889 | |
| 890 button_sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); | |
| 891 | |
| 892 button = gtk_button_new_from_stock(GTK_STOCK_OK); | |
| 893 gtk_size_group_add_widget(button_sg, button); | |
| 894 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
| 895 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(ok_mod), u); | |
| 896 | |
| 897 button = gtk_button_new_from_stock(GTK_STOCK_CANCEL); | |
| 898 gtk_size_group_add_widget(button_sg, button); | |
| 775 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); | 899 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); |
| 776 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(cancel_mod), u); | 900 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(cancel_mod), u); |
| 777 gtk_widget_show(button); | 901 |
| 778 | 902 gtk_widget_show_all(u->mod); |
| 779 button = picture_button(u->mod, _("OK"), ok_xpm); | |
| 780 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
| 781 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(ok_mod), u); | |
| 782 gtk_widget_show(button); | |
| 783 | |
| 784 gtk_widget_show(u->mod); | |
| 785 } | 903 } |
| 786 | 904 |
| 787 static void add_acct(GtkWidget *w, gpointer d) | 905 static void add_acct(GtkWidget *w, gpointer d) |
| 788 { | 906 { |
| 789 show_acct_mod(NULL); | 907 show_acct_mod(NULL); |
| 790 } | 908 } |
| 791 | 909 |
| 910 static void mod_acct_func(GtkTreeModel *model, GtkTreePath *path, | |
| 911 GtkTreeIter *iter, gpointer data) | |
| 912 { | |
| 913 struct aim_user *u; | |
| 914 | |
| 915 gtk_tree_model_get(model, iter, COLUMN_DATA, &u, -1); | |
| 916 | |
| 917 if (u != NULL) | |
| 918 show_acct_mod(u); | |
| 919 } | |
| 920 | |
| 792 static void mod_acct(GtkWidget *w, gpointer d) | 921 static void mod_acct(GtkWidget *w, gpointer d) |
| 793 { | 922 { |
| 794 GList *l = GTK_CLIST(list)->selection; | 923 GtkTreeSelection *selection; |
| 795 int row = -1; | 924 GtkTreeIter iter; |
| 796 struct aim_user *u; | 925 GtkTreeModel *model; |
| 926 | |
| 927 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)); | |
| 928 | |
| 929 gtk_tree_selection_selected_foreach(selection, mod_acct_func, NULL); | |
| 930 | |
| 931 #if 0 | |
| 797 while (l) { | 932 while (l) { |
| 798 row = (int)l->data; | 933 row = (int)l->data; |
| 799 if (row != -1) { | 934 if (row != -1) { |
| 800 u = g_slist_nth_data(aim_users, row); | 935 u = g_slist_nth_data(aim_users, row); |
| 801 if (u) | 936 if (u) |
| 802 show_acct_mod(u); | 937 show_acct_mod(u); |
| 803 } | 938 } |
| 804 l = l->next; | 939 l = l->next; |
| 805 } | 940 } |
| 941 #endif | |
| 806 } | 942 } |
| 807 | 943 |
| 808 struct pass_prompt { | 944 struct pass_prompt { |
| 809 struct aim_user *u; | 945 struct aim_user *u; |
| 810 GtkWidget *win; | 946 GtkWidget *win; |
| 867 gtk_window_set_wmclass(GTK_WINDOW(p->win), "password", "Gaim"); | 1003 gtk_window_set_wmclass(GTK_WINDOW(p->win), "password", "Gaim"); |
| 868 gtk_container_border_width(GTK_CONTAINER(p->win), 5); | 1004 gtk_container_border_width(GTK_CONTAINER(p->win), 5); |
| 869 gtk_signal_connect(GTK_OBJECT(p->win), "destroy", GTK_SIGNAL_FUNC(pass_des), p); | 1005 gtk_signal_connect(GTK_OBJECT(p->win), "destroy", GTK_SIGNAL_FUNC(pass_des), p); |
| 870 gtk_widget_realize(p->win); | 1006 gtk_widget_realize(p->win); |
| 871 | 1007 |
| 872 frame = gtk_frame_new(_("Enter Password")); | 1008 frame = make_frame(p->win, _("Enter Password")); |
| 873 gtk_container_add(GTK_CONTAINER(p->win), frame); | |
| 874 gtk_widget_show(frame); | 1009 gtk_widget_show(frame); |
| 875 | 1010 |
| 876 vbox = gtk_vbox_new(FALSE, 5); | 1011 vbox = gtk_vbox_new(FALSE, 5); |
| 877 gtk_container_add(GTK_CONTAINER(frame), vbox); | 1012 gtk_container_add(GTK_CONTAINER(frame), vbox); |
| 878 gtk_widget_show(vbox); | 1013 gtk_widget_show(vbox); |
| 906 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5); | 1041 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5); |
| 907 | 1042 |
| 908 gtk_widget_show(p->win); | 1043 gtk_widget_show(p->win); |
| 909 } | 1044 } |
| 910 | 1045 |
| 911 static void acct_signin(GtkWidget *w, gpointer d) | 1046 static void acct_signin(GtkCellRendererToggle *cell, gchar *path_str, |
| 912 { | 1047 gpointer d) |
| 913 GList *l = GTK_CLIST(list)->selection; | 1048 { |
| 914 int row = -1; | 1049 GtkTreeModel *model = (GtkTreeModel *)d; |
| 1050 GtkTreeIter iter; | |
| 1051 GtkTreePath *path = gtk_tree_path_new_from_string(path_str); | |
| 1052 | |
| 915 struct aim_user *u = NULL; | 1053 struct aim_user *u = NULL; |
| 916 struct prpl *p = NULL; | 1054 struct prpl *p = NULL; |
| 917 while (l) { | 1055 |
| 918 row = (int)l->data; | 1056 gtk_tree_model_get_iter_from_string(model, &iter, path_str); |
| 919 u = g_slist_nth_data(aim_users, row); | 1057 gtk_tree_model_get(model, &iter, COLUMN_DATA, &u, -1); |
| 920 p = find_prpl(u->protocol); | 1058 |
| 921 if (!u->gc && p && p->login) { | 1059 p = find_prpl(u->protocol); |
| 922 struct prpl *p = find_prpl(u->protocol); | 1060 if (!u->gc && p && p->login) { |
| 923 if (p && !(p->options & OPT_PROTO_NO_PASSWORD) && !u->password[0]) { | 1061 struct prpl *p = find_prpl(u->protocol); |
| 924 do_pass_dlg(u); | 1062 if (p && !(p->options & OPT_PROTO_NO_PASSWORD) && !u->password[0]) { |
| 925 } else { | 1063 do_pass_dlg(u); |
| 926 serv_login(u); | |
| 927 gtk_clist_set_text(GTK_CLIST(list), row, 1, "Attempting"); | |
| 928 } | |
| 929 } else if (u->gc) { | |
| 930 u->gc->wants_to_die = TRUE; | |
| 931 signoff(u->gc); | |
| 932 } else { | 1064 } else { |
| 933 if (u->protocol == PROTO_TOC) | 1065 serv_login(u); |
| 934 do_error_dialog(_("TOC not found."), | |
| 935 _("You have attempted to login an IM account using the " | |
| 936 "TOC protocol. Because this protocol is inferior to " | |
| 937 "OSCAR, it is now compiled as a plugin by default. " | |
| 938 "To login, edit this account to use OSCAR or load the " | |
| 939 "TOC plugin."), GAIM_ERROR); | |
| 940 else | |
| 941 do_error_dialog(_("Protocol not found."), | |
| 942 _("You cannot log this account in; you do not have " | |
| 943 "the protocol it uses loaded, or the protocol does " | |
| 944 "not have a login function."), GAIM_ERROR); | |
| 945 } | 1066 } |
| 946 l = l->next; | 1067 } else if (u->gc) { |
| 947 } | 1068 u->gc->wants_to_die = TRUE; |
| 948 } | 1069 signoff(u->gc); |
| 949 | 1070 } else { |
| 950 static void do_del_acct(gpointer w, struct aim_user *u) | 1071 if (u->protocol == PROTO_TOC) |
| 951 { | 1072 do_error_dialog(_("TOC not found."), |
| 1073 _("You have attempted to login an IM account using the " | |
| 1074 "TOC protocol. Because this protocol is inferior to " | |
| 1075 "OSCAR, it is now compiled as a plugin by default. " | |
| 1076 "To login, edit this account to use OSCAR or load the " | |
| 1077 "TOC plugin."), GAIM_ERROR); | |
| 1078 else | |
| 1079 do_error_dialog(_("Protocol not found."), | |
| 1080 _("You cannot log this account in; you do not have " | |
| 1081 "the protocol it uses loaded, or the protocol does " | |
| 1082 "not have a login function."), GAIM_ERROR); | |
| 1083 } | |
| 1084 } | |
| 1085 | |
| 1086 static void acct_autologin(GtkCellRendererToggle *cell, gchar *path_str, | |
| 1087 gpointer d) | |
| 1088 { | |
| 1089 GtkTreeModel *model = (GtkTreeModel *)d; | |
| 1090 GtkTreeIter iter; | |
| 1091 GtkTreePath *path = gtk_tree_path_new_from_string(path_str); | |
| 1092 | |
| 1093 struct aim_user *u = NULL; | |
| 1094 struct prpl *p = NULL; | |
| 1095 | |
| 1096 gtk_tree_model_get_iter_from_string(model, &iter, path_str); | |
| 1097 gtk_tree_model_get(model, &iter, COLUMN_DATA, &u, -1); | |
| 1098 | |
| 1099 u->options ^= OPT_USR_AUTO; | |
| 1100 | |
| 1101 gtk_list_store_set(GTK_LIST_STORE(model), &iter, | |
| 1102 COLUMN_AUTOLOGIN, (u->options & OPT_USR_AUTO), -1); | |
| 1103 | |
| 1104 save_prefs(); | |
| 1105 } | |
| 1106 | |
| 1107 static void do_del_acct(struct aim_user *u) | |
| 1108 { | |
| 1109 GtkTreeIter iter; | |
| 1110 | |
| 952 if (u->gc) { | 1111 if (u->gc) { |
| 953 u->gc->wants_to_die = TRUE; | 1112 u->gc->wants_to_die = TRUE; |
| 954 signoff(u->gc); | 1113 signoff(u->gc); |
| 955 } | 1114 } |
| 956 gtk_clist_remove(GTK_CLIST(list), g_slist_index(aim_users, u)); | 1115 |
| 1116 if (get_iter_from_data(GTK_TREE_VIEW(treeview), u, &iter)) { | |
| 1117 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); | |
| 1118 } | |
| 1119 | |
| 957 aim_users = g_slist_remove(aim_users, u); | 1120 aim_users = g_slist_remove(aim_users, u); |
| 958 save_prefs(); | 1121 save_prefs(); |
| 959 } | 1122 } |
| 960 | 1123 |
| 1124 static void del_acct_func(GtkTreeModel *model, GtkTreePath *path, | |
| 1125 GtkTreeIter *iter, gpointer data) | |
| 1126 { | |
| 1127 struct aim_user *u; | |
| 1128 | |
| 1129 gtk_tree_model_get(model, iter, COLUMN_DATA, &u, -1); | |
| 1130 | |
| 1131 if (u != NULL) { | |
| 1132 char buf[8192]; | |
| 1133 | |
| 1134 g_snprintf(buf, sizeof(buf), | |
| 1135 _("Are you sure you want to delete %s?"), u->username); | |
| 1136 do_ask_dialog(buf, NULL, u, _("Delete"), do_del_acct, _("Cancel"), NULL); | |
| 1137 } | |
| 1138 } | |
| 1139 | |
| 961 static void del_acct(GtkWidget *w, gpointer d) | 1140 static void del_acct(GtkWidget *w, gpointer d) |
| 962 { | 1141 { |
| 963 GList *l = GTK_CLIST(list)->selection; | 1142 GtkTreeSelection *selection; |
| 964 char buf[8192]; | 1143 GtkTreeIter iter; |
| 965 int row = -1; | 1144 GtkTreeModel *model; |
| 966 struct aim_user *u; | 1145 |
| 967 while (l) { | 1146 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)); |
| 968 row = (int)l->data; | 1147 |
| 969 u = g_slist_nth_data(aim_users, row); | 1148 gtk_tree_selection_selected_foreach(selection, del_acct_func, NULL); |
| 970 if (!u) | 1149 } |
| 971 return; | 1150 |
| 972 | 1151 #if 0 |
| 973 g_snprintf(buf, sizeof(buf), _("Are you sure you want to delete %s?"), u->username); | |
| 974 do_ask_dialog(buf, NULL, u, _("Delete"), do_del_acct, _("Cancel"), NULL); | |
| 975 l = l->next; | |
| 976 } | |
| 977 } | |
| 978 | |
| 979 static void sel_auto(gpointer w, gpointer d) | 1152 static void sel_auto(gpointer w, gpointer d) |
| 980 { | 1153 { |
| 981 GSList *l = aim_users; | 1154 GSList *l = aim_users; |
| 982 struct aim_user *u; | 1155 struct aim_user *u; |
| 983 int i = 0; /* faster than doing g_list_index each time */ | 1156 int i = 0; /* faster than doing g_list_index each time */ |
| 989 else | 1162 else |
| 990 gtk_clist_unselect_row(GTK_CLIST(list), i, -1); | 1163 gtk_clist_unselect_row(GTK_CLIST(list), i, -1); |
| 991 i++; | 1164 i++; |
| 992 } | 1165 } |
| 993 } | 1166 } |
| 1167 #endif | |
| 994 | 1168 |
| 995 void account_editor(GtkWidget *w, GtkWidget *W) | 1169 void account_editor(GtkWidget *w, GtkWidget *W) |
| 996 { | 1170 { |
| 997 /* please kill me */ | 1171 /* please kill me */ |
| 998 GtkWidget *vbox; | 1172 GtkWidget *vbox; |
| 999 GtkWidget *hbox; | 1173 GtkWidget *hbox; |
| 1000 GtkWidget *vbox2; | 1174 GtkWidget *vbox2; |
| 1001 GtkWidget *sw; | 1175 GtkWidget *sw; |
| 1002 GtkWidget *button; /* used for many things */ | 1176 GtkWidget *button; /* used for many things */ |
| 1177 GtkWidget *sep; | |
| 1178 GtkSizeGroup *sg; | |
| 1003 | 1179 |
| 1004 if (acctedit) { | 1180 if (acctedit) { |
| 1005 gtk_window_present(GTK_WINDOW(acctedit)); | 1181 gtk_window_present(GTK_WINDOW(acctedit)); |
| 1006 return; | 1182 return; |
| 1007 } | 1183 } |
| 1008 | 1184 |
| 1009 acctedit = gtk_window_new(GTK_WINDOW_TOPLEVEL); | 1185 acctedit = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
| 1010 gtk_window_set_title(GTK_WINDOW(acctedit), _("Gaim - Account Editor")); | 1186 gtk_window_set_title(GTK_WINDOW(acctedit), _("Gaim - Account Editor")); |
| 1011 gtk_window_set_wmclass(GTK_WINDOW(acctedit), "accounteditor", "Gaim"); | 1187 gtk_window_set_wmclass(GTK_WINDOW(acctedit), "accounteditor", "Gaim"); |
| 1012 gtk_widget_realize(acctedit); | 1188 gtk_widget_realize(acctedit); |
| 1013 gtk_widget_set_usize(acctedit, -1, 200); | 1189 gtk_widget_set_usize(acctedit, -1, 250); |
| 1190 gtk_window_set_default_size(GTK_WINDOW(acctedit), 450, 250); | |
| 1014 gtk_signal_connect(GTK_OBJECT(acctedit), "destroy", GTK_SIGNAL_FUNC(delete_acctedit), W); | 1191 gtk_signal_connect(GTK_OBJECT(acctedit), "destroy", GTK_SIGNAL_FUNC(delete_acctedit), W); |
| 1015 | 1192 |
| 1016 vbox = gtk_vbox_new(FALSE, 5); | 1193 vbox = gtk_vbox_new(FALSE, 6); |
| 1017 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); | 1194 gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); |
| 1018 gtk_container_add(GTK_CONTAINER(acctedit), vbox); | 1195 gtk_container_add(GTK_CONTAINER(acctedit), vbox); |
| 1019 | 1196 |
| 1020 hbox = gtk_hbox_new(FALSE, 5); | |
| 1021 gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0); | |
| 1022 | |
| 1023 sw = generate_list(); | 1197 sw = generate_list(); |
| 1024 | 1198 |
| 1199 hbox = gtk_hbox_new(FALSE, 6); | |
| 1200 gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 6); | |
| 1201 | |
| 1202 gtk_box_pack_start(GTK_BOX(hbox), sw, TRUE, TRUE, 6); | |
| 1203 | |
| 1204 #if 0 | |
| 1025 vbox2 = gtk_vbox_new(TRUE, 5); | 1205 vbox2 = gtk_vbox_new(TRUE, 5); |
| 1026 gtk_box_pack_start(GTK_BOX(hbox), vbox2, FALSE, FALSE, 0); | 1206 gtk_box_pack_start(GTK_BOX(hbox), vbox2, FALSE, FALSE, 0); |
| 1027 | 1207 |
| 1028 button = picture_button2(acctedit, _("Select All"), tb_refresh_xpm, 2); | 1208 button = gtk_button_new_from_stock(GTK_STOCK_REFRESH); |
| 1209 gtk_button_set_use_stock(GTK_BUTTON(button), FALSE); | |
| 1210 gtk_button_set_label(GTK_BUTTON(button), "Select All"); | |
| 1211 // button = picture_button2(acctedit, _("Select All"), tb_refresh_xpm, 2); | |
| 1029 gtk_box_pack_start(GTK_BOX(vbox2), button, TRUE, TRUE, 0); | 1212 gtk_box_pack_start(GTK_BOX(vbox2), button, TRUE, TRUE, 0); |
| 1030 gtk_signal_connect_object(GTK_OBJECT(button), "clicked", | 1213 gtk_signal_connect_object(GTK_OBJECT(button), "clicked", |
| 1031 GTK_SIGNAL_FUNC(gtk_clist_select_all), GTK_OBJECT(list)); | 1214 GTK_SIGNAL_FUNC(gtk_clist_select_all), GTK_OBJECT(list)); |
| 1032 | 1215 |
| 1033 button = picture_button2(acctedit, _("Select Autos"), tb_redo_xpm, 2); | 1216 button = gtk_button_new_from_stock(GTK_STOCK_REDO); |
| 1217 gtk_button_set_use_stock(GTK_BUTTON(button), FALSE); | |
| 1218 // gtk_button_set_label(button, "Select Autos"); | |
| 1219 // button = picture_button2(acctedit, _("Select Autos"), tb_redo_xpm, 2); | |
| 1034 gtk_box_pack_start(GTK_BOX(vbox2), button, TRUE, TRUE, 0); | 1220 gtk_box_pack_start(GTK_BOX(vbox2), button, TRUE, TRUE, 0); |
| 1035 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(sel_auto), NULL); | 1221 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(sel_auto), NULL); |
| 1036 | 1222 |
| 1037 button = picture_button2(acctedit, _("Select None"), tb_undo_xpm, 2); | 1223 button = gtk_button_new_from_stock(GTK_STOCK_UNDO); |
| 1224 gtk_button_set_use_stock(GTK_BUTTON(button), FALSE); | |
| 1225 gtk_button_set_label(GTK_BUTTON(button), "Select None"); | |
| 1226 // button = picture_button2(acctedit, _("Select None"), tb_undo_xpm, 2); | |
| 1038 gtk_box_pack_start(GTK_BOX(vbox2), button, TRUE, TRUE, 0); | 1227 gtk_box_pack_start(GTK_BOX(vbox2), button, TRUE, TRUE, 0); |
| 1039 gtk_signal_connect_object(GTK_OBJECT(button), "clicked", | 1228 gtk_signal_connect_object(GTK_OBJECT(button), "clicked", |
| 1040 GTK_SIGNAL_FUNC(gtk_clist_unselect_all), GTK_OBJECT(list)); | 1229 GTK_SIGNAL_FUNC(gtk_clist_unselect_all), GTK_OBJECT(list)); |
| 1041 | 1230 |
| 1042 gtk_box_pack_start(GTK_BOX(hbox), sw, TRUE, TRUE, 0); | 1231 #endif |
| 1043 | 1232 |
| 1044 hbox = gtk_hbox_new(TRUE, 5); | 1233 sep = gtk_hseparator_new(); |
| 1234 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); | |
| 1235 | |
| 1236 hbox = gtk_hbox_new(FALSE, 6); | |
| 1237 gtk_container_set_border_width (GTK_CONTAINER (hbox), 6); | |
| 1045 gtk_box_pack_end(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | 1238 gtk_box_pack_end(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 1046 | 1239 |
| 1047 button = picture_button(acctedit, _("Add"), gnome_add_xpm); | 1240 sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); |
| 1048 gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); | 1241 |
| 1242 button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); | |
| 1243 gtk_size_group_add_widget(sg, button); | |
| 1244 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
| 1245 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(acctedit_close), W); | |
| 1246 | |
| 1247 button = gtk_button_new_from_stock(GTK_STOCK_DELETE); | |
| 1248 gtk_size_group_add_widget(sg, button); | |
| 1249 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
| 1250 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(del_acct), NULL); | |
| 1251 | |
| 1252 button = gaim_pixbuf_button_from_stock("_Modify", GTK_STOCK_PREFERENCES, | |
| 1253 GAIM_BUTTON_HORIZONTAL); | |
| 1254 gtk_size_group_add_widget(sg, button); | |
| 1255 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
| 1256 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(mod_acct), NULL); | |
| 1257 | |
| 1258 button = gtk_button_new_from_stock(GTK_STOCK_ADD); | |
| 1259 gtk_size_group_add_widget(sg, button); | |
| 1260 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
| 1049 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(add_acct), NULL); | 1261 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(add_acct), NULL); |
| 1050 | |
| 1051 button = picture_button(acctedit, _("Modify"), gnome_preferences_xpm); | |
| 1052 gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); | |
| 1053 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(mod_acct), NULL); | |
| 1054 | |
| 1055 button = picture_button(acctedit, _("Sign On/Off"), join_xpm); | |
| 1056 gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); | |
| 1057 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(acct_signin), NULL); | |
| 1058 | |
| 1059 button = picture_button(acctedit, _("Delete"), gnome_remove_xpm); | |
| 1060 gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); | |
| 1061 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(del_acct), NULL); | |
| 1062 | |
| 1063 button = picture_button(acctedit, _("Close"), cancel_xpm); | |
| 1064 gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); | |
| 1065 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(acctedit_close), W); | |
| 1066 | 1262 |
| 1067 gtk_widget_show_all(acctedit); | 1263 gtk_widget_show_all(acctedit); |
| 1068 } | 1264 } |
| 1069 | 1265 |
| 1070 struct signon_meter { | 1266 struct signon_meter { |
| 1115 | 1311 |
| 1116 void account_online(struct gaim_connection *gc) | 1312 void account_online(struct gaim_connection *gc) |
| 1117 { | 1313 { |
| 1118 int i; | 1314 int i; |
| 1119 struct signon_meter *meter = find_signon_meter(gc); | 1315 struct signon_meter *meter = find_signon_meter(gc); |
| 1316 GtkTreeIter iter; | |
| 1120 | 1317 |
| 1121 /* first we hide the login progress meter */ | 1318 /* first we hide the login progress meter */ |
| 1122 if (meter) { | 1319 if (meter) { |
| 1123 kill_meter(meter); | 1320 kill_meter(meter); |
| 1124 meters = g_slist_remove(meters, meter); | 1321 meters = g_slist_remove(meters, meter); |
| 1158 } | 1355 } |
| 1159 | 1356 |
| 1160 /* everything for the account editor */ | 1357 /* everything for the account editor */ |
| 1161 if (!acctedit) | 1358 if (!acctedit) |
| 1162 return; | 1359 return; |
| 1163 i = gtk_clist_find_row_from_data(GTK_CLIST(list), gc->user); | 1360 |
| 1164 gtk_clist_set_text(GTK_CLIST(list), i, 1, "Yes"); | 1361 if (get_iter_from_data(GTK_TREE_VIEW(treeview), gc->user, &iter)) { |
| 1165 gtk_clist_set_text(GTK_CLIST(list), i, 3, gc->prpl->name); | 1362 gtk_list_store_set(model, &iter, |
| 1363 COLUMN_ONLINE, TRUE, | |
| 1364 COLUMN_PROTOCOL, gc->prpl->name, | |
| 1365 -1); | |
| 1366 } | |
| 1166 | 1367 |
| 1167 return; | 1368 return; |
| 1168 } | 1369 } |
| 1169 | 1370 |
| 1170 void account_offline(struct gaim_connection *gc) | 1371 void account_offline(struct gaim_connection *gc) |
| 1171 { | 1372 { |
| 1172 int i; | |
| 1173 struct signon_meter *meter = find_signon_meter(gc); | 1373 struct signon_meter *meter = find_signon_meter(gc); |
| 1374 GtkTreeIter iter; | |
| 1375 | |
| 1174 if (meter) { | 1376 if (meter) { |
| 1175 kill_meter(meter); | 1377 kill_meter(meter); |
| 1176 meters = g_slist_remove(meters, meter); | 1378 meters = g_slist_remove(meters, meter); |
| 1177 g_free(meter); | 1379 g_free(meter); |
| 1178 } | 1380 } |
| 1179 gc->user->gc = NULL; /* wasn't that awkward? */ | 1381 gc->user->gc = NULL; /* wasn't that awkward? */ |
| 1180 if (!acctedit) | 1382 if (!acctedit) |
| 1181 return; | 1383 return; |
| 1182 i = gtk_clist_find_row_from_data(GTK_CLIST(list), gc->user); | 1384 |
| 1183 gtk_clist_set_text(GTK_CLIST(list), i, 1, "No"); | 1385 if (get_iter_from_data(GTK_TREE_VIEW(treeview), gc->user, &iter)) { |
| 1386 gtk_list_store_set(model, &iter, COLUMN_ONLINE, FALSE, -1); | |
| 1387 } | |
| 1184 } | 1388 } |
| 1185 | 1389 |
| 1186 void auto_login() | 1390 void auto_login() |
| 1187 { | 1391 { |
| 1188 GSList *u = aim_users; | 1392 GSList *u = aim_users; |
| 1460 show_login(); | 1664 show_login(); |
| 1461 } | 1665 } |
| 1462 | 1666 |
| 1463 struct aim_user *new_user(const char *name, int proto, int opts) | 1667 struct aim_user *new_user(const char *name, int proto, int opts) |
| 1464 { | 1668 { |
| 1465 char *titles[4]; | |
| 1466 int i; | |
| 1467 | |
| 1468 struct aim_user *u = g_new0(struct aim_user, 1); | 1669 struct aim_user *u = g_new0(struct aim_user, 1); |
| 1469 g_snprintf(u->username, sizeof(u->username), "%s", name); | 1670 g_snprintf(u->username, sizeof(u->username), "%s", name); |
| 1470 g_snprintf(u->user_info, sizeof(u->user_info), "%s", DEFAULT_INFO); | 1671 g_snprintf(u->user_info, sizeof(u->user_info), "%s", DEFAULT_INFO); |
| 1471 u->protocol = proto; | 1672 u->protocol = proto; |
| 1472 u->options = opts; | 1673 u->options = opts; |
| 1473 aim_users = g_slist_append(aim_users, u); | 1674 aim_users = g_slist_append(aim_users, u); |
| 1474 | 1675 |
| 1475 if (list) { | 1676 if (treeview) { |
| 1476 titles[0] = u->username; | 1677 GtkTreeIter iter; |
| 1477 titles[1] = u->gc ? "Yes" : "No"; | 1678 |
| 1478 titles[2] = (u->options & OPT_USR_AUTO) ? "True" : "False"; | 1679 gtk_list_store_append(model, &iter); |
| 1479 titles[3] = proto_name(u->protocol); | 1680 gtk_list_store_set(model, &iter, |
| 1480 i = gtk_clist_append(GTK_CLIST(list), titles); | 1681 COLUMN_SCREENNAME, u->username, |
| 1481 gtk_clist_set_row_data(GTK_CLIST(list), i, u); | 1682 COLUMN_ONLINE, (u->gc ? TRUE : FALSE), |
| 1683 COLUMN_AUTOLOGIN, (u->options & OPT_USR_AUTO), | |
| 1684 COLUMN_PROTOCOL, proto_name(u->protocol), | |
| 1685 COLUMN_DATA, u, | |
| 1686 -1); | |
| 1482 } | 1687 } |
| 1483 | 1688 |
| 1484 return u; | 1689 return u; |
| 1485 } | 1690 } |
