summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2019-02-06 13:14:57 +0000
committerRichard Hughes <richard@hughsie.com>2019-02-06 13:15:29 +0000
commite15a71feaefaf1aa1970f9e87672c29c48ed2a0e (patch)
treeba1680ce1d4284ae07ac0e19b755c5fa423146ac
parent255eef9c11b0fb855c02f4e0d5ef3edad6efb3c7 (diff)
downloadappstream-glib-e15a71feaefaf1aa1970f9e87672c29c48ed2a0e.tar.gz
Do not overwrite the project group using heuristics if already set
Fixes https://github.com/hughsie/appstream-glib/issues/236
-rw-r--r--libappstream-glib/as-app-desktop.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/libappstream-glib/as-app-desktop.c b/libappstream-glib/as-app-desktop.c
index 5a3768c..c2d6555 100644
--- a/libappstream-glib/as-app-desktop.c
+++ b/libappstream-glib/as-app-desktop.c
@@ -44,18 +44,20 @@ as_app_desktop_key_get_locale (const gchar *key)
}
static gboolean
-as_app_infer_file_key (AsApp *app,
- GKeyFile *kf,
- const gchar *key,
- GError **error)
+as_app_infer_kudos (AsApp *app, GKeyFile *kf, const gchar *key, GError **error)
{
- g_autofree gchar *tmp = NULL;
-
if (g_strcmp0 (key, "X-GNOME-UsesNotifications") == 0) {
as_app_add_kudo_kind (AS_APP (app),
AS_KUDO_KIND_NOTIFICATIONS);
+ }
+ return TRUE;
+}
- } else if (g_strcmp0 (key, "X-GNOME-Bugzilla-Bugzilla") == 0) {
+static gboolean
+as_app_infer_project_group (AsApp *app, GKeyFile *kf, const gchar *key, GError **error)
+{
+ g_autofree gchar *tmp = NULL;
+ if (g_strcmp0 (key, "X-GNOME-Bugzilla-Bugzilla") == 0) {
tmp = g_key_file_get_string (kf,
G_KEY_FILE_DESKTOP_GROUP,
key,
@@ -537,8 +539,12 @@ as_app_parse_desktop_file (AsApp *app,
if (!as_app_parse_file_key (app, kf, keys[i], flags, error))
return FALSE;
if ((flags & AS_APP_PARSE_FLAG_USE_HEURISTICS) > 0) {
- if (!as_app_infer_file_key (app, kf, keys[i], error))
+ if (!as_app_infer_kudos (app, kf, keys[i], error))
return FALSE;
+ if (as_app_get_project_group (app) == NULL) {
+ if (!as_app_infer_project_group (app, kf, keys[i], error))
+ return FALSE;
+ }
}
}