summaryrefslogtreecommitdiff
path: root/tumblerd/tumbler-registry.c
diff options
context:
space:
mode:
authorGaël Bonithon <gael@xfce.org>2021-12-28 16:20:37 +0100
committerGaël Bonithon <gael@xfce.org>2021-12-29 13:09:43 +0100
commita188f1c30f8e7c98373d620832933522ad29d14f (patch)
tree79c22dab921c185c3fb5b3bef32d291627ea01ae /tumblerd/tumbler-registry.c
parentad8d6ac59b20ab8ccbb3ce4d56c71d25f2a435b6 (diff)
downloadtumbler-a188f1c30f8e7c98373d620832933522ad29d14f.tar.gz
Try all available thumbnailers before declaring failure
The request thumbnailer array no longer contains one thumbnailer per URI, but the list of available thumbnailers for this URI (after applying the filters of the configuration file), sorted by priority. For a given URI, we browse the thumbnailer list until we succeed in generating a thumbnail. An error signal is only issued if the last thumbnailer has failed. Intermediate errors are only displayed if debug logging is enabled. Closes #50.
Diffstat (limited to 'tumblerd/tumbler-registry.c')
-rw-r--r--tumblerd/tumbler-registry.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/tumblerd/tumbler-registry.c b/tumblerd/tumbler-registry.c
index 32cdbfc..6f75654 100644
--- a/tumblerd/tumbler-registry.c
+++ b/tumblerd/tumbler-registry.c
@@ -411,12 +411,12 @@ tumbler_registry_get_thumbnailers (TumblerRegistry *registry)
-TumblerThumbnailer **
+GList **
tumbler_registry_get_thumbnailer_array (TumblerRegistry *registry,
TumblerFileInfo **infos,
guint length)
{
- TumblerThumbnailer **thumbnailers = NULL;
+ GList **thumbnailers = NULL;
gchar *hash_key;
gchar *scheme;
guint n;
@@ -432,7 +432,7 @@ tumbler_registry_get_thumbnailer_array (TumblerRegistry *registry,
tumbler_mutex_lock (registry->mutex);
/* allocate the thumbnailer array */
- thumbnailers = g_new0 (TumblerThumbnailer *, length + 1);
+ thumbnailers = g_new0 (GList *, length + 1);
/* iterate over all URIs */
for (n = 0; n < length; ++n)
@@ -475,11 +475,12 @@ tumbler_registry_get_thumbnailer_array (TumblerRegistry *registry,
}
/* found a usable thumbnailer */
- thumbnailers[n] = g_object_ref (lp->data);
-
- break;
+ thumbnailers[n] = g_list_prepend (thumbnailers[n], g_object_ref (lp->data));
}
+ /* restore thumbnailer priority */
+ thumbnailers[n] = g_list_reverse (thumbnailers[n]);
+
/* cleanup */
g_free (hash_key);
g_free (scheme);