[PATCH] Bug #144803 Selected items not preserved correctly when list re-sorted



Hi everyone,

I've attached a patch which should fix the bug in Nautilus' list view
where selected items aren't correctly preserved when clicking on
different sort columns.

The problem was that the 'new_order' array wasn't being filled-in correctly.

I've already attached a patch to the bug report:
http://bugzilla.gnome.org/show_bug.cgi?id=144803

It's my first patch, so please let me know if I need to make any changes. :)

Thanks!

Jimmy
Index: fm-list-model.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-list-model.c,v
retrieving revision 1.31
diff -u -p -r1.31 fm-list-model.c
--- fm-list-model.c	8 Jun 2004 17:35:11 -0000	1.31
+++ fm-list-model.c	1 Oct 2004 01:08:02 -0000
@@ -455,13 +455,15 @@ fm_list_model_sort (FMListModel *model)
 
 	/* generate new order */
 	new_order = g_new (int, length);
+	/* Note: new_order[newpos] = oldpos */
 	for (i = 0; i < length; ++i) {
-		new_order[i] = g_sequence_ptr_get_position (old_order[i]);
+		new_order[g_sequence_ptr_get_position(old_order[i])] = i;
 	}
 
 	/* Let the world know about our new order */
-	path = gtk_tree_path_new ();
-
+	path = gtk_tree_path_new();
+	
+	
 	g_assert (new_order != NULL);
 	gtk_tree_model_rows_reordered (GTK_TREE_MODEL (model),
 				       path, NULL, new_order);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]