[gnome-software] Do not do a substring match when adding compulsory applications
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Do not do a substring match when adding compulsory applications
- Date: Thu, 22 Sep 2016 07:18:12 +0000 (UTC)
commit d902b3aacac0101ca5981faf025e4437b90ecb59
Author: Richard Hughes <richard hughsie com>
Date: Thu Sep 22 08:17:46 2016 +0100
Do not do a substring match when adding compulsory applications
src/plugins/gs-appstream.c | 29 +++++++++++++++--------------
1 files changed, 15 insertions(+), 14 deletions(-)
---
diff --git a/src/plugins/gs-appstream.c b/src/plugins/gs-appstream.c
index cc51d9b..37ba08b 100644
--- a/src/plugins/gs-appstream.c
+++ b/src/plugins/gs-appstream.c
@@ -497,18 +497,6 @@ gs_appstream_get_bundle_kind (AsApp *item)
return AS_BUNDLE_KIND_UNKNOWN;
}
-static gboolean
-gs_utils_is_current_desktop (const gchar *name)
-{
- const gchar *tmp;
- g_auto(GStrv) names = NULL;
- tmp = g_getenv ("XDG_CURRENT_DESKTOP");
- if (tmp == NULL)
- return FALSE;
- names = g_strsplit (tmp, ":", -1);
- return g_strv_contains ((const gchar * const *) names, name);
-}
-
gboolean
gs_appstream_refine_app (GsPlugin *plugin,
GsApp *app,
@@ -519,6 +507,7 @@ gs_appstream_refine_app (GsPlugin *plugin,
GPtrArray *array;
GPtrArray *pkgnames;
GPtrArray *kudos;
+ const gchar *current_desktop;
const gchar *tmp;
guint i;
@@ -665,11 +654,23 @@ gs_appstream_refine_app (GsPlugin *plugin,
gs_app_get_project_group (app) == NULL)
gs_app_set_project_group (app, as_app_get_project_group (item));
- /* this is a core application for the desktop and cannot be removed */
+ /*
+ * Set the core applications for the current desktop that cannot be
+ * removed -- but note: XDG_CURRENT_DESKTOP="GNOME" is different to
+ * XDG_CURRENT_DESKTOP="Ubuntu:GNOME" here.
+ *
+ * To define what is compulsory for the hybrid desktop either:
+ *
+ * - Add an appstream merge file downstream with the tag
+ * <compulsory_for_desktop>Ubuntu:GNOME</compulsory_for_desktop>
+ *
+ * - Get upstream projects to add the <compulsory_for_desktop> tag
+ */
array = as_app_get_compulsory_for_desktops (item);
+ current_desktop = g_getenv ("XDG_CURRENT_DESKTOP");
for (i = 0; i < array->len; i++) {
tmp = g_ptr_array_index (array, i);
- if (gs_utils_is_current_desktop (tmp)) {
+ if (g_strcmp0 (current_desktop, tmp) == 0) {
gs_app_add_quirk (app, AS_APP_QUIRK_COMPULSORY);
break;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]