Mercurial > pidgin.yaz
comparison src/dialogs.c @ 2527:c9e316b04048
[gaim-migrate @ 2540]
You can now specify which protocol to add buddies to.
committer: Tailor Script <tailor@pidgin.im>
author | Rob Flynn <gaim@robflynn.com> |
---|---|
date | Thu, 18 Oct 2001 00:24:08 +0000 |
parents | 1b7a1133962d |
children | 44b56faccb22 |
comparison
equal
deleted
inserted
replaced
2526:413a81136e3a | 2527:c9e316b04048 |
---|---|
113 struct addbuddy { | 113 struct addbuddy { |
114 GtkWidget *window; | 114 GtkWidget *window; |
115 GtkWidget *combo; | 115 GtkWidget *combo; |
116 GtkWidget *entry; | 116 GtkWidget *entry; |
117 GtkWidget *entry_for_alias; | 117 GtkWidget *entry_for_alias; |
118 GtkWidget *account; | |
118 struct gaim_connection *gc; | 119 struct gaim_connection *gc; |
119 }; | 120 }; |
120 | 121 |
121 struct addperm { | 122 struct addperm { |
122 GtkWidget *window; | 123 GtkWidget *window; |
808 aol_icon(a->window->window); | 809 aol_icon(a->window->window); |
809 | 810 |
810 gtk_widget_show(a->window); | 811 gtk_widget_show(a->window); |
811 } | 812 } |
812 | 813 |
814 static void addbuddy_select_account(GtkObject *w, struct gaim_connection *gc) | |
815 { | |
816 struct addbuddy *b = gtk_object_get_user_data(w); | |
817 | |
818 b->gc = gc; | |
819 } | |
820 | |
821 static void create_online_user_names(struct addbuddy *b) | |
822 { | |
823 char buf[2048]; /* Never hurts to be safe ;-) */ | |
824 GSList *g = connections; | |
825 struct gaim_connection *c; | |
826 GtkWidget *menu, *opt; | |
827 int count = 0; | |
828 int place = 0; | |
829 | |
830 menu = gtk_menu_new(); | |
831 | |
832 while (g) { | |
833 c = (struct gaim_connection *)g->data; | |
834 g_snprintf(buf, sizeof(buf), "%s (%s)", | |
835 c->username, (*c->prpl->name)()); | |
836 opt = gtk_menu_item_new_with_label(buf); | |
837 gtk_object_set_user_data(GTK_OBJECT(opt), b); | |
838 gtk_signal_connect(GTK_OBJECT(opt), "activate", | |
839 GTK_SIGNAL_FUNC(addbuddy_select_account), | |
840 c); | |
841 gtk_widget_show(opt); | |
842 gtk_menu_append(GTK_MENU(menu), opt); | |
843 | |
844 /* Now check to see if it's our current menu */ | |
845 if (c == b->gc) { | |
846 place = count; | |
847 gtk_menu_item_activate(GTK_MENU_ITEM(opt)); | |
848 gtk_option_menu_set_history(GTK_OPTION_MENU(b->account), count); | |
849 | |
850 /* Do the cha cha cha */ | |
851 } | |
852 | |
853 count++; | |
854 | |
855 g = g->next; | |
856 } | |
857 | |
858 gtk_option_menu_remove_menu(GTK_OPTION_MENU(b->account)); | |
859 gtk_option_menu_set_menu(GTK_OPTION_MENU(b->account), menu); | |
860 gtk_option_menu_set_history(GTK_OPTION_MENU(b->account), place); | |
861 | |
862 gtk_widget_show(b->account); | |
863 gtk_widget_show(b->account->parent); | |
864 | |
865 } | |
866 | |
813 void show_add_buddy(struct gaim_connection *gc, char *buddy, char *group) | 867 void show_add_buddy(struct gaim_connection *gc, char *buddy, char *group) |
814 { | 868 { |
815 GtkWidget *mainbox; | 869 GtkWidget *mainbox; |
816 GtkWidget *frame; | 870 GtkWidget *frame; |
817 GtkWidget *table; | 871 GtkWidget *table; |
818 GtkWidget *bbox; | 872 GtkWidget *bbox; |
819 GtkWidget *cancel; | 873 GtkWidget *cancel; |
820 GtkWidget *add; | 874 GtkWidget *add; |
821 GtkWidget *label; | 875 GtkWidget *label; |
876 GList *tmp; | |
822 | 877 |
823 struct addbuddy *a = g_new0(struct addbuddy, 1); | 878 struct addbuddy *a = g_new0(struct addbuddy, 1); |
824 a->gc = gc; | 879 a->gc = gc; |
825 | 880 |
826 a->window = gtk_window_new(GTK_WINDOW_DIALOG); | 881 a->window = gtk_window_new(GTK_WINDOW_DIALOG); |
840 | 895 |
841 frame = gtk_frame_new(_("Add Buddy")); | 896 frame = gtk_frame_new(_("Add Buddy")); |
842 gtk_box_pack_start(GTK_BOX(mainbox), frame, TRUE, TRUE, 0); | 897 gtk_box_pack_start(GTK_BOX(mainbox), frame, TRUE, TRUE, 0); |
843 gtk_widget_show(frame); | 898 gtk_widget_show(frame); |
844 | 899 |
845 table = gtk_table_new(3, 2, FALSE); | 900 table = gtk_table_new(3, 3, FALSE); |
846 gtk_table_set_row_spacings(GTK_TABLE(table), 5); | 901 gtk_table_set_row_spacings(GTK_TABLE(table), 5); |
847 gtk_table_set_col_spacings(GTK_TABLE(table), 5); | 902 gtk_table_set_col_spacings(GTK_TABLE(table), 5); |
848 gtk_container_set_border_width(GTK_CONTAINER(table), 5); | 903 gtk_container_set_border_width(GTK_CONTAINER(table), 5); |
849 gtk_container_add(GTK_CONTAINER(frame), table); | 904 gtk_container_add(GTK_CONTAINER(frame), table); |
850 | 905 |
870 a->combo = gtk_combo_new(); | 925 a->combo = gtk_combo_new(); |
871 gtk_combo_set_popdown_strings(GTK_COMBO(a->combo), groups_tree(gc ? gc : connections->data)); | 926 gtk_combo_set_popdown_strings(GTK_COMBO(a->combo), groups_tree(gc ? gc : connections->data)); |
872 if (group != NULL) | 927 if (group != NULL) |
873 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(a->combo)->entry), group); | 928 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(a->combo)->entry), group); |
874 gtk_table_attach_defaults(GTK_TABLE(table), a->combo, 1, 2, 2, 3); | 929 gtk_table_attach_defaults(GTK_TABLE(table), a->combo, 1, 2, 2, 3); |
930 | |
931 /* Set up stuff for the account box */ | |
932 label = gtk_label_new(_("Add To")); | |
933 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 3, 4); | |
934 | |
935 a->account = gtk_option_menu_new(); | |
936 gtk_table_attach_defaults(GTK_TABLE(table), a->account, 1, 2, 3, 4); | |
937 | |
938 create_online_user_names(a); | |
939 | |
940 /* End of account box */ | |
875 | 941 |
876 bbox = gtk_hbox_new(FALSE, 5); | 942 bbox = gtk_hbox_new(FALSE, 5); |
877 gtk_box_pack_start(GTK_BOX(mainbox), bbox, TRUE, TRUE, 0); | 943 gtk_box_pack_start(GTK_BOX(mainbox), bbox, TRUE, TRUE, 0); |
878 | 944 |
879 cancel = picture_button(a->window, _("Cancel"), cancel_xpm); | 945 cancel = picture_button(a->window, _("Cancel"), cancel_xpm); |