[shotwell] Fix missing event pictures



commit b1347a13e68da0e4dbbcaa2f7d282bb7798bbdd9
Author: Jens Georg <mail jensge org>
Date:   Tue Sep 19 22:35:01 2017 +0200

    Fix missing event pictures
    
    The large thumbnails are not re-generated when accessing the event only;
    to work-around this, do not bail out but use the pixbuf and schedule the
    thumbnail generation in background for the next start-up.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=748666

 src/events/EventDirectoryItem.vala |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/src/events/EventDirectoryItem.vala b/src/events/EventDirectoryItem.vala
index f316de7..f75a8e0 100644
--- a/src/events/EventDirectoryItem.vala
+++ b/src/events/EventDirectoryItem.vala
@@ -54,7 +54,21 @@ class EventDirectoryItem : CheckerboardItem {
     
     // scale and crop the center square of the media
     private static Gdk.Pixbuf get_paul_lynde(MediaSource media, Gdk.Rectangle paul_lynde) throws Error {
-        Gdk.Pixbuf pixbuf = media.get_preview_pixbuf(squared_scaling);
+        Gdk.Pixbuf pixbuf;
+
+        try {
+            pixbuf = media.get_preview_pixbuf(squared_scaling);
+        } catch (Error error) {
+            ThumbnailCache.fetch_async_scaled(media, ThumbnailCache.Size.BIG,
+                                             new Dimensions(ThumbnailCache.Size.BIG, 
ThumbnailCache.Size.BIG),
+                                             ThumbnailCache.DEFAULT_INTERP, () => {});
+            if (media is LibraryPhoto) {
+                LibraryPhoto photo = (LibraryPhoto) media;
+                pixbuf = photo.get_pixbuf(squared_scaling);
+            } else {
+                throw error;
+            }
+        }
         
         Dimensions thumbnail_dimensions = Dimensions.for_pixbuf(pixbuf);
         


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