Bug 622758 - Fix error display for thumbnail creation

Do not stay forever in "Creating Preview..." state during
auto-thumbnailing, and fix error showing when creation fails.
This commit is contained in:
Jehan 2013-12-23 03:25:05 +13:00
parent 3e618320d3
commit 6208d21979
2 changed files with 21 additions and 4 deletions

View file

@ -441,6 +441,13 @@ gimp_imagefile_create_thumbnail (GimpImagefile *imagefile,
g_object_unref (imagefile);
if (! success)
{
g_object_set (thumbnail,
"thumb-state", GIMP_THUMB_STATE_FAILED,
NULL);
}
return success;
}
@ -478,8 +485,17 @@ gimp_imagefile_create_thumbnail_weak (GimpImagefile *imagefile,
g_object_add_weak_pointer (G_OBJECT (imagefile), (gpointer) &imagefile);
gimp_imagefile_create_thumbnail (local, context, progress, size, replace,
NULL);
if (! gimp_imagefile_create_thumbnail (local, context, progress, size, replace,
NULL))
{
/* The weak version works on a local copy so the thumbnail status
* of the actual image is not properly updated in case of creation
* failure, thus it would end up in a generic GIMP_THUMB_STATE_NOT_FOUND,
* which is less informative. */
g_object_set (private->thumbnail,
"thumb-state", GIMP_THUMB_STATE_FAILED,
NULL);
}
if (imagefile)
{

View file

@ -710,14 +710,15 @@ gimp_thumbnail_update_thumb (GimpThumbnail *thumbnail,
filename = gimp_thumb_find_thumb (thumbnail->image_uri, &size);
if (! filename)
/* We don't want to clear the GIMP_THUMB_STATE_FAILED state, because
* it is normal to have no filename if thumbnail creation failed. */
if (state != GIMP_THUMB_STATE_FAILED && ! filename)
state = GIMP_THUMB_STATE_NOT_FOUND;
switch (state)
{
case GIMP_THUMB_STATE_EXISTS:
case GIMP_THUMB_STATE_OLD:
case GIMP_THUMB_STATE_FAILED:
case GIMP_THUMB_STATE_OK:
g_return_if_fail (thumbnail->thumb_filename != NULL);