Commit 90f65c68 authored by Kalev Lember's avatar Kalev Lember Committed by Richard Hughes

Add HIDE_FROM_SEARCH quirk

This allows plugins to control if apps are discoverable or not.

Discoverable here means that they get hidden from search results and
category views, unless they are already installed. This makes it
possible to launch and remove and update already installed apps, but
hides them otherwise.

This is going to be used in the rpm-ostree plugin to hide package-based
desktop apps on Fedora Silverblue and only show flatpak apps by default.
parent 0df123c9
Pipeline #79059 passed with stage
in 15 minutes and 58 seconds
......@@ -243,6 +243,8 @@ _as_app_quirk_flag_to_string (GsAppQuirk quirk)
return "new-permissions";
if (quirk == GS_APP_QUIRK_PARENTAL_NOT_LAUNCHABLE)
return "parental-not-launchable";
if (quirk == GS_APP_QUIRK_HIDE_FROM_SEARCH)
return "hide-from-search";
return NULL;
}
......
......@@ -85,6 +85,7 @@ typedef enum {
* @GS_APP_QUIRK_PARENTAL_FILTER: The app has been filtered by parental controls, and should be hidden
* @GS_APP_QUIRK_NEW_PERMISSIONS: The update requires new permissions
* @GS_APP_QUIRK_PARENTAL_NOT_LAUNCHABLE: The app cannot be run by the current user due to parental controls, and should not be launchable
* @GS_APP_QUIRK_HIDE_FROM_SEARCH: The app should not be shown in search results
*
* The application attributes.
**/
......@@ -105,6 +106,7 @@ typedef enum {
GS_APP_QUIRK_PARENTAL_FILTER = 1 << 12, /* Since: 3.32 */
GS_APP_QUIRK_NEW_PERMISSIONS = 1 << 13, /* Since: 3.32 */
GS_APP_QUIRK_PARENTAL_NOT_LAUNCHABLE = 1 << 14, /* Since: 3.32 */
GS_APP_QUIRK_HIDE_FROM_SEARCH = 1 << 15, /* Since: 3.32 */
/*< private >*/
GS_APP_QUIRK_LAST
} GsAppQuirk;
......
......@@ -1226,6 +1226,14 @@ gs_plugin_loader_app_is_valid (GsApp *app, gpointer user_data)
return FALSE;
}
/* don't show apps with hide-from-search quirk, unless they are already installed */
if (!gs_app_is_installed (app) &&
gs_app_has_quirk (app, GS_APP_QUIRK_HIDE_FROM_SEARCH)) {
g_debug ("app invalid as hide-from-search quirk set %s",
gs_plugin_loader_get_app_str (app));
return FALSE;
}
/* don't show sources */
if (gs_app_get_kind (app) == AS_APP_KIND_SOURCE) {
g_debug ("app invalid as source %s",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment