[gnome-shell] Deal with thumbnail failure correctly



commit 84d469c1f9c8cc0076c8ad2dd57a450dc04924d0
Author: Dan Winship <danw gnome org>
Date:   Tue May 5 14:10:06 2009 -0400

    Deal with thumbnail failure correctly
    
    If a file already has a failed thumbnail indicator, don't try to
    thumbnail it, and if thumbnailing fails, create a failed thumbnail
    indicator. (In particular, so that if thumbnail creation times out, we
    don't keep retrying and eventually timing out every time the user
    opens the overlay.)
    
    http://bugzilla.gnome.org/show_bug.cgi?id=568081
---
 src/shell-global.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/shell-global.c b/src/shell-global.c
index 01ca0db..42a79b3 100644
--- a/src/shell-global.c
+++ b/src/shell-global.c
@@ -372,17 +372,20 @@ shell_get_thumbnail_for_recent_info(GtkRecentInfo  *recent_info)
             g_clear_error (&error);
           }
       }
+    else if (gnome_thumbnail_factory_has_valid_failed_thumbnail (thumbnail_factory, uri, mtime))
+      return NULL;
     else if (gnome_thumbnail_factory_can_thumbnail (thumbnail_factory, uri, mime_type, mtime)) 
       {
         pixbuf = gnome_thumbnail_factory_generate_thumbnail (thumbnail_factory, uri, mime_type);
-        if (pixbuf == NULL) 
+        if (pixbuf)
           {
-            g_warning ("Could not generate thumbnail for %s", uri);
+            // we need to save the thumbnail so that we don't need to generate it again in the future
+            gnome_thumbnail_factory_save_thumbnail (thumbnail_factory, pixbuf, uri, mtime);
           }          
         else 
           {
-            // we need to save the thumbnail so that we don't need to generate it again in the future
-            gnome_thumbnail_factory_save_thumbnail (thumbnail_factory, pixbuf, uri, mtime);
+            g_warning ("Could not generate thumbnail for %s", uri);
+            gnome_thumbnail_factory_create_failed_thumbnail (thumbnail_factory, uri, mtime);
           }
       }
 



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