# HG changeset patch # User Ethan Blanton # Date 1224353733 0 # Node ID b3a2ba1560d213bb522ab34e1f40a4d9f6001ddf # Parent 2f83c37c65e3248c12b65954cb5c3f9245dd944c# Parent c8ed49367d86506f95d2178479160701d10b5746 merge of '8d34db0f9667ef7735bb95c82f854d1a46ef2ddc' and '94013736415b834ce7ec23cf10543099c1381874' diff -r 2f83c37c65e3 -r b3a2ba1560d2 finch/gntblist.c --- a/finch/gntblist.c Sat Oct 18 18:14:32 2008 +0000 +++ b/finch/gntblist.c Sat Oct 18 18:15:33 2008 +0000 @@ -794,37 +794,36 @@ { PurpleGroup *grp; - if (!group || !*group) - { + if (!group || !*group) { purple_notify_error(NULL, _("Error"), _("Error adding group"), _("You must give a name for the group to add.")); return; } grp = purple_find_group(group); - if (!grp) - { + if (!grp) { grp = purple_group_new(group); - if (ggblist) { - ggblist->new_group = g_list_prepend(ggblist->new_group, grp); - if (!ggblist->new_group_timeout) { - ggblist->new_group_timeout = purple_timeout_add_seconds(SHOW_EMPTY_GROUP_TIMEOUT, - remove_new_empty_group, NULL); - } - } purple_blist_add_group(grp, NULL); - - /* Select the new group */ - if (ggblist && ggblist->tree) { - FinchBlistNode *fnode = FINCH_GET_DATA((PurpleBlistNode*)grp); - if (fnode && fnode->row) - gnt_tree_set_selected(GNT_TREE(ggblist->tree), grp); - } } - else - { - purple_notify_error(NULL, _("Error"), _("Error adding group"), - _("A group with the name already exists.")); + + if (!ggblist) + return; + + /* Treat the group as a new group even if it had existed before. This should + * make things easier to add buddies to empty groups (new or old) without having + * to turn on 'show empty groups' setting */ + ggblist->new_group = g_list_prepend(ggblist->new_group, grp); + if (ggblist->new_group_timeout) + purple_timeout_remove(ggblist->new_group_timeout); + ggblist->new_group_timeout = purple_timeout_add_seconds(SHOW_EMPTY_GROUP_TIMEOUT, + remove_new_empty_group, NULL); + + /* Select the group */ + if (ggblist->tree) { + FinchBlistNode *fnode = FINCH_GET_DATA((PurpleBlistNode*)grp); + if (!fnode) + add_node((PurpleBlistNode*)grp, ggblist); + gnt_tree_set_selected(GNT_TREE(ggblist->tree), grp); } }