changeset 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 cf6f32628f8f
files console/gntblist.c console/libgnt/gnttree.c
diffstat 2 files changed, 24 insertions(+), 13 deletions(-) [+]
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
--- a/console/libgnt/gnttree.c	Sat Jun 24 10:10:53 2006 +0000
+++ b/console/libgnt/gnttree.c	Sat Jun 24 20:06:37 2006 +0000
@@ -6,6 +6,7 @@
 enum
 {
 	SIG_SELECTION_CHANGED,
+	SIG_SCROLLED,
 	SIGS,
 };
 
@@ -345,6 +346,14 @@
 					 NULL, NULL,
 					 gnt_closure_marshal_VOID__POINTER_POINTER,
 					 G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_POINTER);
+	signals[SIG_SCROLLED] = 
+		g_signal_new("scrolled",
+					 G_TYPE_FROM_CLASS(klass),
+					 G_SIGNAL_RUN_LAST,
+					 0,
+					 NULL, NULL,
+					 g_cclosure_marshal_VOID__INT,
+					 G_TYPE_NONE, 1, G_TYPE_INT);
 
 	DEBUG;
 }
@@ -445,6 +454,7 @@
 	}
 
 	redraw_tree(tree);
+	g_signal_emit(tree, signals[SIG_SCROLLED], 0, count);
 }
 
 static int