[gimp] Bug 555562 - GIMP should ask before applying working space profile



commit 77dac3ea60c4d645303fdbc1eb57700a5a296883
Author: Michael Natterer <mitch gimp org>
Date:   Thu Aug 20 16:02:22 2015 +0200

    Bug 555562 - GIMP should ask before applying working space profile
    
    Get rid of the "configurable RGB working space profile".
    
    Instead, turn GimpColorConfig's "rgb-profile" property into a
    "Preferred RGB profile" thing that is only a hint and never used
    without explicit user interaction. Present it next to the built-in
    profile in the profile combo boxes and call it "Preferred" in the
    prefs dialog and its tooltip.
    
    Most importantly, don't use it as the image's profile when the image
    is not tagged with a profile. Untagged images are now always in the
    sRGB or linear RGB built-in color spaces.
    
    This commit reduces the "Apply color profile" dialog on file import to
    a simple "Convert to built-in RGB", but that dialog is about to be
    moved to the core and improved anyway.

 app/core/gimpimage.c               |   16 +--------
 app/dialogs/color-profile-dialog.c |   64 ++++++++++++++---------------------
 app/dialogs/preferences-dialog.c   |    2 +-
 libgimpconfig/gimpcolorconfig.c    |   38 ++++++++++++++-------
 plug-ins/common/lcms.c             |    8 ----
 5 files changed, 55 insertions(+), 73 deletions(-)
---
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index a02ae3f..3287e46 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -1382,23 +1382,11 @@ gimp_image_color_managed_get_color_profile (GimpColorManaged *managed)
   GimpColorProfile *profile;
 
   profile = gimp_image_get_color_profile (image);
-  if (profile)
-    g_object_ref (profile);
 
   if (! profile)
-    {
-      GimpColorConfig *config = image->gimp->config->color_management;
-
-      profile = gimp_color_config_get_rgb_color_profile (config, NULL);
-    }
-
-  if (! profile)
-    {
-      profile = gimp_image_get_builtin_color_profile (image);
-      g_object_ref (profile);
-    }
+    profile = gimp_image_get_builtin_color_profile (image);
 
-  return profile;
+  return g_object_ref (profile);
 }
 
 static void
diff --git a/app/dialogs/color-profile-dialog.c b/app/dialogs/color-profile-dialog.c
index 6dea59b..84b9b81 100644
--- a/app/dialogs/color-profile-dialog.c
+++ b/app/dialogs/color-profile-dialog.c
@@ -276,10 +276,9 @@ color_profile_combo_box_new (ProfileDialog *dialog)
   GtkWidget        *combo;
   GtkWidget        *chooser;
   gchar            *history;
+  GimpColorProfile *profile;
   gchar            *label;
-  GFile            *rgb_file = NULL;
-  GimpColorProfile *profile  = NULL;
-  GError           *error    = NULL;
+  GError           *error = NULL;
 
   chooser = gimp_color_profile_chooser_dialog_new (_("Select destination profile"));
 
@@ -287,11 +286,32 @@ color_profile_combo_box_new (ProfileDialog *dialog)
   combo = gimp_color_profile_combo_box_new (chooser, history);
   g_free (history);
 
+  profile = gimp_image_get_builtin_color_profile (dialog->image);
+
+  label = g_strdup_printf (_("Built-in RGB (%s)"),
+                           gimp_color_profile_get_label (profile));
+
+  gimp_color_profile_combo_box_add_file (GIMP_COLOR_PROFILE_COMBO_BOX (combo),
+                                         NULL, label);
+
+  g_free (label);
+
   profile = gimp_color_config_get_rgb_color_profile (dialog->config, &error);
 
   if (profile)
     {
-      rgb_file = g_file_new_for_path (dialog->config->rgb_profile);
+      GFile *file = g_file_new_for_path (dialog->config->rgb_profile);
+
+      label = g_strdup_printf (_("Preferred RGB (%s)"),
+                               gimp_color_profile_get_label (profile));
+
+      g_object_unref (profile);
+
+      gimp_color_profile_combo_box_add_file (GIMP_COLOR_PROFILE_COMBO_BOX (combo),
+                                             file, label);
+
+      g_object_unref (file);
+      g_free (label);
     }
   else if (error)
     {
@@ -301,25 +321,6 @@ color_profile_combo_box_new (ProfileDialog *dialog)
       g_clear_error (&error);
     }
 
-  if (! profile)
-    {
-      profile = gimp_image_get_builtin_color_profile (dialog->image);
-      g_object_ref (profile);
-    }
-
-  label = g_strdup_printf (_("RGB workspace (%s)"),
-                           gimp_color_profile_get_label (profile));
-
-  g_object_unref (profile);
-
-  gimp_color_profile_combo_box_add_file (GIMP_COLOR_PROFILE_COMBO_BOX (combo),
-                                         rgb_file, label);
-
-  if (rgb_file)
-    g_object_unref (rgb_file);
-
-  g_free (label);
-
   gimp_color_profile_combo_box_set_active_file (GIMP_COLOR_PROFILE_COMBO_BOX (combo),
                                                 NULL, NULL);
 
