From 63ca113518dfa6891de0c3196b824792ce9f8a2e Mon Sep 17 00:00:00 2001 From: Juan Antonio Marin Date: Mon, 5 May 2014 08:50:28 +0200 Subject: 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 origin commit: https://gitlab.gnome.org/GNOME/gnome-desktop/commit/54f68ab --- libmate-desktop/mate-desktop-thumbnail.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/libmate-desktop/mate-desktop-thumbnail.c b/libmate-desktop/mate-desktop-thumbnail.c index 2e2f29d..945bc91 100644 --- a/libmate-desktop/mate-desktop-thumbnail.c +++ b/libmate-desktop/mate-desktop-thumbnail.c @@ -1568,7 +1568,6 @@ mate_desktop_thumbnail_factory_create_failed_thumbnail (MateDesktopThumbnailFact char *tmp_path; int tmp_fd; gchar *mtime_str; - gboolean saved_ok; GdkPixbuf *pixbuf; GChecksum *checksum; guint8 digest[16]; @@ -1612,20 +1611,17 @@ mate_desktop_thumbnail_factory_create_failed_thumbnail (MateDesktopThumbnailFact mtime_str = g_strdup_printf ("%" G_GINT64_FORMAT, (gint64)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", "MATE::ThumbnailFactory", - NULL); + gdk_pixbuf_save (pixbuf, + tmp_path, + "png", NULL, + "tEXt::Thumb::URI", uri, + "tEXt::Thumb::MTime", mtime_str, + "tEXt::Software", "MATE::ThumbnailFactory", + NULL); g_object_unref (pixbuf); g_free (mtime_str); - 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); -- cgit v1.2.1