Refactor app listing to use a new GsAppQuery class
See the commit messages. The key improvements that this approach provides are:
- Consolidating a lot of similar plugin vfunc implementations into one. In particular, this means the implementation of refining search results, filtering, sorting and max-results can be shared.
- Adding
GsAppQuery:filter-func
allows callers to filter the results before max-results is applied, which can be used in future to fix a bug with the featured carousel, where the number of search results is truncated, and then the list is filtered for apps with hi-res icons, which can further truncate the results.
This replaces the ACTION_GET_RECENT
and ACTION_SEARCH_FILES
actions with a new GsPluginJobListApps
job and associated vfunc. Together with GsAppQuery
(which immutably represents a query), this job can be used to implement both old actions.
More actions could be replaced by GsPluginJobListApps
in future, but I’ve not done that in this MR to keep it simple and to validate the concept. If this MR gets accepted I’ll replace these additional actions in another MR:
GS_PLUGIN_ACTION_GET_POPULAR
GS_PLUGIN_ACTION_GET_FEATURED
GS_PLUGIN_ACTION_SEARCH
GS_PLUGIN_ACTION_SEARCH_PROVIDES
GS_PLUGIN_ACTION_GET_CATEGORY_APPS
GS_PLUGIN_ACTION_GET_ALTERNATES
I will probably also remove GsPluginJobListInstalledApps
in favour of using GsPluginJobListApps
with a new is-installed
property in GsAppQuery
in a followup MR, if this one is accepted.
I tested that ACTION_GET_RECENT
still works by looking at the “New & Updated” sections on the overview and in a category, and verifying that the same apps are listed there as without the branch applied. I tested that ACTION_SEARCH_FILES
still works by running:
gdbus call --session --dest org.gnome.Software --object-path /org/gnome/Software --method org.gtk.Actions.Activate '"install-resources"' "[<('install-provide-files', ['/usr/bin/evolution'], 'startup-id', 'desktop-id', 'ident')>]" "@a{sv} {}"
Helps: #1472