@@ -352,21 +353,8 @@ color_profile_dialog_response (GtkWidget     *widget,
         }
       else
         {
-          dest_profile = gimp_color_config_get_rgb_color_profile (dialog->config,
-                                                                  &error);
-
-          if (! dest_profile)
-            {
-              if (error)
-                {
-                  success = FALSE;
-                }
-              else
-                {
-                  dest_profile = gimp_image_get_builtin_color_profile (dialog->image);
-                  g_object_ref (dest_profile);
-                }
-            }
+          dest_profile = gimp_image_get_builtin_color_profile (dialog->image);
+          g_object_ref (dest_profile);
         }
 
       if (success)
diff --git a/app/dialogs/preferences-dialog.c b/app/dialogs/preferences-dialog.c
index d41b322..5a2f278 100644
--- a/app/dialogs/preferences-dialog.c
+++ b/app/dialogs/preferences-dialog.c
@@ -2374,7 +2374,7 @@ prefs_dialog_new (Gimp       *gimp,
     }
     profiles[] =
     {
-      { N_("_RGB profile:"),
+      { N_("Preferred _RGB profile:"),
         N_("Select RGB Color Profile"),     "rgb-profile"     },
       { N_("_CMYK profile:"),
         N_("Select CMYK Color Profile"),    "cmyk-profile"    },
diff --git a/libgimpconfig/gimpcolorconfig.c b/libgimpconfig/gimpcolorconfig.c
index 5ad5c06..f410b62 100644
--- a/libgimpconfig/gimpcolorconfig.c
+++ b/libgimpconfig/gimpcolorconfig.c
@@ -52,38 +52,52 @@
 
 #define COLOR_MANAGEMENT_MODE_BLURB \
   _("Mode of operation for color management.")
+
 #define DISPLAY_PROFILE_BLURB \
   _("The color profile of your (primary) monitor.")
+
 #define DISPLAY_PROFILE_FROM_GDK_BLURB \
   _("When enabled, GIMP will try to use the display color profile from " \
     "the windowing system.  The configured monitor profile is then only " \
     "used as a fallback.")
+
 #define RGB_PROFILE_BLURB \
-  _("The default RGB working space color profile.")
+  _("The preferred RGB working space color profile. It will be offered " \
+    "next to the built-in RGB profile when a color profile can be chosen.")
+
 #define CMYK_PROFILE_BLURB \
   _("The CMYK color profile used to convert between RGB and CMYK.")
+
 #define PRINTER_PROFILE_BLURB \
   _("The color profile to use for soft proofing from your image's " \
-    "color space to some other color space, including "             \
+    "color space to some other color space, including " \
     "soft proofing to a printer or other output device profile. ")
+
 #define DISPLAY_RENDERING_INTENT_BLURB \
-  _("How colors are converted from your image's color space to your display device. " \
-    "Relative colorimetric is usually the best choice. "                \
-    "Unless you use a LUT monitor profile (most monitor profiles are matrix), " \
-    "choosing perceptual intent really gives you relative colorimetric." )
+  _("How colors are converted from your image's color space to your " \
+    "display device. Relative colorimetric is usually the best choice. " \
+    "Unless you use a LUT monitor profile (most monitor profiles are " \
+    "matrix), choosing perceptual intent really gives you relative " \
+    "colorimetric." )
+
 #define DISPLAY_USE_BPC_BLURB \
-  _("Do use black point compensation (unless you know you have a reason not to). ")
-#define SIMULATION_RENDERING_INTENT_BLURB                             \
+  _("Do use black point compensation (unless you know you have a reason " \
+    "not to). ")
+
+#define SIMULATION_RENDERING_INTENT_BLURB \
   _("How colors are converted from your image's color space to the "  \
-    "output simulation device (usually your monitor). "               \
+    "output simulation device (usually your monitor). " \
     "Try them all and choose what looks the best. ")
-#define SIMULATION_USE_BPC_BLURB                        \
+
+#define SIMULATION_USE_BPC_BLURB \
   _("Try with and without black point compensation "\
     "and choose what looks best. ")
-#define SIMULATION_GAMUT_CHECK_BLURB                        \
+
+#define SIMULATION_GAMUT_CHECK_BLURB \
   _("When enabled, the print simulation will mark colors " \
     "which can not be represented in the target color space.")
-#define OUT_OF_GAMUT_COLOR_BLURB                                        \
+
+#define OUT_OF_GAMUT_COLOR_BLURB \
   _("The color to use for marking colors which are out of gamut.")
 
 
diff --git a/plug-ins/common/lcms.c b/plug-ins/common/lcms.c
index 3767946..b872e07 100644
--- a/plug-ins/common/lcms.c
+++ b/plug-ins/common/lcms.c
@@ -270,11 +270,6 @@ lcms_icc_apply (GimpColorConfig          *config,
   g_return_val_if_fail (image != -1, GIMP_PDB_CALLING_ERROR);
 
   if (file)
-    g_object_ref (file);
-  else if (config->rgb_profile)
-    file = g_file_new_for_path (config->rgb_profile);
-
-  if (file)
     {
       GError *error = NULL;
 
@@ -336,9 +331,6 @@ lcms_icc_apply (GimpColorConfig          *config,
   g_object_unref (src_profile);
   g_object_unref (dest_profile);
 
-  if (file)
-    g_object_unref (file);
-
   return status;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]