xbmc/xbmc — pull request #3137 by jmbreuer (2013-08-23 14:35:53+00:00)
Title: Differentiate between "unsorted" and "unsortable"

The cleanup committed as 7ec41ee12967345673bad456d6d52a7a04a4f235 folds both `SORT_METHOD_NONE` (meaning "unsortable") and `SORT_METHOD_UNSORTED` (meaning "not sorted by one of the known criteria") into the new `SortByNone`.

This lack of differentiation breaks the sorting ability of a number of item lists; most prominently those generated by plugins. For an example, see channel lists in the YouTube plugin. It is not possible to apply sorting to lists with `SortByNone` in the UI, due to `CGUIMediaWindow::UpdateButtons()` at line 549.

This patch re-introduces a separate `SortByUnsorted` state, and treats this the same as the old `SORT_METHOD_UNSORTED`.

Suggestions for a better name than `SortByUnsorted` are more than welcome.

Note: When switching to the `SortByUnsorted` state (shown as "Sort by: Default" in the default Confluence skin), no sorting takes place at all.
I.e. the list does not necessarily return to the sort order originally produced by a plugin.
As far as I know, that's how the old `SORT_METHOD_UNSORTED` used to behave as well; and is a known issue for plugins (wanted to link to an issue here, but cannot find it again right now).

Ideally, items in lists with `SORT_METHOD_UNSORTED` could be extended by a position attribute, and could then be sort accordingly when returning to `SortByUnsorted`. Which could then be more appropriately named `SortByPosition` or `SortByNatural` or somesuch.