Mercurial > pidgin
comparison src/dialogs.c @ 4687:283fb289c510
[gaim-migrate @ 4998]
This is a new buddy list.
Lots of things about it just Don't Work. I probably already know about those
things, and you'd just be wasting my time in submitting a bug report about it.
I decided that instead of getting it to all work perfectly before committing,
that I'd get it in cvs, and slowly fix it with regular commits. That way, it's
easier to keep track of things, and other developers can help. Plus, I'm getting
pissed off at the buddy list and want it to die. It's kinda boring, and doing nothing
but the buddy list for such a long time has just gotten me very bitter.
After 0.60 is released later this week, Gaim will resume being fun. This week is
going to be very stressful, though, I'm sure.
Things you ought to know about this buddy list:
- It crashes
- It leaks
- There's no way to edit the buddy list, or access offline buddies
- Most of the menus and buttons and whatnot just plain ol' don't work.
- Status icons are only implemented for AIM.
That's mostly just because I'm lazy. As such, you may want to be wary of updating this.
If you do decide to update this, you may want to learn "cvs update -D yesterday" as well :)
All the art there is just placeholder art.
You probably won't really have as many problems as it sounds like you will from reading this.
This message is extra-negative to stress that I don't want to be bothered with complaints about
something not working about it :). I'll repeat: If something doesn't work, I probably already
know about it.
If you want to actually help with something, I'd be delighted to have it. IM me.
-s.
committer: Tailor Script <tailor@pidgin.im>
| author | Sean Egan <seanegan@gmail.com> |
|---|---|
| date | Mon, 10 Mar 2003 05:30:31 +0000 |
| parents | 794cc8ec1166 |
| children | 4bdd9a5fd026 |
comparison
equal
deleted
inserted
replaced
| 4686:a1de8a9c99ba | 4687:283fb289c510 |
|---|---|
| 46 | 46 |
| 47 #include <gtk/gtk.h> | 47 #include <gtk/gtk.h> |
| 48 #include "gaim.h" | 48 #include "gaim.h" |
| 49 #include "gtkimhtml.h" | 49 #include "gtkimhtml.h" |
| 50 #include "prpl.h" | 50 #include "prpl.h" |
| 51 #include "gtklist.h" | |
| 51 | 52 |
| 52 #ifdef _WIN32 | 53 #ifdef _WIN32 |
| 53 #include "win32dep.h" | 54 #include "win32dep.h" |
| 54 #endif | 55 #endif |
| 55 | 56 |
| 112 struct addperm { | 113 struct addperm { |
| 113 GtkWidget *window; | 114 GtkWidget *window; |
| 114 GtkWidget *entry; | 115 GtkWidget *entry; |
| 115 struct gaim_connection *gc; | 116 struct gaim_connection *gc; |
| 116 gboolean permit; | 117 gboolean permit; |
| 117 }; | |
| 118 | |
| 119 struct addbp { | |
| 120 GtkWidget *window; | |
| 121 GtkWidget *nameentry; | |
| 122 GtkWidget *messentry; | |
| 123 GtkWidget *commentry; | |
| 124 GtkWidget *command; | |
| 125 GtkWidget *sendim; | |
| 126 GtkWidget *openwindow; | |
| 127 GtkWidget *popupnotify; | |
| 128 GtkWidget *p_signon; | |
| 129 GtkWidget *p_unaway; | |
| 130 GtkWidget *p_unidle; | |
| 131 GtkWidget *p_typing; | |
| 132 GtkWidget *save; | |
| 133 GtkWidget *menu; | |
| 134 GtkWidget *sound; | |
| 135 GtkWidget *soundentry; | |
| 136 | |
| 137 struct gaim_account *account; | |
| 138 struct buddy_pounce *buddy_pounce; | |
| 139 }; | 118 }; |
| 140 | 119 |
| 141 struct findbyemail { | 120 struct findbyemail { |
| 142 GtkWidget *window; | 121 GtkWidget *window; |
| 143 GtkWidget *emailentry; | 122 GtkWidget *emailentry; |
| 438 gtk_widget_show_all(w->window); | 417 gtk_widget_show_all(w->window); |
| 439 } | 418 } |
| 440 | 419 |
| 441 void do_remove_buddy(struct buddy *b) | 420 void do_remove_buddy(struct buddy *b) |
| 442 { | 421 { |
| 443 struct group *g = find_group_by_buddy(b); | 422 struct group *g = gaim_find_buddys_group(b); |
| 444 struct gaim_conversation *c; | 423 struct gaim_conversation *c; |
| 445 gchar *name = g_strdup(b->name); /* b->name is null after remove_buddy */ | 424 gchar *name = g_strdup(b->name); /* b->name is null after remove_buddy */ |
| 446 | 425 |
| 447 if (!b) | 426 if (!b) |
| 448 return; | 427 return; |
| 449 | 428 |
| 450 g = find_group_by_buddy(b); | 429 g = gaim_find_buddys_group(b); |
| 451 | 430 |
| 452 debug_printf(_("Removing '%s' from buddy list.\n"), b->name); | 431 debug_printf(_("Removing '%s' from buddy list.\n"), b->name); |
| 453 serv_remove_buddy(b->account->gc, name, g->name); | 432 serv_remove_buddy(b->account->gc, name, g->name); |
| 454 remove_buddy(b); | 433 gaim_blist_remove_buddy(b); |
| 455 gaim_blist_save(); | 434 gaim_blist_save(); |
| 456 | 435 |
| 457 c = gaim_find_conversation(name); | 436 c = gaim_find_conversation(name); |
| 458 | 437 |
| 459 if (c != NULL) | 438 if (c != NULL) |
| 462 g_free(name); | 441 g_free(name); |
| 463 } | 442 } |
| 464 | 443 |
| 465 void show_confirm_del(struct gaim_connection *gc, gchar *name) | 444 void show_confirm_del(struct gaim_connection *gc, gchar *name) |
| 466 { | 445 { |
| 467 struct buddy *bd = find_buddy(gc->account, name); | 446 struct buddy *bd = gaim_find_buddy(gc->account, name); |
| 468 char *text; | 447 char *text; |
| 469 if (!bd) | 448 if (!bd) |
| 470 return; | 449 return; |
| 471 | 450 |
| 472 text = g_strdup_printf(_("You are about to remove %s from your buddy list. Do you want to continue?"), name); | 451 text = g_strdup_printf(_("You are about to remove %s from your buddy list. Do you want to continue?"), name); |
| 637 "<span weight=\"bold\" size=\"large\" foreground=\"#6364B1\">Hey! I was in that tumbleweed!</span>"); | 616 "<span weight=\"bold\" size=\"large\" foreground=\"#6364B1\">Hey! I was in that tumbleweed!</span>"); |
| 638 else | 617 else |
| 639 gtk_label_set_markup(GTK_LABEL(label), | 618 gtk_label_set_markup(GTK_LABEL(label), |
| 640 "<span weight=\"bold\" size=\"large\" foreground=\"gray\">I'm not anything.</span>"); | 619 "<span weight=\"bold\" size=\"large\" foreground=\"gray\">I'm not anything.</span>"); |
| 641 | 620 |
| 642 window = gtk_dialog_new_with_buttons("", GTK_WINDOW(blist), GTK_DIALOG_MODAL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); | 621 window = gtk_dialog_new_with_buttons("", GTK_WINDOW(gtkblist->window), GTK_DIALOG_MODAL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); |
| 643 gtk_dialog_set_default_response (GTK_DIALOG(window), GTK_RESPONSE_OK); | 622 gtk_dialog_set_default_response (GTK_DIALOG(window), GTK_RESPONSE_OK); |
| 644 g_signal_connect(G_OBJECT(window), "response", G_CALLBACK(gtk_widget_destroy), NULL); | 623 g_signal_connect(G_OBJECT(window), "response", G_CALLBACK(gtk_widget_destroy), NULL); |
| 645 | 624 |
| 646 gtk_container_set_border_width (GTK_CONTAINER(window), 6); | 625 gtk_container_set_border_width (GTK_CONTAINER(window), 6); |
| 647 gtk_window_set_resizable(GTK_WINDOW(window), FALSE); | 626 gtk_window_set_resizable(GTK_WINDOW(window), FALSE); |
| 687 g_free(filename); | 666 g_free(filename); |
| 688 | 667 |
| 689 if (!imdialog) { | 668 if (!imdialog) { |
| 690 info = g_new0(struct getuserinfo, 1); | 669 info = g_new0(struct getuserinfo, 1); |
| 691 info->gc = connections->data; | 670 info->gc = connections->data; |
| 692 imdialog = gtk_dialog_new_with_buttons(_("Gaim - New Message"), blist ? GTK_WINDOW(blist) : NULL, GTK_DIALOG_MODAL, | 671 imdialog = gtk_dialog_new_with_buttons(_("New Message"), gtkblist ? GTK_WINDOW(gtkblist->window) : NULL, GTK_DIALOG_MODAL, |
| 693 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); | 672 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); |
| 694 gtk_dialog_set_default_response (GTK_DIALOG(imdialog), GTK_RESPONSE_OK); | 673 gtk_dialog_set_default_response (GTK_DIALOG(imdialog), GTK_RESPONSE_OK); |
| 695 gtk_container_set_border_width (GTK_CONTAINER(imdialog), 6); | 674 gtk_container_set_border_width (GTK_CONTAINER(imdialog), 6); |
| 696 gtk_window_set_resizable(GTK_WINDOW(imdialog), FALSE); | 675 gtk_window_set_resizable(GTK_WINDOW(imdialog), FALSE); |
| 697 gtk_dialog_set_has_separator(GTK_DIALOG(imdialog), FALSE); | 676 gtk_dialog_set_has_separator(GTK_DIALOG(imdialog), FALSE); |
| 788 char buf[256]; | 767 char buf[256]; |
| 789 | 768 |
| 790 g_free(filename); | 769 g_free(filename); |
| 791 info->gc = connections->data; | 770 info->gc = connections->data; |
| 792 | 771 |
| 793 window = gtk_dialog_new_with_buttons(_("Gaim - Get User Info"), blist ? GTK_WINDOW(blist) : NULL, GTK_DIALOG_MODAL, | 772 window = gtk_dialog_new_with_buttons(_("Gaim - Get User Info"), gtkblist->window ? GTK_WINDOW(gtkblist->window) : NULL, GTK_DIALOG_MODAL, |
| 794 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); | 773 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); |
| 795 gtk_dialog_set_default_response (GTK_DIALOG(window), GTK_RESPONSE_OK); | 774 gtk_dialog_set_default_response (GTK_DIALOG(window), GTK_RESPONSE_OK); |
| 796 gtk_container_set_border_width (GTK_CONTAINER(window), 6); | 775 gtk_container_set_border_width (GTK_CONTAINER(window), 6); |
| 797 gtk_window_set_resizable(GTK_WINDOW(window), FALSE); | 776 gtk_window_set_resizable(GTK_WINDOW(window), FALSE); |
| 798 gtk_dialog_set_has_separator(GTK_DIALOG(window), FALSE); | 777 gtk_dialog_set_has_separator(GTK_DIALOG(window), FALSE); |
| 883 | 862 |
| 884 void do_add_buddy(GtkWidget *w, int resp, struct addbuddy *a) | 863 void do_add_buddy(GtkWidget *w, int resp, struct addbuddy *a) |
| 885 { | 864 { |
| 886 const char *grp, *who, *whoalias; | 865 const char *grp, *who, *whoalias; |
| 887 struct gaim_conversation *c; | 866 struct gaim_conversation *c; |
| 867 struct buddy *b; | |
| 868 struct group *g; | |
| 888 | 869 |
| 889 if (resp == GTK_RESPONSE_OK) { | 870 if (resp == GTK_RESPONSE_OK) { |
| 890 | 871 |
| 891 who = gtk_entry_get_text(GTK_ENTRY(a->entry)); | 872 who = gtk_entry_get_text(GTK_ENTRY(a->entry)); |
| 892 grp = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(a->combo)->entry)); | 873 grp = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(a->combo)->entry)); |
| 893 whoalias = gtk_entry_get_text(GTK_ENTRY(a->entry_for_alias)); | 874 whoalias = gtk_entry_get_text(GTK_ENTRY(a->entry_for_alias)); |
| 894 | 875 |
| 895 c = gaim_find_conversation(who); | 876 c = gaim_find_conversation(who); |
| 896 | 877 if (!(g = gaim_find_group(grp))) |
| 897 add_buddy(a->gc->account, grp, who, whoalias); | 878 g = gaim_group_new(grp); |
| 879 b = gaim_buddy_new(a->gc->account, who, whoalias); | |
| 880 gaim_blist_add_buddy(b, g, NULL); | |
| 898 serv_add_buddy(a->gc, who); | 881 serv_add_buddy(a->gc, who); |
| 899 | 882 |
| 900 if (c != NULL) | 883 if (c != NULL) |
| 901 gaim_conversation_update(c, GAIM_CONV_UPDATE_ADD); | 884 gaim_conversation_update(c, GAIM_CONV_UPDATE_ADD); |
| 902 | 885 |
| 907 } | 890 } |
| 908 | 891 |
| 909 void do_add_group(GtkWidget *w, int resp, struct addbuddy *a) | 892 void do_add_group(GtkWidget *w, int resp, struct addbuddy *a) |
| 910 { | 893 { |
| 911 const char *grp; | 894 const char *grp; |
| 895 struct group *g; | |
| 912 | 896 |
| 913 if (resp == GTK_RESPONSE_OK) { | 897 if (resp == GTK_RESPONSE_OK) { |
| 914 grp = gtk_entry_get_text(GTK_ENTRY(a->entry)); | 898 grp = gtk_entry_get_text(GTK_ENTRY(a->entry)); |
| 915 | 899 |
| 916 if (!a->gc) | 900 if (!a->gc) |
| 917 a->gc = connections->data; | 901 a->gc = connections->data; |
| 918 | 902 |
| 919 add_group(grp); | 903 g = gaim_group_new(grp); |
| 904 gaim_blist_add_group (g, NULL); | |
| 920 gaim_blist_save(); | 905 gaim_blist_save(); |
| 921 } | 906 } |
| 922 | 907 |
| 923 destroy_dialog(NULL, a->window); | 908 destroy_dialog(NULL, a->window); |
| 924 } | 909 } |
| 961 struct addbuddy *a = g_new0(struct addbuddy, 1); | 946 struct addbuddy *a = g_new0(struct addbuddy, 1); |
| 962 | 947 |
| 963 g_free(filename); | 948 g_free(filename); |
| 964 a->gc = gc; | 949 a->gc = gc; |
| 965 | 950 |
| 966 a->window = gtk_dialog_new_with_buttons(_("Gaim - Add Group"), GTK_WINDOW(blist), GTK_DIALOG_MODAL, | 951 a->window = gtk_dialog_new_with_buttons(_("Gaim - Add Group"), GTK_WINDOW(gtkblist->window), GTK_DIALOG_MODAL, |
| 967 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_ADD, GTK_RESPONSE_OK, NULL); | 952 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_ADD, GTK_RESPONSE_OK, NULL); |
| 968 gtk_dialog_set_default_response (GTK_DIALOG(a->window), GTK_RESPONSE_OK); | 953 gtk_dialog_set_default_response (GTK_DIALOG(a->window), GTK_RESPONSE_OK); |
| 969 gtk_container_set_border_width (GTK_CONTAINER(a->window), 6); | 954 gtk_container_set_border_width (GTK_CONTAINER(a->window), 6); |
| 970 gtk_window_set_resizable(GTK_WINDOW(a->window), FALSE); | 955 gtk_window_set_resizable(GTK_WINDOW(a->window), FALSE); |
| 971 gtk_dialog_set_has_separator(GTK_DIALOG(a->window), FALSE); | 956 gtk_dialog_set_has_separator(GTK_DIALOG(a->window), FALSE); |
| 1074 a->gc = gc ? gc : connections->data; | 1059 a->gc = gc ? gc : connections->data; |
| 1075 | 1060 |
| 1076 g_free(filename); | 1061 g_free(filename); |
| 1077 | 1062 |
| 1078 GAIM_DIALOG(a->window); | 1063 GAIM_DIALOG(a->window); |
| 1079 a->window = gtk_dialog_new_with_buttons(_("Gaim - Add Buddy"), blist ? GTK_WINDOW(blist) : NULL, GTK_DIALOG_MODAL, | 1064 a->window = gtk_dialog_new_with_buttons(_("Gaim - Add Buddy"), gtkblist->window ? GTK_WINDOW(gtkblist->window) : NULL, GTK_DIALOG_MODAL, |
| 1080 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_ADD, GTK_RESPONSE_OK, NULL); | 1065 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_ADD, GTK_RESPONSE_OK, NULL); |
| 1081 | 1066 |
| 1082 gtk_dialog_set_default_response(GTK_DIALOG(a->window), GTK_RESPONSE_OK); | 1067 gtk_dialog_set_default_response(GTK_DIALOG(a->window), GTK_RESPONSE_OK); |
| 1083 gtk_container_set_border_width(GTK_CONTAINER(a->window), 6); | 1068 gtk_container_set_border_width(GTK_CONTAINER(a->window), 6); |
| 1084 gtk_window_set_resizable(GTK_WINDOW(a->window), FALSE); | 1069 gtk_window_set_resizable(GTK_WINDOW(a->window), FALSE); |
| 1615 gtk_widget_show(close_button); | 1600 gtk_widget_show(close_button); |
| 1616 | 1601 |
| 1617 gtk_widget_show(pwin); | 1602 gtk_widget_show(pwin); |
| 1618 | 1603 |
| 1619 } | 1604 } |
| 1620 | |
| 1621 /*------------------------------------------------------------------------*/ | |
| 1622 /* The dialog for new buddy pounces */ | |
| 1623 /*------------------------------------------------------------------------*/ | |
| 1624 | |
| 1625 | |
| 1626 void do_new_bp(GtkWidget *w, struct addbp *b) | |
| 1627 { | |
| 1628 struct buddy_pounce *bp; | |
| 1629 | |
| 1630 if (strlen(gtk_entry_get_text(GTK_ENTRY(b->nameentry))) == 0) { | |
| 1631 do_error_dialog(_("Please enter a buddy to pounce."), NULL, GAIM_ERROR); | |
| 1632 return; | |
| 1633 } | |
| 1634 | |
| 1635 if(!b->buddy_pounce) | |
| 1636 bp = g_new0(struct buddy_pounce, 1); | |
| 1637 else | |
| 1638 bp = b->buddy_pounce; | |
| 1639 | |
| 1640 | |
| 1641 g_snprintf(bp->name, 80, "%s", gtk_entry_get_text(GTK_ENTRY(b->nameentry))); | |
| 1642 g_snprintf(bp->message, 2048, "%s", gtk_entry_get_text(GTK_ENTRY(b->messentry))); | |
| 1643 g_snprintf(bp->command, 2048, "%s", gtk_entry_get_text(GTK_ENTRY(b->commentry))); | |
| 1644 g_snprintf(bp->sound, 2048, "%s", gtk_entry_get_text(GTK_ENTRY(b->soundentry))); | |
| 1645 g_snprintf(bp->pouncer, 80, "%s", b->account->username); | |
| 1646 | |
| 1647 bp->protocol = b->account->protocol; | |
| 1648 | |
| 1649 bp->options = 0; | |
| 1650 | |
| 1651 if (GTK_TOGGLE_BUTTON(b->popupnotify)->active) | |
| 1652 bp->options |= OPT_POUNCE_NOTIFY; | |
| 1653 | |
| 1654 if (GTK_TOGGLE_BUTTON(b->openwindow)->active) | |
| 1655 bp->options |= OPT_POUNCE_POPUP; | |
| 1656 | |
| 1657 if (GTK_TOGGLE_BUTTON(b->sendim)->active) | |
| 1658 bp->options |= OPT_POUNCE_SEND_IM; | |
| 1659 | |
| 1660 if (GTK_TOGGLE_BUTTON(b->command)->active) | |
| 1661 bp->options |= OPT_POUNCE_COMMAND; | |
| 1662 | |
| 1663 if (GTK_TOGGLE_BUTTON(b->sound)->active) | |
| 1664 bp->options |= OPT_POUNCE_SOUND; | |
| 1665 | |
| 1666 if (GTK_TOGGLE_BUTTON(b->p_signon)->active) | |
| 1667 bp->options |= OPT_POUNCE_SIGNON; | |
| 1668 | |
| 1669 if (GTK_TOGGLE_BUTTON(b->p_unaway)->active) | |
| 1670 bp->options |= OPT_POUNCE_UNAWAY; | |
| 1671 | |
| 1672 if (GTK_TOGGLE_BUTTON(b->p_unidle)->active) | |
| 1673 bp->options |= OPT_POUNCE_UNIDLE; | |
| 1674 | |
| 1675 if (GTK_TOGGLE_BUTTON(b->p_typing)->active) | |
| 1676 bp->options |= OPT_POUNCE_TYPING; | |
| 1677 | |
| 1678 if (GTK_TOGGLE_BUTTON(b->save)->active) | |
| 1679 bp->options |= OPT_POUNCE_SAVE; | |
| 1680 | |
| 1681 if(!b->buddy_pounce) | |
| 1682 buddy_pounces = g_list_append(buddy_pounces, bp); | |
| 1683 | |
| 1684 do_bp_menu(); | |
| 1685 | |
| 1686 destroy_dialog(NULL, b->window); | |
| 1687 | |
| 1688 save_prefs(); | |
| 1689 g_free(b); | |
| 1690 } | |
| 1691 | |
| 1692 static void pounce_choose(GtkWidget *opt, struct addbp *b) | |
| 1693 { | |
| 1694 struct gaim_account *account = g_object_get_data(G_OBJECT(opt), "gaim_account"); | |
| 1695 b->account = account; | |
| 1696 } | |
| 1697 | |
| 1698 static GtkWidget *pounce_user_menu(struct addbp *b, struct gaim_connection *gc) | |
| 1699 { | |
| 1700 GtkWidget *optmenu; | |
| 1701 GtkWidget *menu; | |
| 1702 GtkWidget *opt; | |
| 1703 GSList *u = gaim_accounts; | |
| 1704 struct gaim_account *account; | |
| 1705 struct prpl *p; | |
| 1706 int count = 0; | |
| 1707 int place = 0; | |
| 1708 char buf[2048]; | |
| 1709 | |
| 1710 | |
| 1711 optmenu = gtk_option_menu_new(); | |
| 1712 | |
| 1713 menu = gtk_menu_new(); | |
| 1714 | |
| 1715 while (u) { | |
| 1716 account = (struct gaim_account *)u->data; | |
| 1717 p = (struct prpl *)find_prpl(account->protocol); | |
| 1718 g_snprintf(buf, sizeof buf, "%s (%s)", account->username, (p && p->name)?p->name:_("Unknown")); | |
| 1719 opt = gtk_menu_item_new_with_label(buf); | |
| 1720 g_object_set_data(G_OBJECT(opt), "gaim_account", account); | |
| 1721 g_signal_connect(GTK_OBJECT(opt), "activate", G_CALLBACK(pounce_choose), b); | |
| 1722 gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt); | |
| 1723 gtk_widget_show(opt); | |
| 1724 | |
| 1725 if (b->account == account) { | |
| 1726 gtk_menu_item_activate(GTK_MENU_ITEM(opt)); | |
| 1727 place = count; | |
| 1728 } | |
| 1729 | |
| 1730 count++; | |
| 1731 | |
| 1732 u = u->next; | |
| 1733 } | |
| 1734 | |
| 1735 gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu); | |
| 1736 gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), place); | |
| 1737 | |
| 1738 b->menu = optmenu; | |
| 1739 | |
| 1740 return optmenu; | |
| 1741 } | |
| 1742 | |
| 1743 | |
| 1744 void show_new_bp(char *name, struct gaim_connection *gc, int idle, int away, struct buddy_pounce *edit_bp) | |
| 1745 { | |
| 1746 GtkWidget *label; | |
| 1747 GtkWidget *bbox; | |
| 1748 GtkWidget *vbox; | |
| 1749 GtkWidget *button; | |
| 1750 GtkWidget *frame; | |
| 1751 GtkWidget *table; | |
| 1752 GtkWidget *optmenu; | |
| 1753 GtkWidget *sep; | |
| 1754 GtkSizeGroup *sg; | |
| 1755 | |
| 1756 struct addbp *b = g_new0(struct addbp, 1); | |
| 1757 | |
| 1758 if(edit_bp) { | |
| 1759 b->buddy_pounce = edit_bp; | |
| 1760 b->account = gaim_account_find(edit_bp->pouncer, edit_bp->protocol); | |
| 1761 } else { | |
| 1762 b->account = gc ? gc->account : gaim_accounts->data; | |
| 1763 b->buddy_pounce = NULL; | |
| 1764 } | |
| 1765 | |
| 1766 GAIM_DIALOG(b->window); | |
| 1767 dialogwindows = g_list_prepend(dialogwindows, b->window); | |
| 1768 gtk_window_set_resizable(GTK_WINDOW(b->window), TRUE); | |
| 1769 gtk_window_set_role(GTK_WINDOW(b->window), "new_bp"); | |
| 1770 gtk_window_set_title(GTK_WINDOW(b->window), _("Gaim - New Buddy Pounce")); | |
| 1771 g_signal_connect(GTK_OBJECT(b->window), "destroy", G_CALLBACK(destroy_dialog), b->window); | |
| 1772 gtk_widget_realize(b->window); | |
| 1773 | |
| 1774 vbox = gtk_vbox_new(FALSE, 5); | |
| 1775 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); | |
| 1776 gtk_container_add(GTK_CONTAINER(b->window), vbox); | |
| 1777 gtk_widget_show(vbox); | |
| 1778 | |
| 1779 /* <pounce type="who"> */ | |
| 1780 frame = gtk_frame_new(_("Pounce Who")); | |
| 1781 gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); | |
| 1782 gtk_widget_show(GTK_WIDGET(frame)); | |
| 1783 | |
| 1784 table = gtk_table_new(2, 2, FALSE); | |
| 1785 gtk_container_add(GTK_CONTAINER(frame), table); | |
| 1786 gtk_container_set_border_width(GTK_CONTAINER(table), 5); | |
| 1787 gtk_table_set_col_spacings(GTK_TABLE(table), 5); | |
| 1788 gtk_table_set_row_spacings(GTK_TABLE(table), 5); | |
| 1789 gtk_widget_show(table); | |
| 1790 | |
| 1791 label = gtk_label_new(_("Account")); | |
| 1792 gtk_misc_set_alignment(GTK_MISC(label), 0, .5); | |
| 1793 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); | |
| 1794 gtk_widget_show(label); | |
| 1795 | |
| 1796 optmenu = pounce_user_menu(b, gc); | |
| 1797 gtk_table_attach(GTK_TABLE(table), optmenu, 1, 2, 0, 1, GTK_FILL | GTK_EXPAND, 0, 0, 0); | |
| 1798 gtk_widget_show(optmenu); | |
| 1799 | |
| 1800 label = gtk_label_new(_("Buddy")); | |
| 1801 gtk_misc_set_alignment(GTK_MISC(label), 0, .5); | |
| 1802 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); | |
| 1803 gtk_widget_show(label); | |
| 1804 | |
| 1805 b->nameentry = gtk_entry_new(); | |
| 1806 gtk_table_attach(GTK_TABLE(table), b->nameentry, 1, 2, 1, 2, GTK_FILL | GTK_EXPAND, 0, 0, 0); | |
| 1807 if (name !=NULL) | |
| 1808 gtk_entry_set_text(GTK_ENTRY(b->nameentry), name); | |
| 1809 else if(edit_bp) | |
| 1810 gtk_entry_set_text(GTK_ENTRY(b->nameentry), edit_bp->name); | |
| 1811 gtk_window_set_focus(GTK_WINDOW(b->window), b->nameentry); | |
| 1812 gtk_widget_show(b->nameentry); | |
| 1813 /* </pounce type="who"> */ | |
| 1814 | |
| 1815 | |
| 1816 /* <pounce type="when"> */ | |
| 1817 frame = gtk_frame_new(_("Pounce When")); | |
| 1818 gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); | |
| 1819 gtk_widget_show(GTK_WIDGET(frame)); | |
| 1820 | |
| 1821 table = gtk_table_new(2, 2, FALSE); | |
| 1822 gtk_container_add(GTK_CONTAINER(frame), table); | |
| 1823 gtk_container_set_border_width(GTK_CONTAINER(table), 5); | |
| 1824 gtk_table_set_col_spacings(GTK_TABLE(table), 5); | |
| 1825 gtk_widget_show(table); | |
| 1826 | |
| 1827 b->p_signon = gtk_check_button_new_with_label(_("Pounce on sign on")); | |
| 1828 if(edit_bp) | |
| 1829 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b->p_signon), | |
| 1830 (edit_bp->options & OPT_POUNCE_SIGNON) ? TRUE : FALSE); | |
| 1831 else | |
| 1832 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b->p_signon), TRUE); | |
| 1833 gtk_table_attach(GTK_TABLE(table), b->p_signon, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); | |
| 1834 gtk_widget_show(b->p_signon); | |
| 1835 | |
| 1836 b->p_unaway = gtk_check_button_new_with_label(_("Pounce on return from away")); | |
| 1837 if (away) | |
| 1838 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b->p_unaway), TRUE); | |
| 1839 else if(edit_bp) | |
| 1840 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b->p_unaway), | |
| 1841 (edit_bp->options & OPT_POUNCE_UNAWAY) ? TRUE : FALSE); | |
| 1842 gtk_table_attach(GTK_TABLE(table), b->p_unaway, 1, 2, 0, 1, GTK_FILL | GTK_EXPAND, 0, 0, 0); | |
| 1843 gtk_widget_show(b->p_unaway); | |
| 1844 | |
| 1845 b->p_unidle = gtk_check_button_new_with_label(_("Pounce on return from idle")); | |
| 1846 if (idle) | |
| 1847 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b->p_unidle), TRUE); | |
| 1848 else if(edit_bp) | |
| 1849 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b->p_unidle), | |
| 1850 (edit_bp->options & OPT_POUNCE_UNIDLE) ? TRUE : FALSE); | |
| 1851 gtk_table_attach(GTK_TABLE(table), b->p_unidle, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); | |
| 1852 gtk_widget_show(b->p_unidle); | |
| 1853 | |
| 1854 b->p_typing = gtk_check_button_new_with_label(_("Pounce when buddy is typing to you")); | |
| 1855 if (edit_bp) | |
| 1856 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b->p_typing), | |
| 1857 (edit_bp->options & OPT_POUNCE_TYPING) ? TRUE : FALSE); | |
| 1858 gtk_table_attach(GTK_TABLE(table), b->p_typing,1,2,1,2, GTK_FILL | GTK_EXPAND, 0, 0, 0); | |
| 1859 gtk_widget_show(b->p_typing); | |
| 1860 | |
| 1861 /* </pounce type="when"> */ | |
| 1862 | |
| 1863 /* <pounce type="action"> */ | |
| 1864 frame = gtk_frame_new(_("Pounce Action")); | |
| 1865 gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); | |
| 1866 gtk_widget_show(GTK_WIDGET(frame)); | |
| 1867 | |
| 1868 table = gtk_table_new(4, 2, FALSE); | |
| 1869 gtk_container_add(GTK_CONTAINER(frame), table); | |
| 1870 gtk_container_set_border_width(GTK_CONTAINER(table), 5); | |
| 1871 gtk_table_set_col_spacings(GTK_TABLE(table), 5); | |
| 1872 gtk_table_set_row_spacings(GTK_TABLE(table), 5); | |
| 1873 gtk_widget_show(table); | |
| 1874 | |
| 1875 b->openwindow = gtk_check_button_new_with_label(_("Open IM Window")); | |
| 1876 if(edit_bp) | |
| 1877 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b->openwindow), | |
| 1878 (edit_bp->options & OPT_POUNCE_POPUP) ? TRUE : FALSE); | |
| 1879 else | |
| 1880 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b->openwindow), FALSE); | |
| 1881 gtk_table_attach(GTK_TABLE(table), b->openwindow, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); | |
| 1882 gtk_widget_show(b->openwindow); | |
| 1883 | |
| 1884 b->popupnotify = gtk_check_button_new_with_label(_("Popup Notification")); | |
| 1885 if(edit_bp) | |
| 1886 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b->popupnotify), | |
| 1887 (edit_bp->options & OPT_POUNCE_NOTIFY) ? TRUE : FALSE); | |
| 1888 else | |
| 1889 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b->popupnotify), FALSE); | |
| 1890 gtk_table_attach(GTK_TABLE(table), b->popupnotify, 1, 2, 0, 1, GTK_FILL, 0, 0, 0); | |
| 1891 gtk_widget_show(b->popupnotify); | |
| 1892 | |
| 1893 b->sendim = gtk_check_button_new_with_label(_("Send Message")); | |
| 1894 if(edit_bp) | |
| 1895 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b->sendim), | |
| 1896 (edit_bp->options & OPT_POUNCE_SEND_IM) ? TRUE : FALSE); | |
| 1897 else | |
| 1898 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b->sendim), TRUE); | |
| 1899 gtk_table_attach(GTK_TABLE(table), b->sendim, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); | |
| 1900 gtk_widget_show(b->sendim); | |
| 1901 | |
| 1902 b->messentry = gtk_entry_new(); | |
| 1903 gtk_table_attach(GTK_TABLE(table), b->messentry, 1, 2, 1, 2, GTK_FILL | GTK_EXPAND, 0, 0, 0); | |
| 1904 g_signal_connect(GTK_OBJECT(b->messentry), "activate", G_CALLBACK(do_new_bp), b); | |
| 1905 if(edit_bp) { | |
| 1906 gtk_widget_set_sensitive(GTK_WIDGET(b->messentry), | |
| 1907 (edit_bp->options & OPT_POUNCE_SEND_IM) ? TRUE : FALSE); | |
| 1908 gtk_entry_set_text(GTK_ENTRY(b->messentry), edit_bp->message); | |
| 1909 } | |
| 1910 gtk_widget_show(b->messentry); | |
| 1911 | |
| 1912 g_signal_connect(GTK_OBJECT(b->sendim), "clicked", | |
| 1913 G_CALLBACK(gaim_gtk_toggle_sensitive), b->messentry); | |
| 1914 | |
| 1915 b->command = gtk_check_button_new_with_label(_("Execute command on pounce")); | |
| 1916 gtk_table_attach(GTK_TABLE(table), b->command, 0, 1, 2, 3, GTK_FILL, 0, 0, 0); | |
| 1917 if(edit_bp) | |
| 1918 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b->command), | |
| 1919 (edit_bp->options & OPT_POUNCE_COMMAND) ? TRUE : FALSE); | |
| 1920 else | |
| 1921 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b->command), FALSE); | |
| 1922 gtk_widget_show(b->command); | |
| 1923 | |
| 1924 b->commentry = gtk_entry_new(); | |
| 1925 gtk_table_attach(GTK_TABLE(table), b->commentry, 1, 2, 2, 3, GTK_FILL | GTK_EXPAND, 0, 0, 0); | |
| 1926 g_signal_connect(GTK_OBJECT(b->commentry), "activate", G_CALLBACK(do_new_bp), b); | |
| 1927 if(edit_bp) { | |
| 1928 gtk_widget_set_sensitive(GTK_WIDGET(b->commentry), | |
| 1929 (edit_bp->options & OPT_POUNCE_COMMAND) ? TRUE : FALSE); | |
| 1930 gtk_entry_set_text(GTK_ENTRY(b->commentry), edit_bp->command); | |
| 1931 } | |
| 1932 else | |
| 1933 gtk_widget_set_sensitive(GTK_WIDGET(b->commentry), FALSE); | |
| 1934 gtk_widget_show(b->commentry); | |
| 1935 g_signal_connect(GTK_OBJECT(b->command), "clicked", | |
| 1936 G_CALLBACK(gaim_gtk_toggle_sensitive), b->commentry); | |
| 1937 | |
| 1938 b->sound = gtk_check_button_new_with_label(_("Play sound on pounce")); | |
| 1939 if(edit_bp) | |
| 1940 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b->sound), | |
| 1941 (edit_bp->options & OPT_POUNCE_SOUND) ? TRUE : FALSE); | |
| 1942 else | |
| 1943 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b->sound), FALSE); | |
| 1944 gtk_table_attach(GTK_TABLE(table), b->sound, 0, 1, 3, 4, GTK_FILL, 0, 0, 0); | |
| 1945 gtk_widget_show(b->sound); | |
| 1946 | |
| 1947 b->soundentry = gtk_entry_new(); | |
| 1948 gtk_table_attach(GTK_TABLE(table), b->soundentry, 1, 2, 3, 4, GTK_FILL | GTK_EXPAND, 0, 0, 0); | |
| 1949 g_signal_connect(GTK_OBJECT(b->soundentry), "activate", G_CALLBACK(do_new_bp), b); | |
| 1950 if(edit_bp) { | |
| 1951 gtk_widget_set_sensitive(GTK_WIDGET(b->soundentry), | |
| 1952 (edit_bp->options & OPT_POUNCE_SOUND) ? TRUE : FALSE); | |
| 1953 gtk_entry_set_text(GTK_ENTRY(b->soundentry), edit_bp->sound); | |
| 1954 } else | |
| 1955 gtk_widget_set_sensitive(GTK_WIDGET(b->soundentry), FALSE); | |
| 1956 gtk_widget_show(b->soundentry); | |
| 1957 g_signal_connect(GTK_OBJECT(b->sound), "clicked", | |
| 1958 G_CALLBACK(gaim_gtk_toggle_sensitive), b->soundentry); | |
| 1959 /* </pounce type="action"> */ | |
| 1960 | |
| 1961 b->save = gtk_check_button_new_with_label(_("Save this pounce after activation")); | |
| 1962 gtk_container_set_border_width(GTK_CONTAINER(b->save), 7); | |
| 1963 if(edit_bp) | |
| 1964 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b->save), | |
| 1965 (edit_bp->options & OPT_POUNCE_SAVE) ? TRUE : FALSE); | |
| 1966 else | |
| 1967 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b->save), FALSE); | |
| 1968 gtk_box_pack_start(GTK_BOX(vbox), b->save, FALSE, FALSE, 0); | |
| 1969 gtk_widget_show(b->save); | |
| 1970 | |
| 1971 sep = gtk_hseparator_new(); | |
| 1972 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); | |
| 1973 gtk_widget_show(sep); | |
| 1974 | |
| 1975 bbox = gtk_hbox_new(FALSE, 5); | |
| 1976 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); | |
| 1977 gtk_widget_show(bbox); | |
| 1978 | |
| 1979 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
| 1980 | |
| 1981 button = gaim_pixbuf_button_from_stock(_("_Save"), "gtk-execute", GAIM_BUTTON_HORIZONTAL); | |
| 1982 gtk_size_group_add_widget(sg, button); | |
| 1983 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(do_new_bp), b); | |
| 1984 gtk_box_pack_end(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
| 1985 gtk_widget_show(button); | |
| 1986 | |
| 1987 button = gaim_pixbuf_button_from_stock(_("C_ancel"), "gtk-cancel", GAIM_BUTTON_HORIZONTAL); | |
| 1988 gtk_size_group_add_widget(sg, button); | |
| 1989 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(destroy_dialog), b->window); | |
| 1990 gtk_box_pack_end(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
| 1991 gtk_widget_show(button); | |
| 1992 | |
| 1993 | |
| 1994 gtk_widget_show(b->window); | |
| 1995 } | |
| 1996 | |
| 1997 | 1605 |
| 1998 | 1606 |
| 1999 /*------------------------------------------------------------------------*/ | 1607 /*------------------------------------------------------------------------*/ |
| 2000 /* The dialog for SET INFO / SET DIR INFO */ | 1608 /* The dialog for SET INFO / SET DIR INFO */ |
| 2001 /*------------------------------------------------------------------------*/ | 1609 /*------------------------------------------------------------------------*/ |
| 3377 gtk_widget_show(gtkconv->dialogs.font); | 2985 gtk_widget_show(gtkconv->dialogs.font); |
| 3378 gdk_window_raise(gtkconv->dialogs.font->window); | 2986 gdk_window_raise(gtkconv->dialogs.font->window); |
| 3379 } | 2987 } |
| 3380 | 2988 |
| 3381 /*------------------------------------------------------------------------*/ | 2989 /*------------------------------------------------------------------------*/ |
| 3382 /* The dialog for import/export */ | |
| 3383 /*------------------------------------------------------------------------*/ | |
| 3384 | |
| 3385 static void do_import_dialog(GtkWidget *w, gpointer data) | |
| 3386 { | |
| 3387 const char *file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(importdialog)); | |
| 3388 if (file_is_dir(file, importdialog)) { | |
| 3389 return; | |
| 3390 } | |
| 3391 if (g_slist_find(connections, importgc)) { | |
| 3392 do_import(importgc->account, file); | |
| 3393 gaim_blist_save(); | |
| 3394 } | |
| 3395 destroy_dialog(NULL, importdialog); | |
| 3396 } | |
| 3397 | |
| 3398 static void set_import_gc(gpointer data, struct gaim_connection *gc) | |
| 3399 { | |
| 3400 importgc = gc; | |
| 3401 } | |
| 3402 | |
| 3403 static void create_import_dropdown(GtkFileSelection *fs) | |
| 3404 { | |
| 3405 GtkWidget *hbox; | |
| 3406 GtkWidget *label; | |
| 3407 GSList *g = connections; | |
| 3408 struct gaim_connection *c; | |
| 3409 GtkWidget *optmenu; | |
| 3410 GtkWidget *menu; | |
| 3411 char buf[256]; | |
| 3412 GtkWidget *opt; | |
| 3413 | |
| 3414 if (!connections) | |
| 3415 return; | |
| 3416 importgc = connections->data; | |
| 3417 if (!connections->next) | |
| 3418 return; | |
| 3419 | |
| 3420 hbox = gtk_hbox_new(FALSE, 0); | |
| 3421 gtk_box_pack_end(GTK_BOX(fs->action_area), hbox, FALSE, FALSE, 0); | |
| 3422 gtk_widget_show(hbox); | |
| 3423 | |
| 3424 optmenu = gtk_option_menu_new(); | |
| 3425 gtk_box_pack_end(GTK_BOX(hbox), optmenu, FALSE, FALSE, 5); | |
| 3426 gtk_widget_show(optmenu); | |
| 3427 | |
| 3428 label = gtk_label_new(_("Import to:")); | |
| 3429 gtk_box_pack_end(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
| 3430 gtk_widget_show(label); | |
| 3431 | |
| 3432 menu = gtk_menu_new(); | |
| 3433 | |
| 3434 while (g) { | |
| 3435 c = (struct gaim_connection *)g->data; | |
| 3436 g_snprintf(buf, sizeof buf, "%s (%s)", c->username, c->prpl->name); | |
| 3437 opt = gtk_menu_item_new_with_label(buf); | |
| 3438 g_signal_connect(GTK_OBJECT(opt), "activate", G_CALLBACK(set_import_gc), c); | |
| 3439 gtk_widget_show(opt); | |
| 3440 gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt); | |
| 3441 g = g->next; | |
| 3442 } | |
| 3443 | |
| 3444 gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu); | |
| 3445 gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), 0); | |
| 3446 } | |
| 3447 | |
| 3448 void show_import_dialog() | |
| 3449 { | |
| 3450 char *buf = g_malloc(BUF_LEN); | |
| 3451 if (!importdialog) { | |
| 3452 importdialog = gtk_file_selection_new(_("Gaim - Import Buddy List")); | |
| 3453 | |
| 3454 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(importdialog)); | |
| 3455 | |
| 3456 g_snprintf(buf, BUF_LEN - 1, "%s" G_DIR_SEPARATOR_S, gaim_home_dir()); | |
| 3457 | |
| 3458 gtk_file_selection_set_filename(GTK_FILE_SELECTION(importdialog), buf); | |
| 3459 g_signal_connect(GTK_OBJECT(importdialog), "destroy", | |
| 3460 G_CALLBACK(destroy_dialog), importdialog); | |
| 3461 | |
| 3462 g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(importdialog)->ok_button), | |
| 3463 "clicked", G_CALLBACK(do_import_dialog), NULL); | |
| 3464 g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(importdialog)->cancel_button), | |
| 3465 "clicked", G_CALLBACK(destroy_dialog), importdialog); | |
| 3466 | |
| 3467 create_import_dropdown(GTK_FILE_SELECTION(importdialog)); | |
| 3468 } | |
| 3469 | |
| 3470 g_free(buf); | |
| 3471 gtk_widget_show(importdialog); | |
| 3472 gdk_window_raise(importdialog->window); | |
| 3473 } | |
| 3474 | |
| 3475 /*------------------------------------------------------------------------*/ | |
| 3476 /* The dialog for new away messages */ | 2990 /* The dialog for new away messages */ |
| 3477 /*------------------------------------------------------------------------*/ | 2991 /*------------------------------------------------------------------------*/ |
| 3478 | 2992 |
| 3479 static struct away_message *save_away_message(struct create_away *ca) | 2993 static struct away_message *save_away_message(struct create_away *ca) |
| 3480 { | 2994 { |
| 3809 const char *al = gtk_entry_get_text(GTK_ENTRY(aliasname)); | 3323 const char *al = gtk_entry_get_text(GTK_ENTRY(aliasname)); |
| 3810 if (al && strlen(al)) | 3324 if (al && strlen(al)) |
| 3811 g_snprintf(b->alias, sizeof(b->alias), "%s", al); | 3325 g_snprintf(b->alias, sizeof(b->alias), "%s", al); |
| 3812 else | 3326 else |
| 3813 b->alias[0] = '\0'; | 3327 b->alias[0] = '\0'; |
| 3814 handle_buddy_rename(b, b->name); | 3328 gaim_blist_alias_buddy (b, al); |
| 3815 serv_alias_buddy(b); | 3329 serv_alias_buddy(b); |
| 3816 gaim_blist_save(); | 3330 gaim_blist_save(); |
| 3817 destroy_dialog(aliasdlg, aliasdlg); | 3331 destroy_dialog(aliasdlg, aliasdlg); |
| 3818 } | 3332 } |
| 3819 | 3333 |
| 4361 g = g_object_get_data(G_OBJECT(entry), "group"); | 3875 g = g_object_get_data(G_OBJECT(entry), "group"); |
| 4362 | 3876 |
| 4363 if (new_name && (strlen(new_name) != 0) && strcmp(new_name, g->name)) { | 3877 if (new_name && (strlen(new_name) != 0) && strcmp(new_name, g->name)) { |
| 4364 char *prevname; | 3878 char *prevname; |
| 4365 | 3879 |
| 4366 if ((orig = find_group(new_name)) != NULL && g_strcasecmp(new_name, g->name)) { | 3880 if ((orig = gaim_find_group(new_name)) != NULL && g_strcasecmp(new_name, g->name)) { |
| 4367 orig->members = g_slist_concat(orig->members, g->members); | 3881 orig->members = g_slist_concat(orig->members, g->members); |
| 4368 handle_group_rename(orig, g->name); | 3882 gaim_blist_rename_group(orig, g->name); |
| 4369 groups = g_slist_remove(groups, g); | 3883 groups = g_slist_remove(groups, g); |
| 4370 /* FIXME, i don't like calling this. it's sloppy. */ build_edit_tree(); | |
| 4371 accts = gaim_group_get_accounts(g); | 3884 accts = gaim_group_get_accounts(g); |
| 4372 while(accts) { | 3885 while(accts) { |
| 4373 struct gaim_account *account = accts->data; | 3886 struct gaim_account *account = accts->data; |
| 4374 serv_rename_group(account->gc, g, new_name); | 3887 serv_rename_group(account->gc, g, new_name); |
| 4375 accts = g_slist_remove(accts, accts->data); | 3888 accts = g_slist_remove(accts, accts->data); |
| 4382 struct gaim_account *account = accts->data; | 3895 struct gaim_account *account = accts->data; |
| 4383 serv_rename_group(account->gc, g, new_name); | 3896 serv_rename_group(account->gc, g, new_name); |
| 4384 accts = g_slist_remove(accts, accts->data); | 3897 accts = g_slist_remove(accts, accts->data); |
| 4385 } | 3898 } |
| 4386 g_snprintf(g->name, sizeof(g->name), "%s", new_name); | 3899 g_snprintf(g->name, sizeof(g->name), "%s", new_name); |
| 4387 handle_group_rename(g, prevname); | 3900 gaim_blist_rename_group(g, prevname); |
| 4388 /* FIXME, i don't like calling this. it's sloppy. */ build_edit_tree(); | |
| 4389 g_free(prevname); | 3901 g_free(prevname); |
| 4390 } | 3902 } |
| 4391 gaim_blist_save(); | 3903 gaim_blist_save(); |
| 4392 } | 3904 } |
| 4393 } | 3905 } |
| 4404 GtkWidget *name_entry = NULL; | 3916 GtkWidget *name_entry = NULL; |
| 4405 | 3917 |
| 4406 g_free(filename); | 3918 g_free(filename); |
| 4407 | 3919 |
| 4408 if (!rename_dialog) { | 3920 if (!rename_dialog) { |
| 4409 rename_dialog = gtk_dialog_new_with_buttons(_("Gaim - Rename Group"), GTK_WINDOW(blist), GTK_DIALOG_MODAL, | 3921 rename_dialog = gtk_dialog_new_with_buttons(_("Rename Group"), GTK_WINDOW(gtkblist->window), GTK_DIALOG_MODAL, |
| 4410 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); | 3922 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); |
| 4411 gtk_dialog_set_default_response (GTK_DIALOG(rename_dialog), GTK_RESPONSE_OK); | 3923 gtk_dialog_set_default_response (GTK_DIALOG(rename_dialog), GTK_RESPONSE_OK); |
| 4412 gtk_container_set_border_width (GTK_CONTAINER(rename_dialog), 6); | 3924 gtk_container_set_border_width (GTK_CONTAINER(rename_dialog), 6); |
| 4413 gtk_window_set_resizable(GTK_WINDOW(rename_dialog), FALSE); | 3925 gtk_window_set_resizable(GTK_WINDOW(rename_dialog), FALSE); |
| 4414 gtk_dialog_set_has_separator(GTK_DIALOG(rename_dialog), FALSE); | 3926 gtk_dialog_set_has_separator(GTK_DIALOG(rename_dialog), FALSE); |
| 4481 destroy_dialog(rename_bud_dialog, rename_bud_dialog); | 3993 destroy_dialog(rename_bud_dialog, rename_bud_dialog); |
| 4482 return; | 3994 return; |
| 4483 } | 3995 } |
| 4484 | 3996 |
| 4485 if (new_name && (strlen(new_name) != 0) && strcmp(new_name, b->name)) { | 3997 if (new_name && (strlen(new_name) != 0) && strcmp(new_name, b->name)) { |
| 4486 struct group *g = find_group_by_buddy(b); | 3998 struct group *g = gaim_find_buddys_group(b); |
| 4487 char *prevname = g_strdup(b->name); | 3999 char *prevname = g_strdup(b->name); |
| 4488 if (g) | 4000 if (g) |
| 4489 serv_remove_buddy(b->account->gc, b->name, g->name); | 4001 serv_remove_buddy(b->account->gc, b->name, g->name); |
| 4490 g_snprintf(b->name, sizeof(b->name), "%s", new_name); | 4002 g_snprintf(b->name, sizeof(b->name), "%s", new_name); |
| 4491 serv_add_buddy(b->account->gc, b->name); | 4003 serv_add_buddy(b->account->gc, b->name); |
| 4492 handle_buddy_rename(b, prevname); | 4004 gaim_blist_rename_buddy(b, prevname); |
| 4493 gaim_blist_save(); | 4005 gaim_blist_save(); |
| 4494 g_free(prevname); | 4006 g_free(prevname); |
| 4495 } | 4007 } |
| 4496 | 4008 |
| 4497 destroy_dialog(rename_bud_dialog, rename_bud_dialog); | 4009 destroy_dialog(rename_bud_dialog, rename_bud_dialog); |
