| Summary: | sort package names in pk-application | ||
|---|---|---|---|
| Product: | PackageKit | Reporter: | Ben Liblit <liblit> |
| Component: | General | Assignee: | Richard Hughes <richard> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | medium | ||
| Version: | unspecified | ||
| Hardware: | x86 (IA32) | ||
| OS: | Linux (All) | ||
| Whiteboard: | |||
| i915 platform: | i915 features: | ||
|
Description
Ben Liblit
2008-02-13 15:00:44 UTC
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? Richard. 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 -1 else: 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. |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.