Sorting order for filenames
- From: Ole Laursen <olau hardworking dk>
- To: nautilus-list gnome org
- Cc: Ole Laursen <olau hardworking dk>
- Subject: Sorting order for filenames
- Date: Thu, 19 May 2005 18:38:33 +0200
Hi,
I recently discovered that filenames are sorted incorrectly when using
a locale. For instance, you get the sorting
event.C
eventgenerator.C
eventgenerator.h
event.h
both in the file selector and in Nautilus, even in the en_US locale.
I've reported a bug in GTK+:
http://bugzilla.gnome.org/show_bug.cgi?id=172690
Now, it turns out that the problem can be fixed by making a custom
collate key generation function (instead of using g_utf8_collate_key).
I've made one that fixes both the above problem with dots and also
sorts numbers better, e.g. as
file1.txt
file2.txt
file10.txt
The algorithm sorts files with small basenames before files with large
basenames and small numbers before large ones. The cleanest solution
seems to be to put the function in glib, but it was suggested in the
above bug report that I asked here first for comments on the sorting
algorithm. An implementation of the algorithm as a patch for GTK+ 2.6
for testing purposes is attached to the bug report.
So what do you think?
Please keep the CC as I'm not subscribed to the list,
--
Ole Laursen
http://www.cs.aau.dk/~olau/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]