[gimp] pdb: fix PDB compat wrappers which i just broke



commit 41754669e6b0473f22ca33ac85bf02da67d9bb20
Author: Michael Natterer <mitch gimp org>
Date:   Sat Oct 1 00:43:17 2016 +0200

    pdb: fix PDB compat wrappers which i just broke
    
    and simplify them using gimp_color_config_get_rgb_color_profile().

 app/pdb/plug-in-compat-cmds.c       |   72 ++++++++++++++--------------------
 tools/pdbgen/pdb/plug_in_compat.pdb |   72 ++++++++++++++--------------------
 2 files changed, 60 insertions(+), 84 deletions(-)
---
diff --git a/app/pdb/plug-in-compat-cmds.c b/app/pdb/plug-in-compat-cmds.c
index 1892ae2..7111819 100644
--- a/app/pdb/plug-in-compat-cmds.c
+++ b/app/pdb/plug-in-compat-cmds.c
@@ -1983,16 +1983,11 @@ plug_in_icc_profile_apply_invoker (GimpProcedure         *procedure,
     {
       if (gimp_pdb_image_is_not_base_type (image, GIMP_GRAY, error))
         {
-          GFile            *file = NULL;
-          GimpColorProfile *p    = NULL;
+          GimpColorProfile *p = NULL;
 
           if (profile)
             {
-              file = g_file_new_for_path (profile);
-            }
-          else if (image->gimp->config->color_management->rgb_profile)
-            {
-              file = gimp_file_new_for_config_path (image->gimp->config->color_management->rgb_profile, 
error);
+              GFile *file = g_file_new_for_path (profile);
 
               if (file)
                 {
@@ -2008,6 +2003,14 @@ plug_in_icc_profile_apply_invoker (GimpProcedure         *procedure,
                   success = FALSE;
                 }
             }
+          else if (image->gimp->config->color_management->rgb_profile)
+            {
+              p = gimp_color_config_get_rgb_color_profile (image->gimp->config->color_management,
+                                                           error);
+
+              if (! p)
+                success = FALSE;
+            }
 
           if (success)
             {
@@ -2047,23 +2050,14 @@ plug_in_icc_profile_apply_rgb_invoker (GimpProcedure         *procedure,
     {
       if (gimp_pdb_image_is_not_base_type (image, GIMP_GRAY, error))
         {
-          GFile            *file = NULL;
-          GimpColorProfile *p    = NULL;
+          GimpColorProfile *p = NULL;
 
           if (image->gimp->config->color_management->rgb_profile)
             {
-              file = gimp_file_new_for_config_path (image->gimp->config->color_management->rgb_profile, 
error);
+              p = gimp_color_config_get_rgb_color_profile (image->gimp->config->color_management,
+                                                           error);
 
-              if (file)
-                {
-                  p = gimp_color_profile_new_from_file (file, error);
-
-                  if (! p)
-                    success = FALSE;
-
-                  g_object_unref (file);
-                }
-              else
+              if (! p)
                 success = FALSE;
             }
 
@@ -2072,8 +2066,8 @@ plug_in_icc_profile_apply_rgb_invoker (GimpProcedure         *procedure,
               if (! p)
                 p = gimp_image_get_builtin_color_profile (image);
 
-             success = gimp_image_convert_color_profile (image, p, intent, bpc,
-                                                         progress, error);
+              success = gimp_image_convert_color_profile (image, p, intent, bpc,
+                                                          progress, error);
             }
         }
       else
@@ -2103,16 +2097,11 @@ plug_in_icc_profile_set_invoker (GimpProcedure         *procedure,
     {
       if (gimp_pdb_image_is_not_base_type (image, GIMP_GRAY, error))
         {
-          GFile            *file = NULL;
-          GimpColorProfile *p    = NULL;
+          GimpColorProfile *p = NULL;
 
           if (profile)
             {
-              file = g_file_new_for_path (profile);
-            }
-          else if (image->gimp->config->color_management->rgb_profile)
-            {
-              file = gimp_file_new_for_config_path (image->gimp->config->color_management->rgb_profile, 
error);
+              GFile *file = g_file_new_for_path (profile);
 
               if (file)
                 {
@@ -2126,6 +2115,14 @@ plug_in_icc_profile_set_invoker (GimpProcedure         *procedure,
               else
                 success = FALSE;
             }
+          else if (image->gimp->config->color_management->rgb_profile)
+            {
+              p = gimp_color_config_get_rgb_color_profile (image->gimp->config->color_management,
+                                                           error);
+
+              if (! p)
+                success = FALSE;
+            }
 
           if (success)
             {
@@ -2171,23 +2168,14 @@ plug_in_icc_profile_set_rgb_invoker (GimpProcedure         *procedure,
     {
       if (gimp_pdb_image_is_not_base_type (image, GIMP_GRAY, error))
         {
-          GFile            *file = NULL;
-          GimpColorProfile *p    = NULL;
+          GimpColorProfile *p = NULL;
 
           if (image->gimp->config->color_management->rgb_profile)
             {
-              file = gimp_file_new_for_config_path (image->gimp->config->color_management->rgb_profile, 
error);
+              p = gimp_color_config_get_rgb_color_profile (image->gimp->config->color_management,
+                                                           error);
 
-              if (file)
-                {
-                  p = gimp_color_profile_new_from_file (file, error);
-
-                  if (! p)
-                    success = FALSE;
-
-                  g_object_unref (file);
-                }
-              else
+              if (! p)
                 success = FALSE;
             }
 
diff --git a/tools/pdbgen/pdb/plug_in_compat.pdb b/tools/pdbgen/pdb/plug_in_compat.pdb
index b934eed..de95815 100644
--- a/tools/pdbgen/pdb/plug_in_compat.pdb
+++ b/tools/pdbgen/pdb/plug_in_compat.pdb
@@ -1874,16 +1874,11 @@ HELP
 {
   if (gimp_pdb_image_is_not_base_type (image, GIMP_GRAY, error))
     {
-      GFile            *file = NULL;
-      GimpColorProfile *p    = NULL;
+      GimpColorProfile *p = NULL;
 
       if (profile)
         {
-          file = g_file_new_for_path (profile);
-        }
-      else if (image->gimp->config->color_management->rgb_profile)
-        {
-          file = gimp_file_new_for_config_path (image->gimp->config->color_management->rgb_profile, error);
+          GFile *file = g_file_new_for_path (profile);
 
           if (file)
             {
@@ -1899,6 +1894,14 @@ HELP
               success = FALSE;
             }
         }
+      else if (image->gimp->config->color_management->rgb_profile)
+        {
+          p = gimp_color_config_get_rgb_color_profile (image->gimp->config->color_management,
+                                                       error);
+
+          if (! p)
+            success = FALSE;
+        }
 
       if (success)
         {
@@ -1946,23 +1949,14 @@ HELP
 {
   if (gimp_pdb_image_is_not_base_type (image, GIMP_GRAY, error))
     {
-      GFile            *file = NULL;
-      GimpColorProfile *p    = NULL;
+      GimpColorProfile *p = NULL;
 
       if (image->gimp->config->color_management->rgb_profile)
         {
-          file = gimp_file_new_for_config_path (image->gimp->config->color_management->rgb_profile, error);
+          p = gimp_color_config_get_rgb_color_profile (image->gimp->config->color_management,
+                                                       error);
 
-          if (file)
-            {
-              p = gimp_color_profile_new_from_file (file, error);
-
-              if (! p)
-                success = FALSE;
-
-              g_object_unref (file);
-            }
-          else
+          if (! p)
             success = FALSE;
         }
 
@@ -1971,8 +1965,8 @@ HELP
           if (! p)
             p = gimp_image_get_builtin_color_profile (image);
 
-         success = gimp_image_convert_color_profile (image, p, intent, bpc,
-                                                     progress, error);
+          success = gimp_image_convert_color_profile (image, p, intent, bpc,
+                                                      progress, error);
        }
     }
   else
@@ -2008,16 +2002,11 @@ HELP
 {
   if (gimp_pdb_image_is_not_base_type (image, GIMP_GRAY, error))
     {
-      GFile            *file = NULL;
-      GimpColorProfile *p    = NULL;
+      GimpColorProfile *p = NULL;
 
       if (profile)
         {
-          file = g_file_new_for_path (profile);
-        }
-      else if (image->gimp->config->color_management->rgb_profile)
-        {
-          file = gimp_file_new_for_config_path (image->gimp->config->color_management->rgb_profile, error);
+          GFile *file = g_file_new_for_path (profile);
 
           if (file)
             {
@@ -2031,6 +2020,14 @@ HELP
           else
             success = FALSE;
         }
+      else if (image->gimp->config->color_management->rgb_profile)
+        {
+          p = gimp_color_config_get_rgb_color_profile (image->gimp->config->color_management,
+                                                       error);
+
+          if (! p)
+            success = FALSE;
+        }
 
       if (success)
         {
@@ -2083,23 +2080,14 @@ HELP
 {
   if (gimp_pdb_image_is_not_base_type (image, GIMP_GRAY, error))
     {
-      GFile            *file = NULL;
-      GimpColorProfile *p    = NULL;
+      GimpColorProfile *p = NULL;
 
       if (image->gimp->config->color_management->rgb_profile)
         {
-          file = gimp_file_new_for_config_path (image->gimp->config->color_management->rgb_profile, error);
+          p = gimp_color_config_get_rgb_color_profile (image->gimp->config->color_management,
+                                                       error);
 
-          if (file)
-            {
-              p = gimp_color_profile_new_from_file (file, error);
-
-              if (! p)
-                success = FALSE;
-
-              g_object_unref (file);
-            }
-          else
+          if (! p)
             success = FALSE;
         }
 


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