added new function gimp_thumbnail_set_from_thumb() which will be useful

2004-01-06  Sven Neumann  <sven@gimp.org>

	* libgimpthumb/gimpthumbnail.[ch]: added new function
	gimp_thumbnail_set_from_thumb() which will be useful when writing
	a thumbnail manager based on libgimpthumb.
This commit is contained in:
Sven Neumann 2004-01-06 15:53:32 +00:00 committed by Sven Neumann
parent f831818a1a
commit 8099e69264
3 changed files with 65 additions and 20 deletions

View file

@ -1,3 +1,9 @@
2004-01-06 Sven Neumann <sven@gimp.org>
* libgimpthumb/gimpthumbnail.[ch]: added new function
gimp_thumbnail_set_from_thumb() which will be useful when writing
a thumbnail manager based on libgimpthumb.
2004-01-06 Sven Neumann <sven@gimp.org>
* app/core/gimpimagefile.c: invalidate the description string

View file

@ -427,6 +427,42 @@ gimp_thumbnail_set_filename (GimpThumbnail *thumbnail,
return (!filename || uri);
}
/**
* gimp_thumbnail_set_from_thumb:
* @thumbnail: a #GimpThumbnail object
* @filename: filename of a local thumbnail file
* @error: return location for possible errors
*
* This function tries to load the thumbnail file pointed to by
* @filename and retrieves the URI of the original image file from
* it. This allows you to find the image file associated with a
* thumbnail file.
*
* Return value: %TRUE if the pixbuf could be loaded, %FALSE otherwise
**/
gboolean
gimp_thumbnail_set_from_thumb (GimpThumbnail *thumbnail,
const gchar *filename,
GError **error)
{
GdkPixbuf *pixbuf;
g_return_val_if_fail (GIMP_IS_THUMBNAIL (thumbnail), FALSE);
g_return_val_if_fail (filename != NULL, FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
pixbuf = gdk_pixbuf_new_from_file (filename, error);
if (! pixbuf)
return FALSE;
gimp_thumbnail_set_uri (thumbnail,
gdk_pixbuf_get_option (pixbuf, TAG_THUMB_URI));
g_object_unref (pixbuf);
return TRUE;
}
/**
* gimp_thumbnail_peek_image:
* @thumbnail: a #GimpThumbnail object

View file

@ -78,6 +78,9 @@ void gimp_thumbnail_set_uri (GimpThumbnail *thumbnail,
gboolean gimp_thumbnail_set_filename (GimpThumbnail *thumbnail,
const gchar *filename,
GError **error);
gboolean gimp_thumbnail_set_from_thumb (GimpThumbnail *thumbnail,
const gchar *filename,
GError **error);
GimpThumbState gimp_thumbnail_peek_image (GimpThumbnail *thumbnail);
GimpThumbState gimp_thumbnail_peek_thumb (GimpThumbnail *thumbnail,