[gnome-software/wip/kalev/hide-from-search-quirk: 5/5] Add HIDE_FROM_SEARCH quirk
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/kalev/hide-from-search-quirk: 5/5] Add HIDE_FROM_SEARCH quirk
- Date: Thu, 2 May 2019 10:01:29 +0000 (UTC)
commit 90f65c68eca42787cf2ca161cdcc155ce8159960
Author: Kalev Lember <klember redhat com>
Date: Fri Apr 19 07:17:00 2019 +0200
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.
lib/gs-app.c | 2 ++
lib/gs-app.h | 2 ++
lib/gs-plugin-loader.c | 8 ++++++++
3 files changed, 12 insertions(+)
---
diff --git a/lib/gs-app.c b/lib/gs-app.c
index d5a30927..186ceb54 100644
--- a/lib/gs-app.c
+++ b/lib/gs-app.c
@@ -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;
}
diff --git a/lib/gs-app.h b/lib/gs-app.h
index f6421f0b..cd185154 100644
--- a/lib/gs-app.h
+++ b/lib/gs-app.h
@@ -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;
diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c
index ca0504a3..aa775e9e 100644
--- a/lib/gs-plugin-loader.c
+++ b/lib/gs-plugin-loader.c
@@ -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",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]