[gnome-software] Limit the number of screenshot to 5



commit 62da4c9049898f06d007524183db686545bdd1ba
Author: Richard Hughes <richard hughsie com>
Date:   Fri Oct 11 21:27:44 2013 +0100

    Limit the number of screenshot to 5
    
    Otherwise the screenshot part of the details pane is too large.

 src/plugins/gs-plugin-appstream.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index fdca4cd..f0d593e 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -28,6 +28,8 @@
 #include "appstream-app.h"
 #include "appstream-cache.h"
 
+#define        GS_PLUGIN_APPSTREAM_MAX_SCREENSHOTS     5
+
 struct GsPluginPrivate {
        AppstreamCache          *cache;
        gchar                   *cachedir;
@@ -388,7 +390,8 @@ gs_plugin_refine_add_screenshots (GsApp *app, AppstreamApp *item)
                return;
 
        /* add any we know */
-       for (i = 0; i < screenshots_as->len; i++) {
+       for (i = 0; i < screenshots_as->len &&
+                   i < GS_PLUGIN_APPSTREAM_MAX_SCREENSHOTS; i++) {
                ss = g_ptr_array_index (screenshots_as, i);
                images_as = appstream_screenshot_get_images (ss);
                if (images_as->len == 0)


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