pidgin: 94013736: Instead of showing error message when tr...

sadrul at pidgin.im sadrul at pidgin.im
Sat Oct 18 13:50:40 EDT 2008


-----------------------------------------------------------------
Revision: 94013736415b834ce7ec23cf10543099c1381874
Ancestor: ac786ea6156dee361dab547dbc902b9ac3920a0a
Author: sadrul at pidgin.im
Date: 2008-10-18T17:12:27
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/94013736415b834ce7ec23cf10543099c1381874

Modified files:
        finch/gntblist.c

ChangeLog: 

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)

-------------- next part --------------
============================================================
--- finch/gntblist.c	4d61e43bf4c31d16b63e0dc357e473c463934661
+++ finch/gntblist.c	f8c33f33cc629c0355a7fde8f3f693b46586e043
@@ -794,38 +794,37 @@ add_group_cb(gpointer null, const char *
 {
 	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);
-		}
+	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);
 	}
-	else
-	{
-		purple_notify_error(NULL, _("Error"), _("Error adding group"),
-				_("A group with the name already exists."));
-	}
 }
 
 static void


More information about the Commits mailing list