Mercurial > pidgin.yaz
comparison src/dialogs.c @ 5237:757d680f923d
[gaim-migrate @ 5607]
I guess I shouldn't force the aliases on everyone...now they're optional.
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Sat, 26 Apr 2003 21:44:00 +0000 |
parents | 0d4b8ca97c17 |
children | a3bb756635be |
comparison
equal
deleted
inserted
replaced
5236:0d4b8ca97c17 | 5237:757d680f923d |
---|---|
1227 if (!(group = gaim_find_group(group_name))) { | 1227 if (!(group = gaim_find_group(group_name))) { |
1228 group = gaim_group_new(group_name); | 1228 group = gaim_group_new(group_name); |
1229 gaim_blist_add_group(group, NULL); | 1229 gaim_blist_add_group(group, NULL); |
1230 } | 1230 } |
1231 | 1231 |
1232 gaim_blist_add_chat(chat, group, NULL); | 1232 if(chat) { |
1233 gaim_blist_save(); | 1233 gaim_blist_add_chat(chat, group, NULL); |
1234 gaim_blist_save(); | |
1235 } | |
1234 | 1236 |
1235 gtk_widget_destroy(ac->window); | 1237 gtk_widget_destroy(ac->window); |
1236 g_list_free(ac->entries); | 1238 g_list_free(ac->entries); |
1237 | 1239 |
1238 g_free(ac); | 1240 g_free(ac); |
1250 | 1252 |
1251 | 1253 |
1252 static void rebuild_addchat_entries(struct addchat *ac) { | 1254 static void rebuild_addchat_entries(struct addchat *ac) { |
1253 GList *list, *tmp; | 1255 GList *list, *tmp; |
1254 struct proto_chat_entry *pce; | 1256 struct proto_chat_entry *pce; |
1257 gboolean focus = TRUE; | |
1255 | 1258 |
1256 while(GTK_BOX(ac->entries_box)->children) | 1259 while(GTK_BOX(ac->entries_box)->children) |
1257 gtk_container_remove(GTK_CONTAINER(ac->entries_box), | 1260 gtk_container_remove(GTK_CONTAINER(ac->entries_box), |
1258 ((GtkBoxChild *)GTK_BOX(ac->entries_box)->children->data)->widget); | 1261 ((GtkBoxChild *)GTK_BOX(ac->entries_box)->children->data)->widget); |
1259 | 1262 |
1294 ac->entries = g_list_append(ac->entries, entry); | 1297 ac->entries = g_list_append(ac->entries, entry); |
1295 | 1298 |
1296 if(pce->def) | 1299 if(pce->def) |
1297 gtk_entry_set_text(GTK_ENTRY(entry), pce->def); | 1300 gtk_entry_set_text(GTK_ENTRY(entry), pce->def); |
1298 | 1301 |
1302 if(focus) { | |
1303 gtk_widget_grab_focus(entry); | |
1304 focus = FALSE; | |
1305 } | |
1306 | |
1299 gtk_box_pack_end(GTK_BOX(rowbox), entry, TRUE, TRUE, 0); | 1307 gtk_box_pack_end(GTK_BOX(rowbox), entry, TRUE, TRUE, 0); |
1300 | 1308 |
1301 g_signal_connect(G_OBJECT(entry), "activate", | 1309 g_signal_connect(G_OBJECT(entry), "activate", |
1302 G_CALLBACK(do_add_chat), ac); | 1310 G_CALLBACK(do_add_chat), ac); |
1303 } | 1311 } |
1418 ac->account_menu = gtk_option_menu_new(); | 1426 ac->account_menu = gtk_option_menu_new(); |
1419 gtk_box_pack_end(GTK_BOX(rowbox), ac->account_menu, TRUE, TRUE, 0); | 1427 gtk_box_pack_end(GTK_BOX(rowbox), ac->account_menu, TRUE, TRUE, 0); |
1420 | 1428 |
1421 create_online_account_menu_for_add_chat(ac); | 1429 create_online_account_menu_for_add_chat(ac); |
1422 | 1430 |
1431 ac->entries_box = gtk_vbox_new(FALSE, 5); | |
1432 gtk_container_set_border_width(GTK_CONTAINER(ac->entries_box), 0); | |
1433 gtk_box_pack_start(GTK_BOX(vbox), ac->entries_box, TRUE, TRUE, 0); | |
1434 | |
1435 rebuild_addchat_entries(ac); | |
1436 | |
1423 rowbox = gtk_hbox_new(FALSE, 5); | 1437 rowbox = gtk_hbox_new(FALSE, 5); |
1424 gtk_box_pack_start(GTK_BOX(vbox), rowbox, FALSE, FALSE, 0); | 1438 gtk_box_pack_start(GTK_BOX(vbox), rowbox, FALSE, FALSE, 0); |
1425 | 1439 |
1426 label = gtk_label_new(_("Alias:")); | 1440 label = gtk_label_new(_("Alias:")); |
1427 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | 1441 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
1429 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0); | 1443 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0); |
1430 | 1444 |
1431 ac->alias_entry = gtk_entry_new(); | 1445 ac->alias_entry = gtk_entry_new(); |
1432 gtk_box_pack_end(GTK_BOX(rowbox), ac->alias_entry, TRUE, TRUE, 0); | 1446 gtk_box_pack_end(GTK_BOX(rowbox), ac->alias_entry, TRUE, TRUE, 0); |
1433 | 1447 |
1434 ac->entries_box = gtk_vbox_new(FALSE, 5); | |
1435 gtk_container_set_border_width(GTK_CONTAINER(ac->entries_box), 0); | |
1436 gtk_box_pack_start(GTK_BOX(vbox), ac->entries_box, TRUE, TRUE, 0); | |
1437 | |
1438 rebuild_addchat_entries(ac); | |
1439 | |
1440 rowbox = gtk_hbox_new(FALSE, 5); | 1448 rowbox = gtk_hbox_new(FALSE, 5); |
1441 gtk_box_pack_start(GTK_BOX(vbox), rowbox, FALSE, FALSE, 0); | 1449 gtk_box_pack_start(GTK_BOX(vbox), rowbox, FALSE, FALSE, 0); |
1442 | 1450 |
1443 label = gtk_label_new(_("Group:")); | 1451 label = gtk_label_new(_("Group:")); |
1444 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | 1452 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
1451 | 1459 |
1452 if (group) | 1460 if (group) |
1453 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(ac->group_combo)->entry), group->name); | 1461 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(ac->group_combo)->entry), group->name); |
1454 | 1462 |
1455 g_signal_connect(G_OBJECT(ac->window), "response", G_CALLBACK(do_add_chat_resp), ac); | 1463 g_signal_connect(G_OBJECT(ac->window), "response", G_CALLBACK(do_add_chat_resp), ac); |
1456 | |
1457 gtk_widget_grab_focus(ac->alias_entry); | |
1458 | 1464 |
1459 gtk_widget_show_all(ac->window); | 1465 gtk_widget_show_all(ac->window); |
1460 } | 1466 } |
1461 | 1467 |
1462 | 1468 |
3567 static void do_alias_chat(GtkWidget *w, int resp, struct chat *chat) | 3573 static void do_alias_chat(GtkWidget *w, int resp, struct chat *chat) |
3568 { | 3574 { |
3569 if(resp == GTK_RESPONSE_OK) { | 3575 if(resp == GTK_RESPONSE_OK) { |
3570 GtkWidget *entry = g_object_get_data(G_OBJECT(w), "alias_entry"); | 3576 GtkWidget *entry = g_object_get_data(G_OBJECT(w), "alias_entry"); |
3571 const char *text = gtk_entry_get_text(GTK_ENTRY(entry)); | 3577 const char *text = gtk_entry_get_text(GTK_ENTRY(entry)); |
3572 if(text && strlen(text)) { | 3578 gaim_blist_alias_chat(chat, text); |
3573 gaim_blist_alias_chat(chat, text); | 3579 gaim_blist_save(); |
3574 gaim_blist_save(); | |
3575 } | |
3576 } | 3580 } |
3577 gtk_widget_destroy(w); | 3581 gtk_widget_destroy(w); |
3578 } | 3582 } |
3579 | 3583 |
3580 static void | 3584 static void |