Mercurial > pidgin.yaz
comparison pidgin/gtkaccount.c @ 17712:43a55528ff26
propagate from branch 'im.pidgin.pidgin' (head b5c55520ae8ff7186733fd82db23a6e4452976cc)
to branch 'im.pidgin.soc.2007.finchfeat' (head 93037197c5356731d62e75b4050ca7d01b1017d6)
author | Eric Polino <aluink@pidgin.im> |
---|---|
date | Mon, 04 Jun 2007 15:12:50 +0000 |
parents | 0d65b1438d99 |
children | 84c7b697adcd 38a72d6dce7f 678d78b7fa34 |
comparison
equal
deleted
inserted
replaced
17543:223a4fca43a1 | 17712:43a55528ff26 |
---|---|
182 | 182 |
183 label = gtk_label_new_with_mnemonic(text); | 183 label = gtk_label_new_with_mnemonic(text); |
184 gtk_size_group_add_widget(dialog->sg, label); | 184 gtk_size_group_add_widget(dialog->sg, label); |
185 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | 185 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
186 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | 186 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
187 gtk_label_set_mnemonic_widget(GTK_LABEL(label), widget); | |
187 gtk_widget_show(label); | 188 gtk_widget_show(label); |
188 | 189 |
189 gtk_box_pack_start(GTK_BOX(hbox), widget, TRUE, TRUE, PIDGIN_HIG_BORDER); | 190 gtk_box_pack_start(GTK_BOX(hbox), widget, TRUE, TRUE, PIDGIN_HIG_BORDER); |
190 gtk_widget_show(widget); | 191 gtk_widget_show(widget); |
191 pidgin_set_accessible_label (widget, label); | 192 pidgin_set_accessible_label (widget, label); |
386 { | 387 { |
387 GtkWidget *frame; | 388 GtkWidget *frame; |
388 GtkWidget *hbox; | 389 GtkWidget *hbox; |
389 GtkWidget *vbox; | 390 GtkWidget *vbox; |
390 GtkWidget *entry; | 391 GtkWidget *entry; |
392 GtkWidget *menu; | |
393 GtkWidget *item; | |
391 GList *user_splits; | 394 GList *user_splits; |
392 GList *l, *l2; | 395 GList *l, *l2; |
393 char *username = NULL; | 396 char *username = NULL; |
394 | 397 |
395 if (dialog->protocol_menu != NULL) | 398 if (dialog->protocol_menu != NULL) |
422 dialog->protocol_menu = pidgin_protocol_option_menu_new( | 425 dialog->protocol_menu = pidgin_protocol_option_menu_new( |
423 dialog->protocol_id, G_CALLBACK(set_account_protocol_cb), dialog); | 426 dialog->protocol_id, G_CALLBACK(set_account_protocol_cb), dialog); |
424 gtk_widget_ref(dialog->protocol_menu); | 427 gtk_widget_ref(dialog->protocol_menu); |
425 } | 428 } |
426 | 429 |
427 hbox = add_pref_box(dialog, vbox, _("Protocol:"), dialog->protocol_menu); | 430 hbox = add_pref_box(dialog, vbox, _("Pro_tocol:"), dialog->protocol_menu); |
428 g_object_set_data(G_OBJECT(dialog->protocol_menu), "container", hbox); | 431 g_object_set_data(G_OBJECT(dialog->protocol_menu), "container", hbox); |
429 | 432 |
430 gtk_widget_unref(dialog->protocol_menu); | 433 gtk_widget_unref(dialog->protocol_menu); |
431 | 434 |
432 /* Screen name */ | 435 /* Screen name */ |
433 dialog->screenname_entry = gtk_entry_new(); | 436 dialog->screenname_entry = gtk_entry_new(); |
434 | 437 #if GTK_CHECK_VERSION(2,10,0) |
435 add_pref_box(dialog, vbox, _("Screen name:"), dialog->screenname_entry); | 438 g_object_set(G_OBJECT(dialog->screenname_entry), "truncate-multiline", TRUE, NULL); |
439 #endif | |
440 | |
441 add_pref_box(dialog, vbox, _("Screen _name:"), dialog->screenname_entry); | |
436 | 442 |
437 g_signal_connect(G_OBJECT(dialog->screenname_entry), "changed", | 443 g_signal_connect(G_OBJECT(dialog->screenname_entry), "changed", |
438 G_CALLBACK(screenname_changed_cb), dialog); | 444 G_CALLBACK(screenname_changed_cb), dialog); |
439 | 445 |
440 /* Do the user split thang */ | 446 /* Do the user split thang */ |
472 l != NULL && l2 != NULL; | 478 l != NULL && l2 != NULL; |
473 l = l->prev, l2 = l2->prev) { | 479 l = l->prev, l2 = l2->prev) { |
474 | 480 |
475 GtkWidget *entry = l->data; | 481 GtkWidget *entry = l->data; |
476 PurpleAccountUserSplit *split = l2->data; | 482 PurpleAccountUserSplit *split = l2->data; |
477 const char *value = NULL; | 483 const char *value = NULL, *protocol = NULL; |
478 char *c; | 484 char *c; |
479 | 485 |
480 if (dialog->account != NULL) { | 486 if (dialog->account != NULL) { |
481 c = strrchr(username, | 487 c = strrchr(username, |
482 purple_account_user_split_get_separator(split)); | 488 purple_account_user_split_get_separator(split)); |
486 c++; | 492 c++; |
487 | 493 |
488 value = c; | 494 value = c; |
489 } | 495 } |
490 } | 496 } |
491 | |
492 if (value == NULL) | 497 if (value == NULL) |
493 value = purple_account_user_split_get_default_value(split); | 498 value = purple_account_user_split_get_default_value(split); |
499 | |
500 /* Google Talk default domain hackery! */ | |
501 menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(dialog->protocol_menu)); | |
502 item = gtk_menu_get_active(GTK_MENU(menu)); | |
503 protocol = g_object_get_data(G_OBJECT(item), "protocol"); | |
504 if (value == NULL && protocol != NULL && !strcmp(protocol, "prpl-fake") && | |
505 !strcmp(purple_account_user_split_get_text(split), _("Domain"))) | |
506 value = "gmail.com"; | |
494 | 507 |
495 if (value != NULL) | 508 if (value != NULL) |
496 gtk_entry_set_text(GTK_ENTRY(entry), value); | 509 gtk_entry_set_text(GTK_ENTRY(entry), value); |
497 } | 510 } |
498 | 511 |
505 /* Password */ | 518 /* Password */ |
506 dialog->password_entry = gtk_entry_new(); | 519 dialog->password_entry = gtk_entry_new(); |
507 gtk_entry_set_visibility(GTK_ENTRY(dialog->password_entry), FALSE); | 520 gtk_entry_set_visibility(GTK_ENTRY(dialog->password_entry), FALSE); |
508 if (gtk_entry_get_invisible_char(GTK_ENTRY(dialog->password_entry)) == '*') | 521 if (gtk_entry_get_invisible_char(GTK_ENTRY(dialog->password_entry)) == '*') |
509 gtk_entry_set_invisible_char(GTK_ENTRY(dialog->password_entry), PIDGIN_INVISIBLE_CHAR); | 522 gtk_entry_set_invisible_char(GTK_ENTRY(dialog->password_entry), PIDGIN_INVISIBLE_CHAR); |
510 dialog->password_box = add_pref_box(dialog, vbox, _("Password:"), | 523 dialog->password_box = add_pref_box(dialog, vbox, _("_Password:"), |
511 dialog->password_entry); | 524 dialog->password_entry); |
512 | 525 |
513 /* Alias */ | 526 /* Alias */ |
514 dialog->alias_entry = gtk_entry_new(); | 527 dialog->alias_entry = gtk_entry_new(); |
515 add_pref_box(dialog, vbox, _("Local alias:"), dialog->alias_entry); | 528 add_pref_box(dialog, vbox, _("Local _alias:"), dialog->alias_entry); |
516 | 529 |
517 /* Remember Password */ | 530 /* Remember Password */ |
518 dialog->remember_pass_check = | 531 dialog->remember_pass_check = |
519 gtk_check_button_new_with_label(_("Remember password")); | 532 gtk_check_button_new_with_mnemonic(_("Remember pass_word")); |
520 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->remember_pass_check), | 533 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->remember_pass_check), |
521 FALSE); | 534 FALSE); |
522 gtk_box_pack_start(GTK_BOX(vbox), dialog->remember_pass_check, | 535 gtk_box_pack_start(GTK_BOX(vbox), dialog->remember_pass_check, |
523 FALSE, FALSE, 0); | 536 FALSE, FALSE, 0); |
524 gtk_widget_show(dialog->remember_pass_check); | 537 gtk_widget_show(dialog->remember_pass_check); |
585 gtk_container_add(GTK_CONTAINER(frame), vbox); | 598 gtk_container_add(GTK_CONTAINER(frame), vbox); |
586 gtk_widget_show(vbox); | 599 gtk_widget_show(vbox); |
587 | 600 |
588 /* New mail notifications */ | 601 /* New mail notifications */ |
589 dialog->new_mail_check = | 602 dialog->new_mail_check = |
590 gtk_check_button_new_with_label(_("New mail notifications")); | 603 gtk_check_button_new_with_mnemonic(_("New _mail notifications")); |
591 gtk_box_pack_start(GTK_BOX(vbox), dialog->new_mail_check, FALSE, FALSE, 0); | 604 gtk_box_pack_start(GTK_BOX(vbox), dialog->new_mail_check, FALSE, FALSE, 0); |
592 gtk_widget_show(dialog->new_mail_check); | 605 gtk_widget_show(dialog->new_mail_check); |
593 | 606 |
594 /* Buddy icon */ | 607 /* Buddy icon */ |
595 dialog->icon_check = gtk_check_button_new_with_label(_("Use this buddy icon for this account:")); | 608 dialog->icon_check = gtk_check_button_new_with_mnemonic(_("Use this buddy _icon for this account:")); |
596 g_signal_connect(G_OBJECT(dialog->icon_check), "toggled", G_CALLBACK(icon_check_cb), dialog); | 609 g_signal_connect(G_OBJECT(dialog->icon_check), "toggled", G_CALLBACK(icon_check_cb), dialog); |
597 gtk_widget_show(dialog->icon_check); | 610 gtk_widget_show(dialog->icon_check); |
598 gtk_box_pack_start(GTK_BOX(vbox), dialog->icon_check, FALSE, FALSE, 0); | 611 gtk_box_pack_start(GTK_BOX(vbox), dialog->icon_check, FALSE, FALSE, 0); |
599 | 612 |
600 dialog->icon_hbox = hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); | 613 dialog->icon_hbox = hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
678 static void | 691 static void |
679 add_protocol_options(AccountPrefsDialog *dialog, GtkWidget *parent) | 692 add_protocol_options(AccountPrefsDialog *dialog, GtkWidget *parent) |
680 { | 693 { |
681 PurpleAccountOption *option; | 694 PurpleAccountOption *option; |
682 PurpleAccount *account; | 695 PurpleAccount *account; |
683 GtkWidget *frame, *vbox, *check, *entry, *combo; | 696 GtkWidget *frame, *vbox, *check, *entry, *combo, *menu, *item; |
684 const GList *list, *node; | 697 const GList *list, *node; |
685 gint i, idx, int_value; | 698 gint i, idx, int_value; |
686 GtkListStore *model; | 699 GtkListStore *model; |
687 GtkTreeIter iter; | 700 GtkTreeIter iter; |
688 GtkCellRenderer *renderer; | 701 GtkCellRenderer *renderer; |
689 PurpleKeyValuePair *kvp; | 702 PurpleKeyValuePair *kvp; |
690 GList *l; | 703 GList *l; |
691 char buf[1024]; | 704 char buf[1024]; |
692 char *title; | 705 char *title; |
693 const char *str_value; | 706 const char *str_value, *protocol; |
694 gboolean bool_value; | 707 gboolean bool_value; |
695 | 708 |
696 if (dialog->protocol_frame != NULL) { | 709 if (dialog->protocol_frame != NULL) { |
697 gtk_widget_destroy(dialog->protocol_frame); | 710 gtk_widget_destroy(dialog->protocol_frame); |
698 dialog->protocol_frame = NULL; | 711 dialog->protocol_frame = NULL; |
811 gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); | 824 gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); |
812 if (gtk_entry_get_invisible_char(GTK_ENTRY(entry)) == '*') | 825 if (gtk_entry_get_invisible_char(GTK_ENTRY(entry)) == '*') |
813 gtk_entry_set_invisible_char(GTK_ENTRY(entry), PIDGIN_INVISIBLE_CHAR); | 826 gtk_entry_set_invisible_char(GTK_ENTRY(entry), PIDGIN_INVISIBLE_CHAR); |
814 } | 827 } |
815 | 828 |
829 /* Google Talk default domain hackery! */ | |
830 menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(dialog->protocol_menu)); | |
831 item = gtk_menu_get_active(GTK_MENU(menu)); | |
832 protocol = g_object_get_data(G_OBJECT(item), "protocol"); | |
833 if (str_value == NULL && protocol != NULL && !strcmp(protocol, "prpl-fake") && | |
834 !strcmp(_("Connect server"), purple_account_option_get_text(option))) | |
835 str_value = "talk.google.com"; | |
836 | |
816 if (str_value != NULL) | 837 if (str_value != NULL) |
817 gtk_entry_set_text(GTK_ENTRY(entry), str_value); | 838 gtk_entry_set_text(GTK_ENTRY(entry), str_value); |
818 | 839 |
819 title = g_strdup_printf("%s:", | 840 title = g_strdup_printf("%s:", |
820 purple_account_option_get_text(option)); | 841 purple_account_option_get_text(option)); |
1001 GtkWidget *vbox2; | 1022 GtkWidget *vbox2; |
1002 | 1023 |
1003 if (dialog->proxy_frame != NULL) | 1024 if (dialog->proxy_frame != NULL) |
1004 gtk_widget_destroy(dialog->proxy_frame); | 1025 gtk_widget_destroy(dialog->proxy_frame); |
1005 | 1026 |
1006 frame = pidgin_make_frame(parent, _("Proxy Options")); | 1027 frame = pidgin_make_frame(parent, _("Pro_xy Options")); |
1007 dialog->proxy_frame = gtk_widget_get_parent(gtk_widget_get_parent(frame)); | 1028 dialog->proxy_frame = gtk_widget_get_parent(gtk_widget_get_parent(frame)); |
1008 | 1029 |
1009 gtk_box_reorder_child(GTK_BOX(parent), dialog->proxy_frame, 1); | 1030 gtk_box_reorder_child(GTK_BOX(parent), dialog->proxy_frame, 1); |
1010 gtk_widget_show(dialog->proxy_frame); | 1031 gtk_widget_show(dialog->proxy_frame); |
1011 | 1032 |
2005 static void | 2026 static void |
2006 set_account(GtkListStore *store, GtkTreeIter *iter, PurpleAccount *account, GdkPixbuf *global_buddyicon) | 2027 set_account(GtkListStore *store, GtkTreeIter *iter, PurpleAccount *account, GdkPixbuf *global_buddyicon) |
2007 { | 2028 { |
2008 GdkPixbuf *pixbuf, *buddyicon = NULL; | 2029 GdkPixbuf *pixbuf, *buddyicon = NULL; |
2009 PurpleStoredImage *img = NULL; | 2030 PurpleStoredImage *img = NULL; |
2031 PurplePlugin *prpl; | |
2032 PurplePluginProtocolInfo *prpl_info = NULL; | |
2010 | 2033 |
2011 pixbuf = pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_MEDIUM); | 2034 pixbuf = pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_MEDIUM); |
2012 if ((pixbuf != NULL) && purple_account_is_disconnected(account)) | 2035 if ((pixbuf != NULL) && purple_account_is_disconnected(account)) |
2013 gdk_pixbuf_saturate_and_pixelate(pixbuf, pixbuf, 0.0, FALSE); | 2036 gdk_pixbuf_saturate_and_pixelate(pixbuf, pixbuf, 0.0, FALSE); |
2014 | 2037 |
2015 if (purple_account_get_bool(account, "use-global-buddyicon", TRUE)) { | 2038 prpl = purple_find_prpl(purple_account_get_protocol_id(account)); |
2016 if (global_buddyicon != NULL) | 2039 if (prpl != NULL) |
2017 buddyicon = g_object_ref(G_OBJECT(global_buddyicon)); | 2040 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
2018 /* This is for when set_account() is called for a single account */ | 2041 if (prpl_info != NULL && prpl_info->icon_spec.format != NULL) { |
2019 else | 2042 if (purple_account_get_bool(account, "use-global-buddyicon", TRUE)) { |
2043 if (global_buddyicon != NULL) | |
2044 buddyicon = g_object_ref(G_OBJECT(global_buddyicon)); | |
2045 /* This is for when set_account() is called for a single account */ | |
2046 else | |
2047 img = purple_buddy_icons_find_account_icon(account); | |
2048 } else { | |
2020 img = purple_buddy_icons_find_account_icon(account); | 2049 img = purple_buddy_icons_find_account_icon(account); |
2021 } else { | 2050 } |
2022 img = purple_buddy_icons_find_account_icon(account); | |
2023 } | 2051 } |
2024 | 2052 |
2025 if (img != NULL) { | 2053 if (img != NULL) { |
2026 GdkPixbufLoader *loader = gdk_pixbuf_loader_new(); | 2054 GdkPixbufLoader *loader = gdk_pixbuf_loader_new(); |
2027 GdkPixbuf *buddyicon_pixbuf; | 2055 GdkPixbuf *buddyicon_pixbuf; |