[gnome-desktop] thumbnailer: Try harder to create a failed thumbnail



commit 54f68ab0e4f745806969ae0221e2fa8bcd727e4a
Author: Juan Antonio Marin <tonin uco es>
Date:   Mon May 5 08:50:28 2014 +0200

    thumbnailer: Try harder to create a failed thumbnail
    
    If a failed thumbnail is created because the pixbuf fail to save
    (for instance if user is over quota) we should still try to rename
    the temporary file that might have been created.
    If not, the thumbnail will not be marked as failed, and thumbnailing
    will be reattempted.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=728775

 libgnome-desktop/gnome-desktop-thumbnail.c |   23 ++++++++++-------------
 1 files changed, 10 insertions(+), 13 deletions(-)
---
diff --git a/libgnome-desktop/gnome-desktop-thumbnail.c b/libgnome-desktop/gnome-desktop-thumbnail.c
index c9baeac..330ed7a 100644
--- a/libgnome-desktop/gnome-desktop-thumbnail.c
+++ b/libgnome-desktop/gnome-desktop-thumbnail.c
@@ -1659,7 +1659,6 @@ gnome_desktop_thumbnail_factory_create_failed_thumbnail (GnomeDesktopThumbnailFa
   char *tmp_path;
   int tmp_fd;
   char mtime_str[21];
-  gboolean saved_ok;
   GdkPixbuf *pixbuf;
   GChecksum *checksum;
   guint8 digest[16];
@@ -1703,19 +1702,17 @@ gnome_desktop_thumbnail_factory_create_failed_thumbnail (GnomeDesktopThumbnailFa
   
   g_snprintf (mtime_str, 21, "%" G_GUINT64_FORMAT, (guint64) mtime);
   pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, 1, 1);
-  saved_ok  = gdk_pixbuf_save (pixbuf,
-                              tmp_path,
-                              "png", NULL, 
-                              "tEXt::Thumb::URI", uri,
-                              "tEXt::Thumb::MTime", mtime_str,
-                              "tEXt::Software", "GNOME::ThumbnailFactory",
-                              NULL);
+  gdk_pixbuf_save (pixbuf,
+                  tmp_path,
+                  "png", NULL,
+                  "tEXt::Thumb::URI", uri,
+                  "tEXt::Thumb::MTime", mtime_str,
+                  "tEXt::Software", "GNOME::ThumbnailFactory",
+                  NULL);
   g_object_unref (pixbuf);
-  if (saved_ok)
-    {
-      g_chmod (tmp_path, 0600);
-      g_rename(tmp_path, path);
-    }
+
+  g_chmod (tmp_path, 0600);
+  g_rename (tmp_path, path);
 
   g_free (path);
   g_free (tmp_path);


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