changeset 13510:65486b7e8e45

[gaim-migrate @ 15886] SF Patch #1446662 from Sadrul "This patch keeps the selected node selected after the buddy-list is redrawn." committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Tue, 14 Mar 2006 07:30:52 +0000
parents 56abb67edec9
children 4191d39bd70e
files src/gtkblist.c
diffstat 1 files changed, 25 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkblist.c	Tue Mar 14 07:25:54 2006 +0000
+++ b/src/gtkblist.c	Tue Mar 14 07:30:52 2006 +0000
@@ -3347,10 +3347,35 @@
 
 static void _prefs_change_redo_list()
 {
+	GtkTreeSelection *sel;
+	GtkTreeIter iter;
+	GaimBlistNode *node = NULL;
+
+	sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkblist->treeview));
+	if (gtk_tree_selection_get_selected(sel, NULL, &iter))
+	{
+		gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1);
+	}
+
 	redo_buddy_list(gaim_get_blist(), TRUE);
 #if GTK_CHECK_VERSION(2,6,0)
 	gtk_tree_view_columns_autosize(GTK_TREE_VIEW(gtkblist->treeview));
 #endif
+
+	if (node)
+	{
+		struct _gaim_gtk_blist_node *gtknode;
+		GtkTreePath *path;
+
+		gtknode = node->ui_data;
+		if (gtknode && gtknode->row)
+		{
+			path = gtk_tree_row_reference_get_path(gtknode->row);
+			gtk_tree_selection_select_path(sel, path);
+			gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(gtkblist->treeview), path, NULL, FALSE, 0, 0);
+			gtk_tree_path_free(path);
+		}
+	}
 }
 
 static void _prefs_change_sort_method(const char *pref_name, GaimPrefType type,