[gimp] libgimpwidgets: don't try to open non-regular files as ICC profiles
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimpwidgets: don't try to open non-regular files as ICC profiles
- Date: Tue, 19 May 2015 11:14:04 +0000 (UTC)
commit 4c55f45552fda5530d41feb9d9900400c2439425
Author: Michael Natterer <mitch gimp org>
Date: Tue May 19 13:12:34 2015 +0200
libgimpwidgets: don't try to open non-regular files as ICC profiles
Instead, show proper messages in the profile chooser's preview pane.
libgimpwidgets/gimpcolorprofilechooserdialog.c | 37 ++++++++++++++++-------
1 files changed, 26 insertions(+), 11 deletions(-)
---
diff --git a/libgimpwidgets/gimpcolorprofilechooserdialog.c b/libgimpwidgets/gimpcolorprofilechooserdialog.c
index 9057e90..dd72f37 100644
--- a/libgimpwidgets/gimpcolorprofilechooserdialog.c
+++ b/libgimpwidgets/gimpcolorprofilechooserdialog.c
@@ -195,19 +195,34 @@ gimp_color_profile_chooser_dialog_update_preview (GimpColorProfileChooserDialog
return;
}
- profile = gimp_lcms_profile_open_from_file (file, &error);
-
- if (! profile)
+ switch (g_file_query_file_type (file, G_FILE_QUERY_INFO_NONE, NULL))
{
+ case G_FILE_TYPE_REGULAR:
+ profile = gimp_lcms_profile_open_from_file (file, &error);
+
+ if (! profile)
+ {
+ gimp_color_profile_view_set_error (dialog->priv->profile_view,
+ error->message);
+ g_clear_error (&error);
+ }
+ else
+ {
+ gimp_color_profile_view_set_profile (dialog->priv->profile_view,
+ profile);
+ gimp_lcms_profile_close (profile);
+ }
+ break;
+
+ case G_FILE_TYPE_DIRECTORY:
gimp_color_profile_view_set_error (dialog->priv->profile_view,
- error->message);
- g_clear_error (&error);
- }
- else
- {
- gimp_color_profile_view_set_profile (dialog->priv->profile_view,
- profile);
- gimp_lcms_profile_close (profile);
+ _("Folder"));
+ break;
+
+ default:
+ gimp_color_profile_view_set_error (dialog->priv->profile_view,
+ _("Not a regular file."));
+ break;
}
g_object_unref (file);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]