tuner
tuner copied to clipboard
Starred stations should be sorted
It becomes "messy", and difficult to find specific stations within the starred list once you've added lots of stations. Besides it's good UI "hygiene" to always sort lists of things in the UI.
There's a separate ER (109) discussing more advanced options, but alpha sorting by default is the first step, and is also a trivial change.
The fix is to change get_starred in DirectoryController.vala from:
/**
* @brief Get all starred stations.
*
* @return An Collection of starred Model.Station objects.
*/
public Collection<Model.Station> get_starred () {
return _star_store.get_all_stations();
} // get_starred
To:
/**
* @brief Get all starred stations.
*
* @return An Collection of starred Model.Station objects.
*/
public Collection<Model.Station> get_starred () {
var stations = _star_store.get_all_stations();
// Sort stations alphabetically by name
var sorted = new ArrayList<Model.Station>();
foreach (var station in stations) {
sorted.add(station);
}
sorted.sort((a, b) => a.name.collate(b.name));
return sorted;
} // get_starred
With the fix:
(No relation to this issue, but I also changed DisplayButton.vala's TITLE_WIDTH from 25 to 30 in my local copy)