Commit 92039060 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

libgimpthumb/gimpthumb-utils.[ch] added an API to delete thumbnails.

2004-10-11  Sven Neumann  <sven@gimp.org>

	* libgimpthumb/gimpthumb-utils.[ch]
	* libgimpthumb/gimpthumb.def: added an API to delete thumbnails.

	* app/widgets/gimpthumbbox.c (gimp_thumb_box_create_thumbnail):
	when recreating a thumbnail on user request, delete all existing
	thumbnails for it.

	* plug-ins/common/AlienMap2.c: removed unused variable.
parent f57bbe3a
2004-10-11 Sven Neumann <sven@gimp.org>
* libgimpthumb/gimpthumb-utils.[ch]
* libgimpthumb/gimpthumb.def: added an API to delete thumbnails.
* app/widgets/gimpthumbbox.c (gimp_thumb_box_create_thumbnail):
when recreating a thumbnail on user request, delete all existing
thumbnails for it.
* plug-ins/common/AlienMap2.c: removed unused variable.
2004-10-10 Sven Neumann <sven@gimp.org>
* libgimpthumb/gimpthumb-utils.[ch]
......
......@@ -666,6 +666,9 @@ gimp_thumb_box_create_thumbnail (GimpThumbBox *box,
gtk_label_set_text (GTK_LABEL (box->filename), basename);
g_free (basename);
if (force)
gimp_thumbs_delete_for_uri (uri);
gimp_object_set_name (GIMP_OBJECT (box->imagefile), uri);
if (force ||
......
......@@ -26,14 +26,16 @@ GIMP_THUMBNAIL_GET_CLASS
<SECTION>
<FILE>gimpthumb-utils</FILE>
gimp_thumb_init
gimp_thumb_name_from_uri
gimp_thumb_find_thumb
gimp_thumb_file_test
gimp_thumb_name_from_uri
gimp_thumb_ensure_thumb_dir
gimp_thumb_get_thumb_dir
gimp_thumbs_delete_for_uri
gimp_thumb_name_from_uri_local
gimp_thumb_ensure_thumb_dir_local
gimp_thumb_get_thumb_dir_local
gimp_thumbs_delete_for_uri_local
</SECTION>
<SECTION>
......
......@@ -24,7 +24,7 @@ Utility functions provided and used by libgimpthumb
@Returns:
<!-- ##### FUNCTION gimp_thumb_name_from_uri ##### -->
<!-- ##### FUNCTION gimp_thumb_find_thumb ##### -->
<para>
</para>
......@@ -34,25 +34,25 @@ Utility functions provided and used by libgimpthumb
@Returns:
<!-- ##### FUNCTION gimp_thumb_find_thumb ##### -->
<!-- ##### FUNCTION gimp_thumb_file_test ##### -->
<para>
</para>
@uri:
@filename:
@mtime:
@size:
@err_no:
@Returns:
<!-- ##### FUNCTION gimp_thumb_file_test ##### -->
<!-- ##### FUNCTION gimp_thumb_name_from_uri ##### -->
<para>
</para>
@filename:
@mtime:
@uri:
@size:
@err_no:
@Returns:
......@@ -75,6 +75,14 @@ Utility functions provided and used by libgimpthumb
@Returns:
<!-- ##### FUNCTION gimp_thumbs_delete_for_uri ##### -->
<para>
</para>
@uri:
<!-- ##### FUNCTION gimp_thumb_name_from_uri_local ##### -->
<para>
......@@ -106,3 +114,11 @@ Utility functions provided and used by libgimpthumb
@Returns:
<!-- ##### FUNCTION gimp_thumbs_delete_for_uri_local ##### -->
<para>
</para>
@uri:
......@@ -301,14 +301,14 @@ gimp_thumb_ensure_thumb_dir_local (const gchar *dirname,
/**
* gimp_thumb_name_from_uri:
* @uri: an escaped URI in UTF-8 encoding
* @uri: an escaped URI
* @size: a #GimpThumbSize
*
* Creates the name of the thumbnail file of the specified @size that
* belongs to an image file located at the given @uri.
*
* Return value: a newly allocated filename in the encoding of the
* filesystem or %NULL if @uri points to the global
* filesystem or %NULL if @uri points to the user's
* thumbnail repository.
**/
gchar *
......@@ -330,7 +330,7 @@ gimp_thumb_name_from_uri (const gchar *uri,
/**
* gimp_thumb_name_from_uri_local:
* @uri: an escaped URI in UTF-8 encoding
* @uri: an escaped URI
* @size: a #GimpThumbSize
*
* Creates the name of a local thumbnail file of the specified @size
......@@ -339,7 +339,7 @@ gimp_thumb_name_from_uri (const gchar *uri,
*
* Return value: a newly allocated filename in the encoding of the
* filesystem or %NULL if @uri is a remote file or
* points to the global thumbnail repository.
* points to the user's thumbnail repository.
*
* Since: GIMP 2.2
**/
......@@ -384,7 +384,7 @@ gimp_thumb_name_from_uri_local (const gchar *uri,
/**
* gimp_thumb_find_thumb:
* @uri: an escaped URI in UTF-8 encoding
* @uri: an escaped URI
* @size: pointer to a #GimpThumbSize
*
* This function attempts to locate a thumbnail for the given
......@@ -392,7 +392,7 @@ gimp_thumb_name_from_uri_local (const gchar *uri,
* thumbnail of that size is found, it will look for a larger
* thumbnail, then falling back to a smaller size.
*
* If the global thumbnail repository doesn't provide a thumbnail but
* If the user's thumbnail repository doesn't provide a thumbnail but
* a local thumbnail repository exists for the folder the image is
* located in, the same search is done among the local thumbnails.
*
......@@ -489,6 +489,64 @@ gimp_thumb_file_test (const gchar *filename,
return GIMP_THUMB_FILE_TYPE_NONE;
}
/**
* gimp_thumbs_delete_for_uri:
* @uri: an escaped URI
*
* Deletes all thumbnails for the image file specified by @uri from the
* user's thumbnail repository.
*
* Since: GIMP 2.2
**/
void
gimp_thumbs_delete_for_uri (const gchar *uri)
{
gint i;
g_return_if_fail (gimp_thumb_initialized);
g_return_if_fail (uri != NULL);
for (i = 0; i < thumb_num_sizes; i++)
{
gchar *filename = gimp_thumb_name_from_uri (uri, thumb_sizes[i]);
if (filename)
{
unlink (filename);
g_free (filename);
}
}
}
/**
* gimp_thumbs_delete_for_uri_local:
* @uri: an escaped URI
*
* Deletes all thumbnails for the image file specified by @uri from
* the local thumbnail repository.
*
* Since: GIMP 2.2
**/
void
gimp_thumbs_delete_for_uri_local (const gchar *uri)
{
gint i;
g_return_if_fail (gimp_thumb_initialized);
g_return_if_fail (uri != NULL);
for (i = 0; i < thumb_num_sizes; i++)
{
gchar *filename = gimp_thumb_name_from_uri_local (uri, thumb_sizes[i]);
if (filename)
{
unlink (filename);
g_free (filename);
}
}
}
static void
gimp_thumb_exit (void)
{
......
......@@ -32,27 +32,30 @@ G_BEGIN_DECLS
gboolean gimp_thumb_init (const gchar *creator,
const gchar *thumb_basedir);
gchar * gimp_thumb_find_thumb (const gchar *uri,
GimpThumbSize *size);
GimpThumbFileType gimp_thumb_file_test (const gchar *filename,
gint64 *mtime,
gint64 *size,
gint *err_no);
gchar * gimp_thumb_name_from_uri (const gchar *uri,
GimpThumbSize size);
const gchar * gimp_thumb_get_thumb_dir (GimpThumbSize size);
gboolean gimp_thumb_ensure_thumb_dir (GimpThumbSize size,
GError **error);
gchar * gimp_thumb_name_from_uri (const gchar *uri,
GimpThumbSize size);
void gimp_thumbs_delete_for_uri (const gchar *uri);
gchar * gimp_thumb_name_from_uri_local (const gchar *uri,
GimpThumbSize size);
gchar * gimp_thumb_get_thumb_dir_local (const gchar *dirname,
GimpThumbSize size);
gboolean gimp_thumb_ensure_thumb_dir_local (const gchar *dirname,
GimpThumbSize size,
GError **error);
gchar * gimp_thumb_name_from_uri_local (const gchar *uri,
GimpThumbSize size);
void gimp_thumbs_delete_for_uri_local (const gchar *uri);
gchar * gimp_thumb_find_thumb (const gchar *uri,
GimpThumbSize *size);
GimpThumbFileType gimp_thumb_file_test (const gchar *filename,
gint64 *mtime,
gint64 *size,
gint *err_no);
G_END_DECLS
......
......@@ -22,3 +22,5 @@ EXPORTS
gimp_thumbnail_set_filename
gimp_thumbnail_set_from_thumb
gimp_thumbnail_set_uri
gimp_thumbs_delete_for_uri
gimp_thumbs_delete_for_uri_local
......@@ -400,7 +400,7 @@ gimp_thumbnail_new (void)
/**
* gimp_thumbnail_set_uri:
* @thumbnail: a #GimpThumbnail object
* @uri: an escaped URI in UTF-8 encoding
* @uri: an escaped URI
*
* Sets the location of the image file associated with the #thumbnail.
*
......
......@@ -386,7 +386,6 @@ alienmap2_dialog (void)
GtkWidget *dialog;
GtkWidget *main_vbox;
GtkWidget *top_table;
GtkWidget *align;
GtkWidget *frame;
GtkWidget *toggle;
GtkWidget *hbox;
......
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