diff console/gntblist.c @ 13865:d78ab363e02d

[gaim-migrate @ 16331] Make the tooltips move to the right place when the selected item goes up/down when someone signs on/off. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 24 Jun 2006 20:06:37 +0000
parents c7d84d4c5afa
children 5642f4658b59
line wrap: on
line diff
--- a/console/gntblist.c	Sat Jun 24 10:10:53 2006 +0000
+++ b/console/gntblist.c	Sat Jun 24 20:06:37 2006 +0000
@@ -24,6 +24,7 @@
 
 static void add_buddy(GaimBuddy *buddy, GGBlist *ggblist);
 static void add_group(GaimGroup *group, GGBlist *ggblist);
+static void add_node(GaimBlistNode *node, GGBlist *ggblist);
 static void draw_tooltip(GGBlist *ggblist);
 
 static void
@@ -31,6 +32,15 @@
 {
 }
 
+static void add_node(GaimBlistNode *node, GGBlist *ggblist)
+{
+	if (GAIM_BLIST_NODE_IS_BUDDY(node))
+		add_buddy((GaimBuddy*)node, ggblist);
+	else if (GAIM_BLIST_NODE_IS_GROUP(node))
+		add_group((GaimGroup*)node, ggblist);
+	draw_tooltip(ggblist);
+}
+
 static void
 remove_tooltip(GGBlist *ggblist)
 {
@@ -56,14 +66,8 @@
 		GaimGroup *group = gaim_buddy_get_group((GaimBuddy*)node);
 		if (gaim_blist_get_group_online_count(group) == 0)
 			node_remove(list, (GaimBlistNode*)group);
-		else if (ggblist->tnode == (GaimBlistNode *)group)	/* Need to update the counts */
-			draw_tooltip(ggblist);
 	}
-
-	if (ggblist->tnode == node)
-	{
-		remove_tooltip(ggblist);
-	}
+	draw_tooltip(ggblist);
 }
 
 static void
@@ -73,7 +77,7 @@
 	{
 		GaimBuddy *buddy = (GaimBuddy*)node;
 		if (gaim_presence_is_online(gaim_buddy_get_presence(buddy)))
-			add_buddy(buddy, list->ui_data);
+			add_node((GaimBlistNode*)buddy, list->ui_data);
 		else
 			node_remove(gaim_get_blist(), node);
 	}
@@ -171,19 +175,16 @@
 		return;
 
 	group = gaim_buddy_get_group(buddy);
-	add_group(group, ggblist);
+	add_node((GaimBlistNode*)group, ggblist);
 
 	node->ui_data = gnt_tree_add_row_after(GNT_TREE(ggblist->tree), buddy,
 				get_buddy_display_name(buddy), group, NULL);
-
-	if (ggblist->tnode == (GaimBlistNode*)group)
-		draw_tooltip(ggblist);
 }
 
 static void
 buddy_signed_on(GaimBuddy *buddy, GGBlist *ggblist)
 {
-	add_buddy(buddy, ggblist);
+	add_node((GaimBlistNode*)buddy, ggblist);
 }
 
 static void