Backport a better patch

This commit is contained in:
Richard Hughes 2019-10-11 15:47:42 +01:00
parent bdcbfaab1e
commit a624dec0af
2 changed files with 23 additions and 9 deletions

View File

@ -1,4 +1,4 @@
From 575d6dddb5d46dbb7955f5d3e248054d6d1996b8 Mon Sep 17 00:00:00 2001 From 23f1fe1736b35fe15ca17a1388251f6b52628d46 Mon Sep 17 00:00:00 2001
From: Richard Hughes <richard@hughsie.com> From: Richard Hughes <richard@hughsie.com>
Date: Tue, 8 Oct 2019 17:07:09 +0100 Date: Tue, 8 Oct 2019 17:07:09 +0100
Subject: [PATCH] Do not show non-applications in the installed panel Subject: [PATCH] Do not show non-applications in the installed panel
@ -28,14 +28,14 @@ version to the libxmlb cache guid.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1759193 Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1759193
--- ---
plugins/core/gs-plugin-appstream.c | 62 +++++++++++++++++++++++++----- plugins/core/gs-plugin-appstream.c | 72 ++++++++++++++++++++++++++----
1 file changed, 53 insertions(+), 9 deletions(-) 1 file changed, 63 insertions(+), 9 deletions(-)
diff --git a/plugins/core/gs-plugin-appstream.c b/plugins/core/gs-plugin-appstream.c diff --git a/plugins/core/gs-plugin-appstream.c b/plugins/core/gs-plugin-appstream.c
index 1f18693b..5f5ed05c 100644 index 1f18693b..4f5873cf 100644
--- a/plugins/core/gs-plugin-appstream.c --- a/plugins/core/gs-plugin-appstream.c
+++ b/plugins/core/gs-plugin-appstream.c +++ b/plugins/core/gs-plugin-appstream.c
@@ -206,20 +206,61 @@ gs_plugin_appstream_load_desktop_cb (XbBuilderSource *self, @@ -206,20 +206,71 @@ gs_plugin_appstream_load_desktop_cb (XbBuilderSource *self,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
@ -44,6 +44,7 @@ index 1f18693b..5f5ed05c 100644
+ g_autofree gchar *icon = NULL; + g_autofree gchar *icon = NULL;
+ g_autofree gchar *type = NULL; + g_autofree gchar *type = NULL;
+ g_autofree gchar *xml = NULL; + g_autofree gchar *xml = NULL;
+ g_autofree gchar *name = NULL;
g_autoptr(GBytes) bytes = NULL; g_autoptr(GBytes) bytes = NULL;
+ g_autoptr(GKeyFile) kf = g_key_file_new (); + g_autoptr(GKeyFile) kf = g_key_file_new ();
+ +
@ -93,19 +94,28 @@ index 1f18693b..5f5ed05c 100644
+ if (icon == NULL) + if (icon == NULL)
+ return NULL; + return NULL;
+ +
+ name = g_key_file_get_string (kf,
+ G_KEY_FILE_DESKTOP_GROUP,
+ G_KEY_FILE_DESKTOP_KEY_NAME,
+ error);
+ if (name == NULL)
+ return NULL;
+
+ /* build a super-simple fake AppData file */ + /* build a super-simple fake AppData file */
+ xml = g_strdup_printf ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + xml = g_strdup_printf ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<component type=\"desktop\">\n" + "<component type=\"desktop\">\n"
+ "<id>%s</id>\n" + "<id>%s</id>\n"
+ "<name>%s</name>"
+ "<icon type=\"stock\">%s</icon>\n" + "<icon type=\"stock\">%s</icon>\n"
+ "</component>\n", + "</component>\n",
+ xb_builder_source_ctx_get_filename (ctx), + xb_builder_source_ctx_get_filename (ctx),
+ name,
+ icon); + icon);
+ return g_memory_input_stream_new_from_data (g_steal_pointer (&xml), -1, g_free); + return g_memory_input_stream_new_from_data (g_steal_pointer (&xml), -1, g_free);
} }
static gboolean static gboolean
@@ -517,6 +558,9 @@ gs_plugin_appstream_check_silo (GsPlugin *plugin, @@ -517,6 +568,9 @@ gs_plugin_appstream_check_silo (GsPlugin *plugin,
} }
} }
@ -115,12 +125,12 @@ index 1f18693b..5f5ed05c 100644
/* create per-user cache */ /* create per-user cache */
blobfn = gs_utils_get_cache_filename ("appstream", "components.xmlb", blobfn = gs_utils_get_cache_filename ("appstream", "components.xmlb",
GS_UTILS_CACHE_FLAG_WRITEABLE, GS_UTILS_CACHE_FLAG_WRITEABLE,
@@ -925,7 +969,7 @@ gs_plugin_add_installed (GsPlugin *plugin, @@ -925,7 +979,7 @@ gs_plugin_add_installed (GsPlugin *plugin,
locker = g_rw_lock_reader_locker_new (&priv->silo_lock); locker = g_rw_lock_reader_locker_new (&priv->silo_lock);
/* get all installed appdata files (notice no 'components/' prefix...) */ /* get all installed appdata files (notice no 'components/' prefix...) */
- components = xb_silo_query (priv->silo, "component", 0, NULL); - components = xb_silo_query (priv->silo, "component", 0, NULL);
+ components = xb_silo_query (priv->silo, "component/name/..", 0, NULL); + components = xb_silo_query (priv->silo, "component/description/..", 0, NULL);
if (components == NULL) if (components == NULL)
return TRUE; return TRUE;
for (guint i = 0; i < components->len; i++) { for (guint i = 0; i < components->len; i++) {

View File

@ -12,7 +12,7 @@
Name: gnome-software Name: gnome-software
Version: 3.34.1 Version: 3.34.1
Release: 2%{?dist} Release: 3%{?dist}
Summary: A software center for GNOME Summary: A software center for GNOME
License: GPLv2+ License: GPLv2+
@ -223,6 +223,10 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
%{_mandir}/man1/gnome-software-editor.1* %{_mandir}/man1/gnome-software-editor.1*
%changelog %changelog
* Fri Oct 11 2019 Richard Hughes <rhughes@redhat.com> - 3.34.1-3
- Backport a better patch to correct the installed applications
- Resolves #1759193
* Thu Oct 10 2019 Richard Hughes <rhughes@redhat.com> - 3.34.1-2 * Thu Oct 10 2019 Richard Hughes <rhughes@redhat.com> - 3.34.1-2
- Backport a patch to correct the applications shown in the installed list - Backport a patch to correct the applications shown in the installed list
- Resolves #1759193 - Resolves #1759193