lib: Port from GS_PLUGIN_LIST_APPS_FILTER_FREELY_LICENSED to GsAppQuery:license-type

Philip Withnall requested to merge pwithnall/gnome-software:foss-updates into main

Port the implementation of the filtering in GsPluginJobListApps and all the call sites.

Eventually plugins could now query GsAppQuery:license-type and use that to be more specific in the results they return. For now, though, the implementation follows the example of the other filtering operations in GsPluginJobListApps, and it’s entirely implemented in the GsPluginJobListApps class.

Similarly, this keeps the approach used in GsShell and GsPage to propagate settings data down to the app queries in pages using gs_shell_get_query_license_type() and gs_page_get_query_license_type(). It doesn’t feel right to have those methods on those classes (what is the ‘license type’ of a UI page?), but it’s convenient for now. Probably the eventual solution is to create a class to wrap GSettings, and pass a singleton instance of that around. Then it’d be easy to substitute it for a dummy implementation for testing, avoiding the need to mock up the GSettings database.

Signed-off-by: Philip Withnall

Helps: !1515 (merged)

Merge request reports