summaryrefslogtreecommitdiff
path: root/tumbler/tumbler-file-info.c
diff options
context:
space:
mode:
authorJannis Pohlmann <jannis@xfce.org>2009-06-12 01:01:42 +0200
committerJannis Pohlmann <jannis@xfce.org>2009-06-12 01:01:42 +0200
commit32eb2981f5d35f835809fc05ddc1800bd62c7675 (patch)
tree53e17e68b2ba73441a07d6f5b392780e86926510 /tumbler/tumbler-file-info.c
parent4769ddb2dd7c51d8df89f55bbddc91ce7358bfa1 (diff)
downloadtumbler-32eb2981f5d35f835809fc05ddc1800bd62c7675.tar.gz
No thumbnails for thumbnails. Allow Unqueue in the middle of requests.
There's a new method tumbler_cache_is_thumbnail() now which has to be implemented by plugins. It is used by TumblerFileInfo in tumbler_file_info_load() to check whether the file is a thumbnail itself. In that case, tumbler_file_info_load() will fail with a TUMBLER_ERROR_IS_THUMBNAIL error. Add another check in TumblerThresholdScheduler to make unqueuing requests in the middle of the process work.
Diffstat (limited to 'tumbler/tumbler-file-info.c')
-rw-r--r--tumbler/tumbler-file-info.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/tumbler/tumbler-file-info.c b/tumbler/tumbler-file-info.c
index 3b24fb0..cfbfbfc 100644
--- a/tumbler/tumbler-file-info.c
+++ b/tumbler/tumbler-file-info.c
@@ -23,8 +23,10 @@
#endif
#include <glib.h>
+#include <glib/gi18n.h>
#include <glib-object.h>
+#include <tumbler/tumbler-error.h>
#include <tumbler/tumbler-file-info.h>
#include <tumbler/tumbler-provider-factory.h>
#include <tumbler/tumbler-cache-provider.h>
@@ -74,8 +76,8 @@ struct _TumblerFileInfo
struct _TumblerFileInfoPrivate
{
- GList *thumbnails;
guint64 mtime;
+ GList *thumbnails;
gchar *uri;
};
@@ -286,15 +288,27 @@ tumbler_file_info_load (TumblerFileInfo *info,
/* iterate over all available cache implementations */
for (cp = caches; err == NULL && cp != NULL; cp = cp->next)
{
- /* query thumbnail infos for this URI from the current cache */
- thumbnails = tumbler_cache_get_thumbnails (cp->data, info->priv->uri);
-
- /* try to load the thumbnail info. the loop will terminate if that fails */
- for (tp = thumbnails; err == NULL && tp != NULL; tp = tp->next)
- tumbler_thumbnail_load (tp->data, cancellable, &err);
-
- /* add all queried thumbnails to the list */
- info->priv->thumbnails = g_list_concat (info->priv->thumbnails, thumbnails);
+ /* check if the file itself is a thumbnail */
+ if (!tumbler_cache_is_thumbnail (cp->data, info->priv->uri))
+ {
+ /* query thumbnail infos for this URI from the current cache */
+ thumbnails = tumbler_cache_get_thumbnails (cp->data, info->priv->uri);
+
+ /* try to load thumbnail infos. the loop will terminate if
+ * one of them fails */
+ for (tp = thumbnails; err == NULL && tp != NULL; tp = tp->next)
+ tumbler_thumbnail_load (tp->data, cancellable, &err);
+
+ /* add all queried thumbnails to the list */
+ info->priv->thumbnails = g_list_concat (info->priv->thumbnails,
+ thumbnails);
+ }
+ else
+ {
+ /* we don't allow the generation of thumbnails for thumbnails */
+ g_set_error (&err, TUMBLER_ERROR, TUMBLER_ERROR_IS_THUMBNAIL,
+ _("The file \"%s\" is a thumbnail itself"), info->priv->uri);
+ }
}
/* release cache references */