diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 15:18:46 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 15:18:46 +0000 |
commit | 56294d30a82ec2da6f9ce399740c1ef65a9ddef4 (patch) | |
tree | bbe3823e41495d026ba8edc6eeaef166edb7e2a2 /plugins/core/gs-plugin-hardcoded-blocklist.c | |
parent | Initial commit. (diff) | |
download | gnome-software-56294d30a82ec2da6f9ce399740c1ef65a9ddef4.tar.xz gnome-software-56294d30a82ec2da6f9ce399740c1ef65a9ddef4.zip |
Adding upstream version 3.38.1.upstream/3.38.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'plugins/core/gs-plugin-hardcoded-blocklist.c')
-rw-r--r-- | plugins/core/gs-plugin-hardcoded-blocklist.c | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/plugins/core/gs-plugin-hardcoded-blocklist.c b/plugins/core/gs-plugin-hardcoded-blocklist.c new file mode 100644 index 0000000..f993535 --- /dev/null +++ b/plugins/core/gs-plugin-hardcoded-blocklist.c @@ -0,0 +1,78 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- + * vi:set noexpandtab tabstop=8 shiftwidth=8: + * + * Copyright (C) 2016 Richard Hughes <richard@hughsie.com> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <config.h> + +#include <fnmatch.h> +#include <gnome-software.h> + +/* + * SECTION: + * Blocklists some applications based on a hardcoded list. + */ + +void +gs_plugin_initialize (GsPlugin *plugin) +{ + /* need ID */ + gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_RUN_AFTER, "appstream"); +} + +static gboolean +refine_app (GsPlugin *plugin, + GsApp *app, + GsPluginRefineFlags flags, + GCancellable *cancellable, + GError **error) +{ + guint i; + const gchar *app_globs[] = { + "freeciv-server.desktop", + "links.desktop", + "nm-connection-editor.desktop", + "plank.desktop", + "*release-notes*.desktop", + "*Release_Notes*.desktop", + "Rodent-*.desktop", + "rygel-preferences.desktop", + "system-config-keyboard.desktop", + "tracker-preferences.desktop", + "Uninstall*.desktop", + "wine-*.desktop", + NULL }; + + /* not set yet */ + if (gs_app_get_id (app) == NULL) + return TRUE; + + /* search */ + for (i = 0; app_globs[i] != NULL; i++) { + if (fnmatch (app_globs[i], gs_app_get_id (app), 0) == 0) { + gs_app_add_quirk (app, GS_APP_QUIRK_HIDE_EVERYWHERE); + break; + } + } + + return TRUE; +} + +gboolean +gs_plugin_refine (GsPlugin *plugin, + GsAppList *list, + GsPluginRefineFlags flags, + GCancellable *cancellable, + GError **error) +{ + for (guint i = 0; i < gs_app_list_length (list); i++) { + GsApp *app = gs_app_list_index (list, i); + if (!refine_app (plugin, app, flags, cancellable, error)) + return FALSE; + } + + return TRUE; +} |