changeset 24180:b3a2ba1560d2

merge of '8d34db0f9667ef7735bb95c82f854d1a46ef2ddc' and '94013736415b834ce7ec23cf10543099c1381874'
author Ethan Blanton <elb@pidgin.im>
date Sat, 18 Oct 2008 18:15:33 +0000
parents 2f83c37c65e3 (current diff) c8ed49367d86 (diff)
children 2f6474a88f9e
files
diffstat 1 files changed, 21 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- 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);
 	}
 }