changeset 9632:885bba4f9d3b

[gaim-migrate @ 10476] [ 900234 ] Auto expand at bottom of buddy list has problems committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Sun, 01 Aug 2004 13:04:50 +0000
parents 71c31e4505fd
children 81b31af2752d
files src/gtkblist.c
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkblist.c	Sun Aug 01 04:50:33 2004 +0000
+++ b/src/gtkblist.c	Sun Aug 01 13:04:50 2004 +0000
@@ -1027,7 +1027,9 @@
 gaim_gtk_blist_expand_contact_cb(GtkWidget *w, GaimBlistNode *node)
 {
 	struct _gaim_gtk_blist_node *gtknode;
+	GtkTreeIter iter, parent;
 	GaimBlistNode *bnode;
+	GtkTreePath *path;		
 
 	if(!GAIM_BLIST_NODE_IS_CONTACT(node))
 		return;
@@ -1039,7 +1041,20 @@
 	for(bnode = node->child; bnode; bnode = bnode->next) {
 		gaim_gtk_blist_update(NULL, bnode);
 	}
+	
+	/* This ensures that the bottom buddy is visible, i.e. not scrolled off the alignment */
+	get_iter_from_node(node, &parent);
+	gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(gtkblist->treemodel), &iter, &parent, 
+				      gtk_tree_model_iter_n_children(GTK_TREE_MODEL(gtkblist->treemodel), &parent) -1);
+	path = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &iter);
+	/* Let the treeview draw so it knows where to scroll */
+	while (gtk_events_pending())
+		gtk_main_iteration();
+	gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW(gtkblist->treeview), path, NULL, FALSE, 0, 0); 
+	
+
 	gaim_gtk_blist_update(NULL, node);
+	gtk_tree_path_free(path);
 }
 
 static void