From 3d795f067156c1ab50ccfa8a29b88e0c6c88e011 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 c1ec81b..26b8c17 100644 --- a/libmate-desktop/mate-desktop-thumbnail.c +++ b/libmate-desktop/mate-desktop-thumbnail.c @@ -1508,7 +1508,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]; @@ -1552,20 +1551,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