never return a failed pixbuf.

2004-02-25  Sven Neumann  <sven@gimp.org>

	* libgimpthumb/gimpthumbnail.c (gimp_thumbnail_load_thumb): never
	return a failed pixbuf.

	(gimp_thumbnail_save_failure) (gimp_thumbnail_save_thumb): set the
	thumb_state when saving a thumbnail.
This commit is contained in:
Sven Neumann 2004-02-25 22:54:31 +00:00 committed by Sven Neumann
parent 8f5833ccf0
commit c614e33b39
2 changed files with 21 additions and 4 deletions

View File

@ -1,3 +1,11 @@
2004-02-25 Sven Neumann <sven@gimp.org>
* libgimpthumb/gimpthumbnail.c (gimp_thumbnail_load_thumb): never
return a failed pixbuf.
(gimp_thumbnail_save_failure) (gimp_thumbnail_save_thumb): set the
thumb_state when saving a thumbnail.
2004-02-25 Michael Natterer <mitch@gimp.org>
Changed libgimpthumb API in a way that will make GtkFileChooser

View File

@ -44,7 +44,7 @@
#include "libgimp/libgimp-intl.h"
/* #define GIMP_THUMB_DEBUG */
/* #define GIMP_THUMB_DEBUG */
#if defined (GIMP_THUMB_DEBUG) && defined (__GNUC__)
#define GIMP_THUMB_DEBUG_CALL(t) \
@ -761,6 +761,8 @@ gimp_thumbnail_load_thumb (GimpThumbnail *thumbnail,
if (! pixbuf)
return NULL;
g_object_freeze_notify (G_OBJECT (thumbnail));
/* URI and mtime from the thumbnail need to match our file */
option = gdk_pixbuf_get_option (pixbuf, TAG_THUMB_URI);
if (!option || strcmp (option, thumbnail->image_uri))
@ -792,7 +794,8 @@ gimp_thumbnail_load_thumb (GimpThumbnail *thumbnail,
gimp_thumbnail_set_info_from_pixbuf (thumbnail, pixbuf);
finish:
if (state != GIMP_THUMB_STATE_OLD && state != GIMP_THUMB_STATE_OK)
if (thumbnail->thumb_size == GIMP_THUMB_SIZE_FAIL ||
(state != GIMP_THUMB_STATE_OLD && state != GIMP_THUMB_STATE_OK))
{
g_object_unref (pixbuf);
pixbuf = NULL;
@ -802,6 +805,8 @@ gimp_thumbnail_load_thumb (GimpThumbnail *thumbnail,
"thumb-state", state,
NULL);
g_object_thaw_notify (G_OBJECT (thumbnail));
return pixbuf;
}
@ -896,7 +901,9 @@ gimp_thumbnail_save_thumb (GimpThumbnail *thumbnail,
{
success = (chmod (name, 0600) == 0);
if (! success)
if (success)
g_object_set (thumbnail, "thumb-state", GIMP_THUMB_STATE_OK, NULL);
else
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
"Could not set permissions of thumbnail for %s: %s",
thumbnail->image_uri, g_strerror (errno));
@ -972,7 +979,9 @@ gimp_thumbnail_save_failure (GimpThumbnail *thumbnail,
{
success = (chmod (name, 0600) == 0);
if (! success)
if (success)
g_object_set (thumbnail, "thumb-state", GIMP_THUMB_STATE_FAILED, NULL);
else
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
"Could not set permissions of thumbnail '%s': %s",
name, g_strerror (errno));