summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGaël Bonithon <gael@xfce.org>2021-12-20 17:21:02 +0100
committerGaël Bonithon <gael@xfce.org>2021-12-20 18:28:46 +0100
commitb7beef90918c2d3c3b3e33b75dfc4c08e0835398 (patch)
treef1a8acd10fd31e9e944928c944e6cd8bb4391986 /plugins
parente7623e5d2d680f07c835ed9b1a607d44d897191b (diff)
downloadtumbler-b7beef90918c2d3c3b3e33b75dfc4c08e0835398.tar.gz
font-thumbnailer: Fix error handling
Diffstat (limited to 'plugins')
-rw-r--r--plugins/font-thumbnailer/font-thumbnailer.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/plugins/font-thumbnailer/font-thumbnailer.c b/plugins/font-thumbnailer/font-thumbnailer.c
index bd02c8e..4b83046 100644
--- a/plugins/font-thumbnailer/font-thumbnailer.c
+++ b/plugins/font-thumbnailer/font-thumbnailer.c
@@ -462,7 +462,7 @@ font_thumbnailer_create (TumblerAbstractThumbnailer *thumbnailer,
/* there was an error in the freetype initialization, abort */
error_msg = g_strdup_printf (_("Could not initialize freetype: %s"),
ft_strerror (font_thumbnailer->library_error));
- g_signal_emit_by_name (thumbnailer, "error", uri, 0, error_msg);
+ g_signal_emit_by_name (thumbnailer, "error", uri, TUMBLER_ERROR_UNSUPPORTED, error_msg);
g_free (error_msg);
return;
}
@@ -474,7 +474,7 @@ font_thumbnailer_create (TumblerAbstractThumbnailer *thumbnailer,
/* there was an error, emit error signal */
error_msg = g_strdup_printf (_("Could not load file contents: %s"),
error->message);
- g_signal_emit_by_name (thumbnailer, "error", uri, 0, error_msg);
+ g_signal_emit_by_name (thumbnailer, "error", uri, error->code, error_msg);
g_free (error_msg);
/* clean up */
@@ -493,7 +493,7 @@ font_thumbnailer_create (TumblerAbstractThumbnailer *thumbnailer,
/* the font file could not be loaded, emit an error signal */
error_msg = g_strdup_printf (_("Could not open font file: %s"),
ft_strerror (ft_error));
- g_signal_emit_by_name (thumbnailer, "error", uri, 0, error_msg);
+ g_signal_emit_by_name (thumbnailer, "error", uri, TUMBLER_ERROR_NO_CONTENT, error_msg);
g_free (error_msg);
/* clean up */
@@ -512,12 +512,13 @@ font_thumbnailer_create (TumblerAbstractThumbnailer *thumbnailer,
{
/* try to set the character map */
ft_error = FT_Set_Charmap (face, face->charmaps[n]);
- if (G_UNLIKELY (error != 0))
+ if (G_UNLIKELY (ft_error != 0))
{
/* emit an error signal */
error_msg = g_strdup_printf (_("Could not set the character map: %s"),
ft_strerror (ft_error));
- g_signal_emit_by_name (thumbnailer, "error", uri, 0, error_msg);
+ g_signal_emit_by_name (thumbnailer, "error", uri,
+ TUMBLER_ERROR_INVALID_FORMAT, error_msg);
g_free (error_msg);
/* clean up */
@@ -544,7 +545,7 @@ font_thumbnailer_create (TumblerAbstractThumbnailer *thumbnailer,
/* emit an error signal */
error_msg = g_strdup_printf (_("Could not render glyphs: %s"),
ft_strerror (ft_error));
- g_signal_emit_by_name (thumbnailer, "error", uri, 0, error_msg);
+ g_signal_emit_by_name (thumbnailer, "error", uri, TUMBLER_ERROR_INVALID_FORMAT, error_msg);
g_free (error_msg);
/* clean up */