changeset 912:5a517b4f0be4

[gaim-migrate @ 922] no more hanging trees, only electric chairs. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Thu, 14 Sep 2000 23:22:11 +0000
parents 65c8bd1feec5
children 8de59874f5ce
files src/buddy.c
diffstat 1 files changed, 38 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/buddy.c	Thu Sep 14 22:47:19 2000 +0000
+++ b/src/buddy.c	Thu Sep 14 23:22:11 2000 +0000
@@ -198,9 +198,11 @@
 	GList *mem;
         struct buddy *b;
 	struct group *g;
+	int count;
 
         while(grp) {
 		g = (struct group *)grp->data;
+		count = 0;
                 mem = g->members;
                 while(mem) {
 			b = (struct buddy *)mem->data;
@@ -208,8 +210,14 @@
                         if (b->present || !GTK_WIDGET_VISIBLE(b->item))
 				set_buddy(b);
 
+			if (b->present) count++;
+
                         mem = mem->next;
                 }
+		/* this is a fall-back in case we missed any */
+		if (!count) gtk_widget_hide(g->item);
+		else gtk_widget_show(g->item);
+
                 grp = grp->next;
         }
 
@@ -471,6 +479,8 @@
 {
 	GList *grp;
 	GList *mem;
+	struct buddy *b;
+	int count = 0;
 	
 	struct group *delg;
 	struct buddy *delb;
@@ -486,6 +496,14 @@
         delg->members = g_list_remove(delg->members, delb);
         serv_remove_buddy(delb->name);
         g_free(delb);
+	mem = delg->members;
+	while (mem && !count) {
+		b = (struct buddy *)mem->data;
+		if (b->present) count++;
+		mem = mem->next;
+	}
+	if (!count) gtk_widget_hide(delg->item);
+	
 
         serv_save_config();
 
@@ -578,8 +596,8 @@
 	if (!parent) {
 		GList *grps, *buds;
 		struct group *g, *g2;
-		GList *tmp;
-		int pos;
+		GList *tmp, *mem;
+		int pos, count;
 		struct buddy *b;
 		/* Okay we've moved group order... */
 
@@ -609,7 +627,13 @@
                 groups = g_list_remove(groups, g);
 
                 g->item = gtk_tree_item_new_with_label(g->name);
-                gtk_widget_show(g->item);
+		mem = g->members; count = 0;
+		while (mem && !count) {
+			b = (struct buddy *)mem->data;
+			if (b->present) count++;
+			mem = mem->next;
+		}
+		if (!count) gtk_widget_show(g->item);
 
 		if (sibling) {
 			g2 = find_group(target2);
@@ -715,8 +739,18 @@
                 
                 update_num_groups();
                 update_show_idlepix();
-		if (b->present)
+		if (b->present) {
+			GList *mem = old_g->members;
+			struct buddy *bt;
+			int count = 0;
+			while (mem && !count) {
+				bt = (struct buddy *)mem->data;
+				if (bt->present) count++;
+				mem = mem->next;
+			}
+			if (!count) gtk_widget_hide(old_g->item);
 			gtk_widget_show(new_g->item);
+		}
                 set_buddy(b);