Commit 4b67569e authored by Gaël Bonithon's avatar Gaël Bonithon
Browse files

thumbnailer: Fall back on lower qualities in case of unsupported flavor

Replaces: de65c2f2
Related: #81
parent f40f8cd5
Pipeline #16003 passed with stages
in 1 minute and 12 seconds
......@@ -567,7 +567,12 @@ rstto_file_get_thumbnail (RsttoFile *r_file,
const gchar *thumbnail_path;
guint n_pixels;
/* get the flavor, trying to fall back on lower qualities if necessary */
flavor = rstto_util_get_thumbnail_flavor (size);
while (r_file->priv->thumbnail_states[flavor] == RSTTO_THUMBNAIL_STATE_ERROR
&& flavor > RSTTO_THUMBNAIL_FLAVOR_NORMAL)
flavor--;
switch (r_file->priv->thumbnail_states[flavor])
{
case RSTTO_THUMBNAIL_STATE_PROCESSED:
......
......@@ -239,7 +239,8 @@ rstto_image_list_init (RsttoImageList *image_list)
g_signal_connect (image_list->priv->thumbnailer, "ready",
G_CALLBACK (cb_rstto_thumbnailer_ready), image_list);
g_signal_connect (image_list->priv->thumbnailer, "error",
G_CALLBACK (cb_rstto_thumbnailer_ready), image_list);
}
static void
......
......@@ -29,6 +29,7 @@
enum
{
RSTTO_THUMBNAILER_SIGNAL_READY = 0,
RSTTO_THUMBNAILER_SIGNAL_ERROR,
RSTTO_THUMBNAILER_SIGNAL_COUNT
};
......@@ -139,6 +140,17 @@ rstto_thumbnailer_class_init (RsttoThumbnailerClass *klass)
1,
G_TYPE_OBJECT,
NULL);
rstto_thumbnailer_signals[RSTTO_THUMBNAILER_SIGNAL_ERROR] = g_signal_new ("error",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
0,
NULL,
NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
1,
G_TYPE_OBJECT,
NULL);
}
/**
......@@ -448,7 +460,12 @@ cb_rstto_thumbnailer_thumbnail_error (TumblerThumbnailer1 *proxy,
if (error_code == G_IO_ERROR_CANCELLED)
rstto_thumbnailer_queue_file (thumbnailer, flavor, iter->data);
else
{
rstto_file_set_thumbnail_state (iter->data, flavor, RSTTO_THUMBNAIL_STATE_ERROR);
g_signal_emit (thumbnailer,
rstto_thumbnailer_signals[RSTTO_THUMBNAILER_SIGNAL_ERROR],
0, iter->data, NULL);
}
g_object_unref (iter->data);
thumbnailer->priv->in_process_queues[flavor] =
......
Supports Markdown
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