When pk-application shows a list of packages matching the user's search and filter criteria, it shows installed packages first followed by non-installed packages. However, within each of those two groups, packages seem to be in arbitrary order. I'd prefer to see installed packages be sorted by name, then non-installed packages also sorted by name.
version and configuration details:
- installed via prebuilt FC8 RPMs
- distribution: Fedora 8
Good idea. Should we sort these in the daemon, the client library or the UI application itself? I would vote for the latter as it's an interface issue.
I'm not sure how we can do this with a TreeView. Would it be the end of the world if the list was sortable and not split into installed and available?
Are there are reasonable situations in which sorting is not needed? For example, perhaps an automated tool is consuming the output and couldn't care less what order things appear in. If that's the case, then sorting it in the GUI application seems sensible. I don't really have a strong opinion on this.
Sorting the GtkTreeView should be possible. The API offered by GtkTreeSortable (http://library.gnome.org/devel/gtk/unstable//GtkTreeSortable.html) seems rich enough. It ultimately comes down to a binary comparison function. So pseudo-code like the following ought to work:
compare(package a, package b):
if a.installed and not b.installed:
return stringCompare(a.name, b.name)
You'd effectively be doing a lexical sort on (installed, name) tuples.
I suppose an alternative would be to have "Installed" and "Name" column headings that the user could click to sort. If changing sort criteria uses a stable sort, then clicking "Name" followed by "Installed" would leave the list grouped by install status and then sorted by name within each group.
I have limited technical knowledge of tree views/models/sorts, so I'll stop speculating on how this *could* be done. But it ought to be feasible.
I've sorted these by name, as it think it's the most obvious thing to do. Sorting by installed and then name is very tricky (you have to do 2 passes looking at both arrays) and isn't that obvious when searching for a package in the list in my opinion.