GtkTreeListRowSorter not suitable for reverse-sorting (for example in collumview)
Steps to reproduce
- Have a modern tree, in ideally a collumnview, with a TreeListRowSorter
- Sort it
- Click the header again to sort it in reverse
An example (not written in c): https://pastebin.com/QwLQs0rh
Current behavior
The children of an item then come above the item, instead of below it.
-------
item4:
- item1
- item2
item5:
- item
-------
Becomes
-------
- item
item5:
- item2
- item1
item4:
-------
This contradicts the GtkTreeExpander's expanded arrow's direction, and can be hard to understand
Expected outcome
The expected outcome is that while the items of a level are sorted, they always come after their parent.
-------
item5:
- item
item4:
- item1
- item2
--------
This was also the behavior in GtkTreeView
Also, maybe this isn't possible to fix, if the sorter can't know for which direction it is being sorted for, only just that two values are being compared? What is the recommended workaround for this then? Not use reverse sorting? If so, there should be an easy way to dis-sallow it in columnview.
Version information
current, happens self-built and not
Additional information
Video
My current workaround for this is to patch GTK to make columnviewcolumnsorter ignore it's inverted property when sorting, and instead for it to be publically exposed, and then have the sorter you are using implement inversion, which sits below the treelistrowsorter, and makes it work correctly. The API needs to allow handling inversion in the user provided sorter, not the columnviewcolumnsorter