[gimp] plug-ins: Improve JPEG2000 error messages
- From: Martin Nordholts <martinn src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] plug-ins: Improve JPEG2000 error messages
- Date: Mon, 17 Aug 2009 21:32:40 +0000 (UTC)
commit ada56e5c2c6459e17d085174d04a400fa9574c1b
Author: Martin Nordholts <martinn src gnome org>
Date: Mon Aug 17 23:34:18 2009 +0200
plug-ins: Improve JPEG2000 error messages
Improve JPEG2000 error messages by using g_set_error() so we don't
throw many different errors in the users face, and make each error
unique and descriptive instead of using the same message regardless of
the type of error.
plug-ins/common/file-jp2-load.c | 56 ++++++++++++++++++++++++++++++++++-----
1 files changed, 49 insertions(+), 7 deletions(-)
---
diff --git a/plug-ins/common/file-jp2-load.c b/plug-ins/common/file-jp2-load.c
index 2982a8d..7ae1352 100644
--- a/plug-ins/common/file-jp2-load.c
+++ b/plug-ins/common/file-jp2-load.c
@@ -211,7 +211,9 @@ load_image (const gchar *filename,
image = jas_image_decode (stream, -1, 0);
if (!image)
{
- g_message(_("Couldn't decode image."));
+ g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
+ _("Couldn't decode '%s'."),
+ gimp_filename_to_utf8 (filename));
return -1;
}
@@ -232,7 +234,10 @@ load_image (const gchar *filename,
components[0] = jas_image_getcmptbytype (image, JAS_IMAGE_CT_GRAY_Y);
if (components[0] == -1)
{
- g_message (_("Image type currently not supported."));
+ g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
+ _("The image '%s' is in grayscale but does not contain "
+ "any gray component."),
+ gimp_filename_to_utf8 (filename));
return -1;
}
components[1] = jas_image_getcmptbytype (image, JAS_IMAGE_CT_OPACITY);
@@ -255,7 +260,10 @@ load_image (const gchar *filename,
components[2] = jas_image_getcmptbytype (image, JAS_IMAGE_CT_RGB_B);
if (components[0] == -1 || components[1] == -1 || components[2] == -1)
{
- g_message (_("Image type currently not supported."));
+ g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
+ _("The image '%s' is in RGB but is missing some of the "
+ "components."),
+ gimp_filename_to_utf8 (filename));
return -1;
}
components[3] = jas_image_getcmptbytype (image, JAS_IMAGE_CT_OPACITY);
@@ -271,8 +279,32 @@ load_image (const gchar *filename,
}
break;
+ case JAS_CLRSPC_FAM_XYZ:
+ g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
+ _("The image '%s' is in the CIEXYZ color space but there is "
+ "no code in place to convert it to RGB."),
+ gimp_filename_to_utf8 (filename));
+ return -1;
+
+ case JAS_CLRSPC_FAM_LAB:
+ g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
+ _("The image '%s' is in the CIELAB color space but there is "
+ "no code in place to convert it to RGB."),
+ gimp_filename_to_utf8 (filename));
+ return -1;
+
+ case JAS_CLRSPC_FAM_YCBCR:
+ g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
+ _("The image '%s' is in the YCbCr color space but there is "
+ "no code in place to convert it to RGB."),
+ gimp_filename_to_utf8 (filename));
+ return -1;
+
+ case JAS_CLRSPC_FAM_UNKNOWN:
default:
- g_message (_("Image type currently not supported."));
+ g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
+ _("The image '%s' is in an unkown color space."),
+ gimp_filename_to_utf8 (filename));
return -1;
}
@@ -284,20 +316,30 @@ load_image (const gchar *filename,
jas_image_cmptbrx (image, components[i]) != jas_image_brx (image) ||
jas_image_cmptbry (image, components[i]) != jas_image_bry (image))
{
- g_message (_("Image type currently not supported."));
+ g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
+ _("Image component %d of image '%s' did not have the "
+ "same size as the image which is currently not "
+ "supported."),
+ i, gimp_filename_to_utf8 (filename));
return -1;
}
if (jas_image_cmpthstep (image, components[i]) != 1 ||
jas_image_cmptvstep (image, components[i]) != 1)
{
- g_message (_("Image type currently not supported."));
+ g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
+ _("Image component %d of image '%s' does not have both "
+ "a hstep and vstep."),
+ i, gimp_filename_to_utf8 (filename));
return -1;
}
if (jas_image_cmptsgnd (image, components[i]))
{
- g_message (_("Image type currently not supported."));
+ g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
+ _("Image component %d of image '%s' is signed which is "
+ "currently not supported by GIMP."),
+ i, gimp_filename_to_utf8 (filename));
return -1;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]