GNOME Bugzilla – Bug 448343
File chooser should maintain sort state during folder switches
Last modified: 2010-08-11 16:35:33 UTC
[ forwarded from http://bugs.debian.org/428873 from Emil Nowak ] Steps to reproduce: 1. Open filechooser dialog (ie. from gimp) 2. Click on the "Modified" column header, to sort by modify time [a little arrow appears in this header indicating sort column] 3. Go to some sub-directory [Now we have two sort indicators: one o a "Name" and second on "Modified" header] Of course there should be one sort indicator - this previously selected (on "Modified" column.) Screenshot: http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=5;filename=gtk2+-+sort+indicator+on+two+columns.png;att=1;bug=428873 ---- This bug is perfectly reproducible for me on gtk 2.10.
Created attachment 95649 [details] [review] patch This patch fixes the bug here (only slightly tested though): it stores the selected sort column in impl and resets it when creating a new model when the folder changes instead of always using the NAME column
(In reply to comment #1) > Created an attachment (id=95649) [edit] > patch > > This patch fixes the bug here (only slightly tested though): it stores the > selected sort column in impl and resets it when creating a new model when the > folder changes instead of always using the NAME column seems all right, except for: + if (gtk_tree_sortable_get_sort_column_id (sortable, &col, &sort_type)) + { + impl->list_sort_column = col; + impl->list_sort_ascending = (sort_type == GTK_SORT_ASCENDING); + } I would store the sort type as list_sort_type and then reuse it directly, to avoid the long ternary later: + gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (impl->sort_model), + impl->list_sort_column, + impl->list_sort_ascending ? GTK_SORT_ASCENDING : GTK_SORT_DESCENDING); with impl->list_sort_type. just for readability.
Committed the GtkTreeView part as GtkTreeViewColumns were not properly resetting the arrow display: 2007-10-01 Kristian Rietveld <kris@imendio.com> * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_update_button): fix up if-condition to only set the true arrow type if show_sort_indicator is TRUE. (#448343, reported by Emil Nowak). The file chooser seems to reset the sort state by creating a new sort model in load_set_model(); it is up to you guys to decide whether you want to maintain the sort state or not. Updating subject.
This seems to work fine now (in GTK+ 2.18.6)