[gnome-web-photo/webkit] Set max height of offscreen window to requested width for thumbnails



commit 4b098755dfaf93ae1bba380454f6c2fa26ace70d
Author: Vincent Untz <vuntz gnome org>
Date:   Wed Feb 16 16:07:59 2011 +0100

    Set max height of offscreen window to requested width for thumbnails
    
    There is absolutely no point in wanting to see more for thumbnails. This
    can only improve performance (a bit).

 src/gnome-web-photo.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/src/gnome-web-photo.c b/src/gnome-web-photo.c
index c9528bb..fd8c3d3 100644
--- a/src/gnome-web-photo.c
+++ b/src/gnome-web-photo.c
@@ -634,6 +634,7 @@ _create_web_window (PhotoData *data)
   GtkWidget         *window;
   GtkWidget         *webview;
   WebKitWebSettings *settings;
+  int                max_height;
 
   window = photo_offscreen_window_new ();
   data->window = window;
@@ -651,8 +652,14 @@ _create_web_window (PhotoData *data)
    * related to what is displayed). So it only affects MODE_PHOTO. But it's
    * better than not getting anything anyway. */
   gtk_widget_set_size_request (window, data->width, -1);
+
+  /* For thumbnails, there is no point in having a height larger than the
+   * width, so minimize directly what we need */
+  max_height = MAX_SIZE;
+  if (data->mode == MODE_THUMBNAIL)
+    max_height = MIN (data->width, max_height);
   photo_offscreen_window_set_max_height (PHOTO_OFFSCREEN_WINDOW (window),
-                                         MAX_SIZE);
+                                         max_height);
 
   webview = webkit_web_view_new ();
   data->webview = WEBKIT_WEB_VIEW (webview);



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