comparison src/dialogs.c @ 7060:9946001989a3

[gaim-migrate @ 7623] show_add_buddy, show_add_chat, and show_add_group are gone, replaced with the new core/UI split gaim_blist_request_add_{buddy,chat,group}. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Tue, 30 Sep 2003 05:48:42 +0000
parents 3c7c887c35c3
children 86ed8b2aa665
comparison
equal deleted inserted replaced
7059:e36cbed14f1e 7060:9946001989a3
36 #include "gtkutils.h" 36 #include "gtkutils.h"
37 #include "stock.h" 37 #include "stock.h"
38 38
39 #include "ui.h" 39 #include "ui.h"
40 40
41 #ifdef USE_GTKSPELL
42 # include <gtkspell/gtkspell.h>
43 #endif
44
41 /* XXX */ 45 /* XXX */
42 #include "gaim.h" 46 #include "gaim.h"
43 47
44 #ifdef _WIN32 48 #ifdef _WIN32
45 # include "wspell.h" 49 # include "wspell.h"
72 76
73 struct warning { 77 struct warning {
74 GtkWidget *window; 78 GtkWidget *window;
75 GtkWidget *anon; 79 GtkWidget *anon;
76 char *who; 80 char *who;
77 GaimConnection *gc;
78 };
79
80 struct addbuddy {
81 GtkWidget *window;
82 GtkWidget *combo;
83 GtkWidget *entry;
84 GtkWidget *entry_for_alias;
85 GtkWidget *account;
86 GaimConnection *gc; 81 GaimConnection *gc;
87 }; 82 };
88 83
89 struct findbyemail { 84 struct findbyemail {
90 GtkWidget *window; 85 GtkWidget *window;
825 if (info->entry) 820 if (info->entry)
826 gtk_widget_grab_focus(GTK_WIDGET(info->entry)); 821 gtk_widget_grab_focus(GTK_WIDGET(info->entry));
827 } 822 }
828 823
829 824
830 /*------------------------------------------------------------------------*/
831 /* The dialog for adding buddies */
832 /*------------------------------------------------------------------------*/
833
834 extern void add_callback(GtkWidget *, GaimConversation *);
835
836 void do_add_buddy(GtkWidget *w, int resp, struct addbuddy *a)
837 {
838 const char *grp, *who, *whoalias;
839 GaimConversation *c;
840 GaimBuddy *b;
841 GaimGroup *g;
842
843 if (resp == GTK_RESPONSE_OK) {
844
845 who = gtk_entry_get_text(GTK_ENTRY(a->entry));
846 grp = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(a->combo)->entry));
847 whoalias = gtk_entry_get_text(GTK_ENTRY(a->entry_for_alias));
848
849 c = gaim_find_conversation_with_account(who, a->gc->account);
850 if (!(g = gaim_find_group(grp))) {
851 g = gaim_group_new(grp);
852 gaim_blist_add_group(g, NULL);
853 }
854 b = gaim_buddy_new(a->gc->account, who, whoalias);
855 gaim_blist_add_buddy(b, NULL, g, NULL);
856 serv_add_buddy(a->gc, who, g);
857
858 if (c != NULL)
859 gaim_buddy_icon_update(gaim_im_get_icon(GAIM_IM(c)));
860
861 gaim_blist_save();
862 }
863
864 destroy_dialog(NULL, a->window);
865 }
866
867 static GList *groups_tree()
868 {
869 GList *tmp = NULL;
870 char *tmp2;
871 GaimGroup *g;
872
873 GaimBlistNode *gnode = gaim_get_blist()->root;
874
875 if (!gnode) {
876 tmp2 = g_strdup(_("Buddies"));
877 tmp = g_list_append(tmp, tmp2);
878 } else {
879 while (gnode) {
880 if(GAIM_BLIST_NODE_IS_GROUP(gnode)) {
881 g = (GaimGroup *)gnode;
882 tmp2 = g->name;
883 tmp = g_list_append(tmp, tmp2);
884 }
885 gnode = gnode->next;
886 }
887 }
888 return tmp;
889 }
890
891 static void free_dialog(GtkWidget *w, struct addbuddy *a)
892 {
893 g_free(a);
894 }
895
896
897 static void 825 static void
898 add_group_cb(GaimConnection *gc, const char *group_name) 826 free_dialog(GtkWidget *w, void *data)
899 { 827 {
900 GaimGroup *g; 828 g_free(data);
901 829 }
902 g = gaim_group_new(group_name);
903 gaim_blist_add_group(g, NULL);
904 gaim_blist_save();
905 }
906
907 void
908 show_add_group(GaimConnection *gc)
909 {
910 gaim_request_input(NULL, _("Add Group"), _("Add a new group"),
911 _("Please enter the name of the group to be added."),
912 NULL, FALSE, FALSE,
913 _("Add"), G_CALLBACK(add_group_cb),
914 _("Cancel"), NULL, gc);
915 }
916
917 static void
918 addbuddy_select_account(GObject *w, GaimAccount *account,
919 struct addbuddy *b)
920 {
921 /* Save our account */
922 b->gc = gaim_account_get_connection(account);
923 }
924
925 void show_add_buddy(GaimConnection *gc, char *buddy, char *group, char *alias)
926 {
927 GtkWidget *table;
928 GtkWidget *label;
929 GtkWidget *hbox;
930 GtkWidget *vbox;
931 struct gaim_gtk_buddy_list *gtkblist;
932 GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG);
933 struct addbuddy *a = g_new0(struct addbuddy, 1);
934 a->gc = gc ? gc : gaim_connections_get_all()->data;
935
936 gtkblist = GAIM_GTK_BLIST(gaim_get_blist());
937
938 GAIM_DIALOG(a->window);
939 a->window = gtk_dialog_new_with_buttons(_("Add Buddy"), gtkblist->window ? GTK_WINDOW(gtkblist->window) : NULL, 0,
940 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_ADD, GTK_RESPONSE_OK, NULL);
941
942 gtk_dialog_set_default_response(GTK_DIALOG(a->window), GTK_RESPONSE_OK);
943 gtk_container_set_border_width(GTK_CONTAINER(a->window), 6);
944 gtk_window_set_resizable(GTK_WINDOW(a->window), FALSE);
945 gtk_dialog_set_has_separator(GTK_DIALOG(a->window), FALSE);
946 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(a->window)->vbox), 12);
947 gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(a->window)->vbox), 6);
948 gtk_window_set_role(GTK_WINDOW(a->window), "add_buddy");
949
950 hbox = gtk_hbox_new(FALSE, 12);
951 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(a->window)->vbox), hbox);
952 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
953 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
954
955 vbox = gtk_vbox_new(FALSE, 0);
956 gtk_container_add(GTK_CONTAINER(hbox), vbox);
957
958 label = gtk_label_new(_("Please enter the screen name of the person you would like to add to your buddy list. You may optionally enter an alias, or nickname, for the buddy. The alias will be displayed in place of the screen name whenever possible.\n"));
959 gtk_widget_set_size_request(GTK_WIDGET(label), 400, -1);
960 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
961 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
962 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
963
964 hbox = gtk_hbox_new(FALSE, 6);
965 gtk_container_add(GTK_CONTAINER(vbox), hbox);
966
967 g_signal_connect(G_OBJECT(a->window), "destroy", G_CALLBACK(destroy_dialog), a->window);
968 g_signal_connect(G_OBJECT(a->window), "destroy", G_CALLBACK(free_dialog), a);
969 dialogwindows = g_list_prepend(dialogwindows, a->window);
970
971 table = gtk_table_new(4, 2, FALSE);
972 gtk_table_set_row_spacings(GTK_TABLE(table), 5);
973 gtk_table_set_col_spacings(GTK_TABLE(table), 5);
974 gtk_container_set_border_width(GTK_CONTAINER(table), 0);
975 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
976
977 label = gtk_label_new(_("Screen Name"));
978 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
979 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1);
980
981 a->entry = gtk_entry_new();
982 gtk_table_attach_defaults(GTK_TABLE(table), a->entry, 1, 2, 0, 1);
983 gtk_widget_grab_focus(a->entry);
984
985 if (buddy != NULL)
986 gtk_entry_set_text(GTK_ENTRY(a->entry), buddy);
987
988 gtk_entry_set_activates_default (GTK_ENTRY(a->entry), TRUE);
989
990 label = gtk_label_new(_("Alias"));
991 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
992 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2);
993
994 a->entry_for_alias = gtk_entry_new();
995 gtk_table_attach_defaults(GTK_TABLE(table), a->entry_for_alias, 1, 2, 1, 2);
996 if (alias != NULL)
997 gtk_entry_set_text(GTK_ENTRY(a->entry_for_alias), alias);
998 gtk_entry_set_activates_default (GTK_ENTRY(a->entry_for_alias), TRUE);
999
1000 label = gtk_label_new(_("Group"));
1001 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
1002 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 2, 3);
1003
1004 a->combo = gtk_combo_new();
1005 gtk_combo_set_popdown_strings(GTK_COMBO(a->combo), groups_tree());
1006 gtk_table_attach_defaults(GTK_TABLE(table), a->combo, 1, 2, 2, 3);
1007
1008 /* Set up stuff for the account box */
1009 label = gtk_label_new(_("Add To"));
1010 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
1011 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 3, 4);
1012
1013 a->account = gaim_gtk_account_option_menu_new(
1014 gc ? gaim_connection_get_account(gc) : NULL, FALSE,
1015 G_CALLBACK(addbuddy_select_account), NULL, a);
1016
1017 gtk_table_attach_defaults(GTK_TABLE(table), a->account, 1, 2, 3, 4);
1018
1019 /* End of account box */
1020
1021 g_signal_connect(G_OBJECT(a->window), "response",
1022 G_CALLBACK(do_add_buddy), a);
1023
1024 gtk_widget_show_all(a->window);
1025
1026 if (group != NULL)
1027 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(a->combo)->entry), group);
1028 }
1029
1030 struct addchat {
1031 GaimAccount *account;
1032 GtkWidget *window;
1033 GtkWidget *account_menu;
1034 GtkWidget *alias_entry;
1035 GtkWidget *group_combo;
1036 GtkWidget *entries_box;
1037 GtkSizeGroup *sg;
1038 GList *entries;
1039 };
1040
1041 static void do_add_chat(GtkWidget *w, struct addchat *ac) {
1042 GHashTable *components = g_hash_table_new_full(g_str_hash, g_str_equal,
1043 g_free, g_free);
1044 GList *tmp;
1045
1046 GaimBlistChat *chat;
1047 GaimGroup *group;
1048 const char *group_name;
1049
1050 for(tmp = ac->entries; tmp; tmp = tmp->next) {
1051 if(g_object_get_data(tmp->data, "is_spin")) {
1052 g_hash_table_replace(components,
1053 g_strdup(g_object_get_data(tmp->data, "identifier")),
1054 g_strdup_printf("%d",
1055 gtk_spin_button_get_value_as_int(tmp->data)));
1056 } else {
1057 g_hash_table_replace(components,
1058 g_strdup(g_object_get_data(tmp->data, "identifier")),
1059 g_strdup(gtk_entry_get_text(tmp->data)));
1060 }
1061 }
1062
1063 chat = gaim_blist_chat_new(ac->account, gtk_entry_get_text(GTK_ENTRY(ac->alias_entry)), components);
1064
1065 group_name = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(ac->group_combo)->entry));
1066 if (!(group = gaim_find_group(group_name))) {
1067 group = gaim_group_new(group_name);
1068 gaim_blist_add_group(group, NULL);
1069 }
1070
1071 if(chat) {
1072 gaim_blist_add_chat(chat, group, NULL);
1073 gaim_blist_save();
1074 }
1075
1076 gtk_widget_destroy(ac->window);
1077 g_list_free(ac->entries);
1078
1079 g_free(ac);
1080 }
1081
1082 static void do_add_chat_resp(GtkWidget *w, int resp, struct addchat *ac) {
1083 if(resp == GTK_RESPONSE_OK) {
1084 do_add_chat(NULL, ac);
1085 } else {
1086 gtk_widget_destroy(ac->window);
1087 g_list_free(ac->entries);
1088 g_free(ac);
1089 }
1090 }
1091
1092
1093 static void rebuild_addchat_entries(struct addchat *ac) {
1094 GList *list, *tmp;
1095 struct proto_chat_entry *pce;
1096 gboolean focus = TRUE;
1097
1098 while(GTK_BOX(ac->entries_box)->children)
1099 gtk_container_remove(GTK_CONTAINER(ac->entries_box),
1100 ((GtkBoxChild *)GTK_BOX(ac->entries_box)->children->data)->widget);
1101
1102 if(ac->entries)
1103 g_list_free(ac->entries);
1104
1105 ac->entries = NULL;
1106
1107 list = GAIM_PLUGIN_PROTOCOL_INFO(ac->account->gc->prpl)->chat_info(ac->account->gc);
1108
1109 for(tmp = list; tmp; tmp = tmp->next) {
1110 GtkWidget *label;
1111 GtkWidget *rowbox;
1112 pce = tmp->data;
1113
1114 rowbox = gtk_hbox_new(FALSE, 5);
1115 gtk_box_pack_start(GTK_BOX(ac->entries_box), rowbox, FALSE, FALSE, 0);
1116
1117 label = gtk_label_new(pce->label);
1118 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
1119 gtk_size_group_add_widget(ac->sg, label);
1120 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
1121
1122 if(pce->is_int) {
1123 GtkObject *adjust;
1124 GtkWidget *spin;
1125 adjust = gtk_adjustment_new(pce->min, pce->min, pce->max,
1126 1, 10, 10);
1127 spin = gtk_spin_button_new(GTK_ADJUSTMENT(adjust), 1, 0);
1128 g_object_set_data(G_OBJECT(spin), "is_spin", GINT_TO_POINTER(TRUE));
1129 g_object_set_data(G_OBJECT(spin), "identifier", pce->identifier);
1130 ac->entries = g_list_append(ac->entries, spin);
1131 gtk_widget_set_size_request(spin, 50, -1);
1132 gtk_box_pack_end(GTK_BOX(rowbox), spin, FALSE, FALSE, 0);
1133 } else {
1134 GtkWidget *entry = gtk_entry_new();
1135 g_object_set_data(G_OBJECT(entry), "identifier", pce->identifier);
1136 ac->entries = g_list_append(ac->entries, entry);
1137
1138 if(pce->def)
1139 gtk_entry_set_text(GTK_ENTRY(entry), pce->def);
1140
1141 if(focus) {
1142 gtk_widget_grab_focus(entry);
1143 focus = FALSE;
1144 }
1145
1146 if(pce->secret)
1147 gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE);
1148
1149 gtk_box_pack_end(GTK_BOX(rowbox), entry, TRUE, TRUE, 0);
1150
1151 g_signal_connect(G_OBJECT(entry), "activate",
1152 G_CALLBACK(do_add_chat), ac);
1153 }
1154 g_free(pce);
1155 }
1156
1157 gtk_widget_show_all(ac->entries_box);
1158 }
1159
1160 static void addchat_select_account(GObject *w, GaimConnection *gc)
1161 {
1162 struct addchat *ac = g_object_get_data(w, "addchat");
1163 GaimAccount *account;
1164
1165 account = gaim_connection_get_account(gc);
1166
1167 if (gaim_account_get_protocol(ac->account) ==
1168 gaim_account_get_protocol(account)) {
1169
1170 ac->account = account;
1171 } else {
1172 ac->account = account;
1173 rebuild_addchat_entries(ac);
1174 }
1175 }
1176
1177 static void create_online_account_menu_for_add_chat(struct addchat *ac)
1178 {
1179 char buf[2048]; /* Never hurts to be safe ;-) */
1180 GList *g;
1181 GaimConnection *c;
1182 GaimAccount *account;
1183 GtkWidget *menu, *opt;
1184 GtkWidget *hbox;
1185 GtkWidget *label;
1186 GtkWidget *image;
1187 GdkPixbuf *pixbuf;
1188 GdkPixbuf *scale;
1189 GtkSizeGroup *sg;
1190 char *filename;
1191 const char *proto_name;
1192 int count = 0;
1193 int place = 0;
1194
1195 menu = gtk_menu_new();
1196
1197 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
1198
1199 for (g = gaim_connections_get_all(); g != NULL; g = g->next) {
1200 GaimPluginProtocolInfo *prpl_info = NULL;
1201 GaimPlugin *plugin;
1202
1203 c = (GaimConnection *)g->data;
1204 account = gaim_connection_get_account(c);
1205
1206 plugin = c->prpl;
1207
1208 if (plugin == NULL)
1209 continue;
1210
1211 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(plugin);
1212
1213 if (prpl_info == NULL || prpl_info->join_chat == NULL)
1214 continue;
1215
1216 opt = gtk_menu_item_new();
1217
1218 /* Create the hbox. */
1219 hbox = gtk_hbox_new(FALSE, 4);
1220 gtk_container_add(GTK_CONTAINER(opt), hbox);
1221 gtk_widget_show(hbox);
1222
1223 /* Load the image. */
1224 if (prpl_info != NULL) {
1225 proto_name = prpl_info->list_icon(NULL, NULL);
1226 g_snprintf(buf, sizeof(buf), "%s.png", proto_name);
1227
1228 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status",
1229 "default", buf, NULL);
1230 pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
1231 g_free(filename);
1232
1233 if (pixbuf != NULL) {
1234 /* Scale and insert the image */
1235 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16,
1236 GDK_INTERP_BILINEAR);
1237 image = gtk_image_new_from_pixbuf(scale);
1238
1239 g_object_unref(G_OBJECT(pixbuf));
1240 g_object_unref(G_OBJECT(scale));
1241 }
1242 else
1243 image = gtk_image_new();
1244 }
1245 else
1246 image = gtk_image_new();
1247
1248 gtk_size_group_add_widget(sg, image);
1249
1250 gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0);
1251 gtk_widget_show(image);
1252
1253 g_snprintf(buf, sizeof(buf), "%s (%s)",
1254 gaim_account_get_username(account),
1255 c->prpl->info->name);
1256
1257 /* Create the label. */
1258 label = gtk_label_new(buf);
1259 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
1260 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
1261 gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0);
1262 gtk_widget_show(label);
1263
1264
1265 g_object_set_data(G_OBJECT(opt), "addchat", ac);
1266 g_signal_connect(G_OBJECT(opt), "activate",
1267 G_CALLBACK(addchat_select_account), c);
1268 gtk_widget_show(opt);
1269 gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt);
1270
1271 /* Now check to see if it's our current menu */
1272 if (c->account == ac->account) {
1273 place = count;
1274 gtk_menu_item_activate(GTK_MENU_ITEM(opt));
1275 gtk_option_menu_set_history(GTK_OPTION_MENU(ac->account_menu),
1276 count);
1277
1278 /* Do the cha cha cha */
1279 }
1280
1281 count++;
1282 }
1283
1284 g_object_unref(sg);
1285
1286 gtk_option_menu_remove_menu(GTK_OPTION_MENU(ac->account_menu));
1287 gtk_option_menu_set_menu(GTK_OPTION_MENU(ac->account_menu), menu);
1288 gtk_option_menu_set_history(GTK_OPTION_MENU(ac->account_menu), place);
1289 }
1290
1291 void show_add_chat(GaimAccount *account, GaimGroup *group) {
1292 struct addchat *ac = g_new0(struct addchat, 1);
1293 struct gaim_gtk_buddy_list *gtkblist;
1294 GList *c;
1295 GaimConnection *gc;
1296
1297 GtkWidget *label;
1298 GtkWidget *rowbox;
1299 GtkWidget *hbox;
1300 GtkWidget *vbox;
1301 GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION,
1302 GTK_ICON_SIZE_DIALOG);
1303
1304 gtkblist = GAIM_GTK_BLIST(gaim_get_blist());
1305
1306 if (account) {
1307 ac->account = account;
1308 } else {
1309 /* Select an account with chat capabilities */
1310 for (c = gaim_connections_get_all(); c != NULL; c = c->next) {
1311 gc = c->data;
1312
1313 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->join_chat) {
1314 ac->account = gc->account;
1315 break;
1316 }
1317 }
1318 }
1319
1320 if (!ac->account) {
1321 gaim_notify_error(NULL, NULL,
1322 _("You are not currently signed on with any "
1323 "protocols that have the ability to chat."), NULL);
1324 return;
1325 }
1326
1327 ac->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
1328
1329 ac->window = gtk_dialog_new_with_buttons(_("Add Chat"),
1330 GTK_WINDOW(gtkblist->window), 0,
1331 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
1332 GTK_STOCK_ADD, GTK_RESPONSE_OK,
1333 NULL);
1334
1335 gtk_dialog_set_default_response(GTK_DIALOG(ac->window), GTK_RESPONSE_OK);
1336 gtk_container_set_border_width(GTK_CONTAINER(ac->window), 6);
1337 gtk_window_set_resizable(GTK_WINDOW(ac->window), FALSE);
1338 gtk_dialog_set_has_separator(GTK_DIALOG(ac->window), FALSE);
1339 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(ac->window)->vbox), 12);
1340 gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(ac->window)->vbox),
1341 6);
1342 gtk_window_set_role(GTK_WINDOW(ac->window), "add_chat");
1343
1344 hbox = gtk_hbox_new(FALSE, 12);
1345 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(ac->window)->vbox), hbox);
1346 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
1347 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
1348
1349 vbox = gtk_vbox_new(FALSE, 5);
1350 gtk_container_add(GTK_CONTAINER(hbox), vbox);
1351
1352 label = gtk_label_new(_("Please enter an alias, and the appropriate information about the chat you would like to add to your buddy list.\n"));
1353 gtk_widget_set_size_request(label, 400, -1);
1354 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
1355 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
1356 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
1357
1358 rowbox = gtk_hbox_new(FALSE, 5);
1359 gtk_box_pack_start(GTK_BOX(vbox), rowbox, FALSE, FALSE, 0);
1360
1361 label = gtk_label_new(_("Account:"));
1362 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
1363 gtk_size_group_add_widget(ac->sg, label);
1364 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
1365
1366 ac->account_menu = gtk_option_menu_new();
1367 gtk_box_pack_end(GTK_BOX(rowbox), ac->account_menu, TRUE, TRUE, 0);
1368
1369 create_online_account_menu_for_add_chat(ac);
1370
1371 ac->entries_box = gtk_vbox_new(FALSE, 5);
1372 gtk_container_set_border_width(GTK_CONTAINER(ac->entries_box), 0);
1373 gtk_box_pack_start(GTK_BOX(vbox), ac->entries_box, TRUE, TRUE, 0);
1374
1375 rebuild_addchat_entries(ac);
1376
1377 rowbox = gtk_hbox_new(FALSE, 5);
1378 gtk_box_pack_start(GTK_BOX(vbox), rowbox, FALSE, FALSE, 0);
1379
1380 label = gtk_label_new(_("Alias:"));
1381 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
1382 gtk_size_group_add_widget(ac->sg, label);
1383 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
1384
1385 ac->alias_entry = gtk_entry_new();
1386 gtk_box_pack_end(GTK_BOX(rowbox), ac->alias_entry, TRUE, TRUE, 0);
1387
1388 rowbox = gtk_hbox_new(FALSE, 5);
1389 gtk_box_pack_start(GTK_BOX(vbox), rowbox, FALSE, FALSE, 0);
1390
1391 label = gtk_label_new(_("Group:"));
1392 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
1393 gtk_size_group_add_widget(ac->sg, label);
1394 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
1395
1396 ac->group_combo = gtk_combo_new();
1397 gtk_combo_set_popdown_strings(GTK_COMBO(ac->group_combo), groups_tree());
1398 gtk_box_pack_end(GTK_BOX(rowbox), ac->group_combo, TRUE, TRUE, 0);
1399
1400 if (group)
1401 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(ac->group_combo)->entry), group->name);
1402
1403 g_signal_connect(G_OBJECT(ac->window), "response", G_CALLBACK(do_add_chat_resp), ac);
1404
1405 gtk_widget_show_all(ac->window);
1406 }
1407
1408 830
1409 /*------------------------------------------------------------------------*/ 831 /*------------------------------------------------------------------------*/
1410 /* The dialog for SET INFO / SET DIR INFO */ 832 /* The dialog for SET INFO / SET DIR INFO */
1411 /*------------------------------------------------------------------------*/ 833 /*------------------------------------------------------------------------*/
1412 834
1763 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); 1185 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
1764 1186
1765 b->text = gtk_text_view_new(); 1187 b->text = gtk_text_view_new();
1766 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(b->text), GTK_WRAP_WORD_CHAR); 1188 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(b->text), GTK_WRAP_WORD_CHAR);
1767 #ifdef USE_GTKSPELL 1189 #ifdef USE_GTKSPELL
1768 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) 1190 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck"))
1769 gtkspell_new_attach(GTK_TEXT_VIEW(b->text), NULL, NULL); 1191 gtkspell_new_attach(GTK_TEXT_VIEW(b->text), NULL, NULL);
1770 #endif 1192 #endif
1771 gtk_widget_set_size_request(b->text, 300, 200); 1193 gtk_widget_set_size_request(b->text, 300, 200);
1772 1194
1773 if ((user_info = gaim_account_get_user_info(account)) != NULL) { 1195 if ((user_info = gaim_account_get_user_info(account)) != NULL) {