Provide workaround for broken "g_utf8_collate_key_for_filename"
g_utf8_collate_key_for_filename
provides some automatic smartness which is often not desired:
See this comments:
https://gitlab.gnome.org/GNOME/glib/-/issues/1344#note_1652000
In a nutshell, what the filename sorting does is to break the names into segments that are either words or numbers, and compare the words alphabetically, and the numbers numerically.
This issue is about the implementation of a workaround, until the issue is fixed upstream.
Related/Duplicate Thunar Issues: #68 (closed), #1015 (closed), #1656 (closed)
Use Case1
mkdir -p test && touch test/194P && touch test/196A && touch test/20P
Expected result (ls): 194P 196A 20P
Current result (thunar): 196A 194P 20P
What happens: g_utf8_collate_key_for_filename
numerically compares 196, 194 and 20 and sorts the files in that order.
Use Case2
mkdir -p test && touch test/2OP && touch test/01Z && touch test/003
Expected result (ls): 003 01Z 2OP
Current result (thunar): 003 2OP 01Z
What happens: g_utf8_collate_key_for_filename
extracts the numbers, drops any leading zeros and then compares the plain number 1, 2 and 3
Desired fix: Instead of doing that automatic smartness, the user should have the possiblity to use a xfconf flag to toggle between "plain sorting" (just like ls) and "smart sorting"