summaryrefslogtreecommitdiff
path: root/tumbler
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 /tumbler
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 'tumbler')
-rw-r--r--tumbler/tumbler-thumbnailer.c31
-rw-r--r--tumbler/tumbler-thumbnailer.h4
2 files changed, 21 insertions, 14 deletions
diff --git a/tumbler/tumbler-thumbnailer.c b/tumbler/tumbler-thumbnailer.c
index 27d3177..5074d35 100644
--- a/tumbler/tumbler-thumbnailer.c
+++ b/tumbler/tumbler-thumbnailer.c
@@ -282,20 +282,28 @@ tumbler_thumbnailer_supports_hash_key (TumblerThumbnailer *thumbnailer,
-TumblerThumbnailer **
-tumbler_thumbnailer_array_copy (TumblerThumbnailer **thumbnailers,
- guint length)
+static gpointer
+tumbler_thumbnailer_object_ref (gconstpointer src,
+ gpointer data)
{
- TumblerThumbnailer **copy;
- guint n;
+ return g_object_ref ((gpointer) src);
+}
+
+
+
+GList **
+tumbler_thumbnailer_array_copy (GList **thumbnailers,
+ guint length)
+{
+ GList **copy;
+ guint n;
g_return_val_if_fail (thumbnailers != NULL, NULL);
- copy = g_new0 (TumblerThumbnailer *, length + 1);
+ copy = g_new0 (GList *, length + 1);
for (n = 0; n < length; ++n)
- if (thumbnailers[n] != NULL)
- copy[n] = g_object_ref (thumbnailers[n]);
+ copy[n] = g_list_copy_deep (thumbnailers[n], tumbler_thumbnailer_object_ref, NULL);
copy[n] = NULL;
@@ -305,14 +313,13 @@ tumbler_thumbnailer_array_copy (TumblerThumbnailer **thumbnailers,
void
-tumbler_thumbnailer_array_free (TumblerThumbnailer **thumbnailers,
- guint length)
+tumbler_thumbnailer_array_free (GList **thumbnailers,
+ guint length)
{
guint n;
for (n = 0; thumbnailers != NULL && n < length; ++n)
- if (thumbnailers[n] != NULL)
- g_object_unref (thumbnailers[n]);
+ g_list_free_full (thumbnailers[n], g_object_unref);
g_free (thumbnailers);
}
diff --git a/tumbler/tumbler-thumbnailer.h b/tumbler/tumbler-thumbnailer.h
index b983d4e..0bbd7d2 100644
--- a/tumbler/tumbler-thumbnailer.h
+++ b/tumbler/tumbler-thumbnailer.h
@@ -78,9 +78,9 @@ gboolean tumbler_thumbnailer_supports_location (TumblerThumbnailer
gboolean tumbler_thumbnailer_supports_hash_key (TumblerThumbnailer *thumbnailer,
const gchar *hash_key);
-TumblerThumbnailer **tumbler_thumbnailer_array_copy (TumblerThumbnailer **thumbnailers,
+GList **tumbler_thumbnailer_array_copy (GList **thumbnailers,
guint length);
-void tumbler_thumbnailer_array_free (TumblerThumbnailer **thumbnailers,
+void tumbler_thumbnailer_array_free (GList **thumbnailers,
guint length);
G_END_DECLS