[gnome-software] Do not add source screenshots from AppData files



commit 0d8e3588153e62deb5277094bac840c5636815da
Author: Richard Hughes <richard hughsie com>
Date:   Thu Jun 26 11:45:45 2014 +0100

    Do not add source screenshots from AppData files

 src/plugins/gs-plugin-appstream.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index 0802714..2919fed 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -334,6 +334,11 @@ gs_plugin_refine_add_screenshots (GsApp *app, AsApp *item)
        if (gs_app_get_screenshots(app)->len > 0)
                return;
 
+       /* do not add source images */
+       if (as_app_get_source_kind (item) == AS_APP_SOURCE_KIND_APPDATA ||
+           as_app_get_source_kind (item) == AS_APP_SOURCE_KIND_DESKTOP)
+               return;
+
        /* add any we know */
        for (i = 0; i < screenshots_as->len &&
                    i < GS_PLUGIN_APPSTREAM_MAX_SCREENSHOTS; i++) {
@@ -353,6 +358,9 @@ gs_plugin_refine_add_screenshots (GsApp *app, AsApp *item)
                                           as_screenshot_get_caption (ss, NULL));
                for (j = 0; j < images_as->len; j++) {
                        im = g_ptr_array_index (images_as, j);
+                       if (as_image_get_width (im) <= 0 ||
+                           as_image_get_height (im) <= 0)
+                               continue;
                        gs_screenshot_add_image (screenshot,
                                                 as_image_get_url (im),
                                                 as_image_get_width (im),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]