Commit 41754669 authored by Michael Natterer's avatar Michael Natterer 😴

pdb: fix PDB compat wrappers which i just broke

and simplify them using gimp_color_config_get_rgb_color_profile().
parent 0524b602
......@@ -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;
}
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment