Commit 8099e692 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

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.
parent f831818a
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
......@@ -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
......
......@@ -69,30 +69,33 @@ struct _GimpThumbnailClass
};
GType gimp_thumbnail_get_type (void) G_GNUC_CONST;
GimpThumbnail * gimp_thumbnail_new (void);
void gimp_thumbnail_set_uri (GimpThumbnail *thumbnail,
const gchar *uri);
gboolean gimp_thumbnail_set_filename (GimpThumbnail *thumbnail,
const gchar *filename,
GError **error);
GimpThumbState gimp_thumbnail_peek_image (GimpThumbnail *thumbnail);
GimpThumbState gimp_thumbnail_peek_thumb (GimpThumbnail *thumbnail,
GimpThumbSize size);
GdkPixbuf * gimp_thumbnail_load_thumb (GimpThumbnail *thumbnail,
GimpThumbSize size,
GError **error);
gboolean gimp_thumbnail_save_thumb (GimpThumbnail *thumbnail,
GdkPixbuf *pixbuf,
const gchar *software,
GError **error);
gboolean gimp_thumbnail_save_failure (GimpThumbnail *thumbnail,
const gchar *software,
GError **error);
GType gimp_thumbnail_get_type (void) G_GNUC_CONST;
GimpThumbnail * gimp_thumbnail_new (void);
void gimp_thumbnail_set_uri (GimpThumbnail *thumbnail,
const gchar *uri);
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,
GimpThumbSize size);
GdkPixbuf * gimp_thumbnail_load_thumb (GimpThumbnail *thumbnail,
GimpThumbSize size,
GError **error);
gboolean gimp_thumbnail_save_thumb (GimpThumbnail *thumbnail,
GdkPixbuf *pixbuf,
const gchar *software,
GError **error);
gboolean gimp_thumbnail_save_failure (GimpThumbnail *thumbnail,
const gchar *software,
GError **error);
G_END_DECLS
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment