[gnome-desktop] Show an error when saving a thumbnail fails



commit 778b6844a893dea41801c5d8476bc8c83611c6c4
Author: William Jon McCann <jmccann redhat com>
Date:   Wed Aug 15 11:51:14 2012 -0400

    Show an error when saving a thumbnail fails
    
    https://bugzilla.gnome.org/show_bug.cgi?id=681942

 libgnome-desktop/gnome-bg.c                |    1 -
 libgnome-desktop/gnome-desktop-thumbnail.c |   12 ++++++++----
 2 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/libgnome-desktop/gnome-bg.c b/libgnome-desktop/gnome-bg.c
index 9cd1ab0..ea95d2b 100644
--- a/libgnome-desktop/gnome-bg.c
+++ b/libgnome-desktop/gnome-bg.c
@@ -2631,7 +2631,6 @@ pixbuf_tile (GdkPixbuf *src, GdkPixbuf *dest)
 	int tile_width, tile_height;
 	int dest_width = gdk_pixbuf_get_width (dest);
 	int dest_height = gdk_pixbuf_get_height (dest);
-	
 	tile_width = gdk_pixbuf_get_width (src);
 	tile_height = gdk_pixbuf_get_height (src);
 	
diff --git a/libgnome-desktop/gnome-desktop-thumbnail.c b/libgnome-desktop/gnome-desktop-thumbnail.c
index 039f7f2..0102f49 100644
--- a/libgnome-desktop/gnome-desktop-thumbnail.c
+++ b/libgnome-desktop/gnome-desktop-thumbnail.c
@@ -1163,7 +1163,7 @@ gnome_desktop_thumbnail_factory_generate_thumbnail (GnomeDesktopThumbnailFactory
 	    }
 
 	  g_free (expanded_script);
-	  g_unlink(tmpname);
+	  g_unlink (tmpname);
 	  g_free (tmpname);
 	}
 
@@ -1340,6 +1340,7 @@ gnome_desktop_thumbnail_factory_save_thumbnail (GnomeDesktopThumbnailFactory *fa
   GChecksum *checksum;
   guint8 digest[16];
   gsize digest_len = sizeof (digest);
+  GError *error;
 
   checksum = g_checksum_new (G_CHECKSUM_MD5);
   g_checksum_update (checksum, (const guchar *) uri, strlen (uri));
@@ -1383,10 +1384,11 @@ gnome_desktop_thumbnail_factory_save_thumbnail (GnomeDesktopThumbnailFactory *fa
   width = gdk_pixbuf_get_option (thumbnail, "tEXt::Thumb::Image::Width");
   height = gdk_pixbuf_get_option (thumbnail, "tEXt::Thumb::Image::Height");
 
+  error = NULL;
   if (width != NULL && height != NULL) 
     saved_ok  = gdk_pixbuf_save (thumbnail,
 				 tmp_path,
-				 "png", NULL,
+				 "png", &error,
 				 "tEXt::Thumb::Image::Width", width,
 				 "tEXt::Thumb::Image::Height", height,
 				 "tEXt::Thumb::URI", uri,
@@ -1396,7 +1398,7 @@ gnome_desktop_thumbnail_factory_save_thumbnail (GnomeDesktopThumbnailFactory *fa
   else
     saved_ok  = gdk_pixbuf_save (thumbnail,
 				 tmp_path,
-				 "png", NULL,
+				 "png", &error,
 				 "tEXt::Thumb::URI", uri,
 				 "tEXt::Thumb::MTime", mtime_str,
 				 "tEXt::Software", "GNOME::ThumbnailFactory",
@@ -1406,11 +1408,13 @@ gnome_desktop_thumbnail_factory_save_thumbnail (GnomeDesktopThumbnailFactory *fa
   if (saved_ok)
     {
       g_chmod (tmp_path, 0600);
-      g_rename(tmp_path, path);
+      g_rename (tmp_path, path);
     }
   else
     {
+      g_warning ("Failed to create thumbnail %s: %s", tmp_path, error->message);
       gnome_desktop_thumbnail_factory_create_failed_thumbnail (factory, uri, original_mtime);
+      g_clear_error (&error);
     }
 
   g_free (path);



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