# HG changeset patch # User Sadrul Habib Chowdhury # Date 1224349947 0 # Node ID c8ed49367d86506f95d2178479160701d10b5746 # Parent c1e58cfd1107abb323b05c5cccfb2e34efc45489 Instead of showing error message when trying to interactively add an existing group, treat it as a new empty group (ie. show it even if 'show empty groups' setting is turned off) diff -r c1e58cfd1107 -r c8ed49367d86 finch/gntblist.c --- a/finch/gntblist.c Thu Oct 16 22:20:52 2008 +0000 +++ b/finch/gntblist.c Sat Oct 18 17:12:27 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); } }