[gnome-software/1843-gs-screenshot-support-videos-as-screenshot] gs-appstream: Skip screenshots it cannot read
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/1843-gs-screenshot-support-videos-as-screenshot] gs-appstream: Skip screenshots it cannot read
- Date: Tue, 9 Aug 2022 13:56:36 +0000 (UTC)
commit 9efb9156e62647beea3be8ed255473a38ca96aaa
Author: Milan Crha <mcrha redhat com>
Date: Tue Aug 9 15:51:44 2022 +0200
gs-appstream: Skip screenshots it cannot read
Let it skip screenshots it cannot read, to not have in the list
an empty screenshot, not referencing anything.
lib/gs-appstream.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/lib/gs-appstream.c b/lib/gs-appstream.c
index 13eb352a8..4e6a56afd 100644
--- a/lib/gs-appstream.c
+++ b/lib/gs-appstream.c
@@ -391,7 +391,11 @@ gs_appstream_refine_add_addons (GsPlugin *plugin,
}
static gboolean
-gs_appstream_refine_add_images (GsApp *app, AsScreenshot *ss, XbNode *screenshot, GError **error)
+gs_appstream_refine_add_images (GsApp *app,
+ AsScreenshot *ss,
+ XbNode *screenshot,
+ gboolean *out_any_added,
+ GError **error)
{
g_autoptr(GError) error_local = NULL;
g_autoptr(GPtrArray) images = NULL;
@@ -414,6 +418,8 @@ gs_appstream_refine_add_images (GsApp *app, AsScreenshot *ss, XbNode *screenshot
as_screenshot_add_image (ss, im);
}
+ *out_any_added = *out_any_added || images->len > 0;
+
/* success */
return TRUE;
}
@@ -435,9 +441,11 @@ gs_appstream_refine_add_screenshots (GsApp *app, XbNode *component, GError **err
for (guint i = 0; i < screenshots->len; i++) {
XbNode *screenshot = g_ptr_array_index (screenshots, i);
g_autoptr(AsScreenshot) ss = as_screenshot_new ();
- if (!gs_appstream_refine_add_images (app, ss, screenshot, error))
+ gboolean any_added = FALSE;
+ if (!gs_appstream_refine_add_images (app, ss, screenshot, &any_added, error))
return FALSE;
- gs_app_add_screenshot (app, ss);
+ if (any_added)
+ gs_app_add_screenshot (app, ss);
}
/* FIXME: move into no refine flags section? */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]