[gnome-software] flatpak: Fix icons for installed bundles
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] flatpak: Fix icons for installed bundles
- Date: Fri, 12 Jun 2020 15:03:54 +0000 (UTC)
commit f58c6dbbadbd9ba0815bf2a548359c5f4eb2cd2e
Author: Matthew Leeds <matthew leeds endlessm com>
Date: Mon Jan 27 17:33:40 2020 -0800
flatpak: Fix icons for installed bundles
Currently apps installed from .flatpak bundles do not display their
icons properly (and display gears instead). Fix this by ensuring the
icon prefix is set in the appstream data so as_icon_load() can find the
icon.
plugins/flatpak/gs-flatpak.c | 18 +++++++++++++++++-
plugins/flatpak/gs-self-test.c | 4 ++--
2 files changed, 19 insertions(+), 3 deletions(-)
---
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index 31253af5..8c968f57 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -2250,6 +2250,7 @@ static gboolean
gs_flatpak_refine_appstream_from_bytes (GsFlatpak *self,
GsApp *app,
const char *origin, /* (nullable) */
+ FlatpakInstalledRef *installed_ref, /* (nullable) */
GBytes *appstream_gz,
GsPluginRefineFlags flags,
GCancellable *cancellable,
@@ -2311,6 +2312,19 @@ gs_flatpak_refine_appstream_from_bytes (GsFlatpak *self,
fixup_flatpak_appstream_xml (source, origin);
+ /* add metadata */
+ if (installed_ref != NULL) {
+ g_autoptr(XbBuilderNode) info = NULL;
+ g_autofree char *icon_prefix = NULL;
+
+ info = xb_builder_node_insert (NULL, "info", NULL);
+ xb_builder_node_insert_text (info, "scope", as_app_scope_to_string (self->scope), NULL);
+ icon_prefix = g_build_filename (flatpak_installed_ref_get_deploy_dir (installed_ref),
+ "files", "share", "app-info", "icons", "flatpak", NULL);
+ xb_builder_node_insert_text (info, "icon-prefix", icon_prefix, NULL);
+ xb_builder_source_set_info (source, info);
+ }
+
xb_builder_import_source (builder, source);
silo = xb_builder_compile (builder,
#if LIBXMLB_CHECK_VERSION(0, 2, 0)
@@ -2422,6 +2436,7 @@ gs_flatpak_refine_appstream (GsFlatpak *self,
return gs_flatpak_refine_appstream_from_bytes (self,
app,
flatpak_installed_ref_get_origin
(installed_ref),
+ installed_ref,
appstream_gz,
flags,
cancellable, error);
@@ -2721,7 +2736,8 @@ gs_flatpak_file_to_app_bundle (GsFlatpak *self,
/* load AppStream */
appstream_gz = flatpak_bundle_ref_get_appstream (xref_bundle);
if (appstream_gz != NULL) {
- if (!gs_flatpak_refine_appstream_from_bytes (self, app, origin, appstream_gz,
+ if (!gs_flatpak_refine_appstream_from_bytes (self, app, origin, installed_ref,
+ appstream_gz,
GS_PLUGIN_REFINE_FLAGS_DEFAULT,
cancellable, error))
return NULL;
diff --git a/plugins/flatpak/gs-self-test.c b/plugins/flatpak/gs-self-test.c
index f610c4b8..c2144ca0 100644
--- a/plugins/flatpak/gs-self-test.c
+++ b/plugins/flatpak/gs-self-test.c
@@ -1187,7 +1187,7 @@ flatpak_bundle_or_ref_helper (GsPluginLoader *plugin_loader,
g_object_unref (plugin_job);
plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_SEARCH,
"search", "chiron",
- "refine-flags", is_bundle ? GS_PLUGIN_REFINE_FLAGS_REQUIRE_RUNTIME :
GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON,
+ "refine-flags", GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON,
NULL);
search1 = gs_plugin_loader_job_process (plugin_loader, plugin_job, NULL, &error);
gs_test_flush_main_context ();
@@ -1255,7 +1255,7 @@ flatpak_bundle_or_ref_helper (GsPluginLoader *plugin_loader,
g_object_unref (plugin_job);
plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_SEARCH,
"search", "chiron",
- "refine-flags", is_bundle ? GS_PLUGIN_REFINE_FLAGS_REQUIRE_RUNTIME :
GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON,
+ "refine-flags", GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON,
NULL);
search2 = gs_plugin_loader_job_process (plugin_loader, plugin_job, NULL, &error);
gs_test_flush_main_context ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]