From 8a8591a3d6545ebe88c9e0967e934660184e276f Mon Sep 17 00:00:00 2001 From: Oliver Duis Date: Fri, 15 Jul 2011 07:58:20 +0200 Subject: [PATCH] Fixed places sort order on Windows see issue 842 --- rtgui/placesbrowser.cc | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/rtgui/placesbrowser.cc b/rtgui/placesbrowser.cc index 45332a734..8e6eebec7 100644 --- a/rtgui/placesbrowser.cc +++ b/rtgui/placesbrowser.cc @@ -76,6 +76,11 @@ PlacesBrowser::PlacesBrowser () : listener (NULL) { show_all (); } +// For drive letter comparison +bool compareMountByRoot (Glib::RefPtr a,Glib::RefPtr b) { + return a->get_root()->get_parse_name() < b->get_root()->get_parse_name(); +} + void PlacesBrowser::refreshPlacesList () { placesModel->clear (); @@ -173,8 +178,16 @@ void PlacesBrowser::refreshPlacesList () { } } } - // placess not belonging to volumes + + // places not belonging to volumes + // (Drives in Windows) std::vector > mounts = vm->get_mounts (); + +#ifdef WIN32 + // on Windows, it's usual to sort by drive letter, not by name + std::sort (mounts.begin(), mounts.end(), compareMountByRoot); +#endif + for (int i=0; iget_volume ()) { Gtk::TreeModel::Row newrow = *(placesModel->append());