[gnome-software] Use a larger screenshot size when there is only one screenshot to show



commit 256b057cd6d08cf55757ead6d9f145744f6d1267
Author: Richard Hughes <richard hughsie com>
Date:   Fri Nov 8 15:28:37 2013 +0000

    Use a larger screenshot size when there is only one screenshot to show
    
    Resolves: https://bugzilla.gnome.org/show_bug.cgi?id=711503

 src/gs-screenshot.h    |    2 ++
 src/gs-shell-details.c |   21 +++++++++++++--------
 2 files changed, 15 insertions(+), 8 deletions(-)
---
diff --git a/src/gs-screenshot.h b/src/gs-screenshot.h
index 23348fc..556fe27 100644
--- a/src/gs-screenshot.h
+++ b/src/gs-screenshot.h
@@ -55,6 +55,8 @@ GsScreenshot  *gs_screenshot_new              (void);
 #define GS_SCREENSHOT_SIZE_SMALL_HEIGHT                63
 #define GS_SCREENSHOT_SIZE_LARGE_WIDTH         624
 #define GS_SCREENSHOT_SIZE_LARGE_HEIGHT                351
+#define GS_SCREENSHOT_SIZE_LARGE2_WIDTH                752
+#define GS_SCREENSHOT_SIZE_LARGE2_HEIGHT       423
 
 gboolean        gs_screenshot_get_is_default   (GsScreenshot           *screenshot);
 void            gs_screenshot_set_is_default   (GsScreenshot           *screenshot,
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index 919f67c..5d15287 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -260,6 +260,7 @@ gs_shell_details_refresh_screenshots (GsShellDetails *shell_details)
        GtkWidget *widget;
        guint i;
        GtkRequisition provided;
+       guint width, height;
 
        /* treat screenshots differently */
        if (gs_app_get_id_kind (priv->app) == GS_APP_ID_KIND_FONT) {
@@ -316,21 +317,25 @@ gs_shell_details_refresh_screenshots (GsShellDetails *shell_details)
                                          g_get_user_cache_dir ());
        gs_screenshot_image_set_screenshot (GS_SCREENSHOT_IMAGE (ssimg), ss);
 
+       /* use a slightly larger screenshot if it's the only screenshot */
+       if (screenshots->len == 1) {
+               width = GS_SCREENSHOT_SIZE_LARGE2_WIDTH;
+               height = GS_SCREENSHOT_SIZE_LARGE2_HEIGHT;
+       } else {
+               width = GS_SCREENSHOT_SIZE_LARGE_WIDTH;
+               height = GS_SCREENSHOT_SIZE_LARGE_HEIGHT;
+       }
+
        /* do we have a screenshot of the right size? */
-       tmp = gs_screenshot_get_url (ss,
-                                    GS_SCREENSHOT_SIZE_LARGE_WIDTH,
-                                    GS_SCREENSHOT_SIZE_LARGE_HEIGHT,
-                                    &provided);
+       tmp = gs_screenshot_get_url (ss, width, height, &provided);
        if (tmp != NULL) {
                gs_screenshot_image_set_size (GS_SCREENSHOT_IMAGE (ssimg),
-                                             GS_SCREENSHOT_SIZE_LARGE_WIDTH,
-                                             GS_SCREENSHOT_SIZE_LARGE_HEIGHT);
+                                             width, height);
        } else {
                /* use any size provided */
                gs_screenshot_get_url (ss, G_MAXUINT, G_MAXUINT, &provided);
                gs_screenshot_image_set_size (GS_SCREENSHOT_IMAGE (ssimg),
-                                             provided.width,
-                                             provided.height);
+                                             provided.width, provided.height);
        }
 
        gs_screenshot_image_load_async (GS_SCREENSHOT_IMAGE (ssimg), NULL);


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