[gimp] pdb: change the URIs in the color profile API to GFiles
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] pdb: change the URIs in the color profile API to GFiles
- Date: Wed, 11 Sep 2019 20:44:39 +0000 (UTC)
commit 77731d1e8ececa77fa290cc9f4f00e9203dea6a8
Author: Michael Natterer <mitch gimp org>
Date: Wed Sep 11 22:44:17 2019 +0200
pdb: change the URIs in the color profile API to GFiles
app/pdb/image-color-profile-cmds.c | 42 +++++++++++++++----------------------
libgimp/gimpimagecolorprofile_pdb.c | 16 +++++++-------
libgimp/gimpimagecolorprofile_pdb.h | 4 ++--
pdb/groups/image_color_profile.pdb | 20 +++++++-----------
4 files changed, 34 insertions(+), 48 deletions(-)
---
diff --git a/app/pdb/image-color-profile-cmds.c b/app/pdb/image-color-profile-cmds.c
index 8c4688f000..4d144ca9fa 100644
--- a/app/pdb/image-color-profile-cmds.c
+++ b/app/pdb/image-color-profile-cmds.c
@@ -191,16 +191,15 @@ image_set_color_profile_from_file_invoker (GimpProcedure *procedure,
{
gboolean success = TRUE;
GimpImage *image;
- const gchar *uri;
+ GFile *file;
image = g_value_get_object (gimp_value_array_index (args, 0));
- uri = g_value_get_string (gimp_value_array_index (args, 1));
+ file = g_value_get_object (gimp_value_array_index (args, 1));
if (success)
{
- if (uri)
+ if (file)
{
- GFile *file = g_file_new_for_uri (uri);
GimpColorProfile *profile;
profile = gimp_color_profile_new_from_file (file, error);
@@ -213,8 +212,6 @@ image_set_color_profile_from_file_invoker (GimpProcedure *procedure,
}
else
success = FALSE;
-
- g_object_unref (file);
}
else
{
@@ -286,20 +283,19 @@ image_convert_color_profile_from_file_invoker (GimpProcedure *procedure,
{
gboolean success = TRUE;
GimpImage *image;
- const gchar *uri;
+ GFile *file;
gint intent;
gboolean bpc;
image = g_value_get_object (gimp_value_array_index (args, 0));
- uri = g_value_get_string (gimp_value_array_index (args, 1));
+ file = g_value_get_object (gimp_value_array_index (args, 1));
intent = g_value_get_enum (gimp_value_array_index (args, 2));
bpc = g_value_get_boolean (gimp_value_array_index (args, 3));
if (success)
{
- if (uri)
+ if (file)
{
- GFile *file = g_file_new_for_uri (uri);
GimpColorProfile *profile;
profile = gimp_color_profile_new_from_file (file, error);
@@ -313,8 +309,6 @@ image_convert_color_profile_from_file_invoker (GimpProcedure *procedure,
}
else
success = FALSE;
-
- g_object_unref (file);
}
else
success = FALSE;
@@ -452,12 +446,11 @@ register_image_color_profile_procs (GimpPDB *pdb)
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
- gimp_param_spec_string ("uri",
- "uri",
- "The URI of the file containing the new color
profile",
- FALSE, FALSE, FALSE,
- NULL,
- GIMP_PARAM_READWRITE));
+ g_param_spec_object ("file",
+ "file",
+ "The file containing the new color profile",
+ G_TYPE_FILE,
+ GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
@@ -516,7 +509,7 @@ register_image_color_profile_procs (GimpPDB *pdb)
"gimp-image-convert-color-profile-from-file");
gimp_procedure_set_static_help (procedure,
"Convert the image's layers to a color profile",
- "This procedure converts from the image's color profile (or the default
RGB or grayscale profile if none is set) to an ICC profile specified by 'uri'. Only RGB and grayscale color
profiles are accepted, according to the image's type.",
+ "This procedure converts from the image's color profile (or the default
RGB or grayscale profile if none is set) to an ICC profile specified by 'file'. Only RGB and grayscale color
profiles are accepted, according to the image's type.",
NULL);
gimp_procedure_set_static_attribution (procedure,
"Michael Natterer <mitch gimp org>",
@@ -529,12 +522,11 @@ register_image_color_profile_procs (GimpPDB *pdb)
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
- gimp_param_spec_string ("uri",
- "uri",
- "The URI of the file containing the new color
profile",
- FALSE, FALSE, FALSE,
- NULL,
- GIMP_PARAM_READWRITE));
+ g_param_spec_object ("file",
+ "file",
+ "The file containing the new color profile",
+ G_TYPE_FILE,
+ GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_enum ("intent",
"intent",
diff --git a/libgimp/gimpimagecolorprofile_pdb.c b/libgimp/gimpimagecolorprofile_pdb.c
index f793158910..3b1d8d2073 100644
--- a/libgimp/gimpimagecolorprofile_pdb.c
+++ b/libgimp/gimpimagecolorprofile_pdb.c
@@ -178,7 +178,7 @@ _gimp_image_set_color_profile (GimpImage *image,
/**
* gimp_image_set_color_profile_from_file:
* @image: The image.
- * @uri: The URI of the file containing the new color profile.
+ * @file: The file containing the new color profile.
*
* Sets the image's color profile from an ICC file
*
@@ -194,8 +194,8 @@ _gimp_image_set_color_profile (GimpImage *image,
* Since: 2.10
**/
gboolean
-gimp_image_set_color_profile_from_file (GimpImage *image,
- const gchar *uri)
+gimp_image_set_color_profile_from_file (GimpImage *image,
+ GFile *file)
{
GimpValueArray *args;
GimpValueArray *return_vals;
@@ -203,7 +203,7 @@ gimp_image_set_color_profile_from_file (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE, image,
- G_TYPE_STRING, uri,
+ G_TYPE_FILE, file,
G_TYPE_NONE);
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
@@ -272,7 +272,7 @@ _gimp_image_convert_color_profile (GimpImage *image,
/**
* gimp_image_convert_color_profile_from_file:
* @image: The image.
- * @uri: The URI of the file containing the new color profile.
+ * @file: The file containing the new color profile.
* @intent: Rendering intent.
* @bpc: Black point compensation.
*
@@ -280,7 +280,7 @@ _gimp_image_convert_color_profile (GimpImage *image,
*
* This procedure converts from the image's color profile (or the
* default RGB or grayscale profile if none is set) to an ICC profile
- * specified by 'uri'. Only RGB and grayscale color profiles are
+ * specified by 'file'. Only RGB and grayscale color profiles are
* accepted, according to the image's type.
*
* Returns: TRUE on success.
@@ -289,7 +289,7 @@ _gimp_image_convert_color_profile (GimpImage *image,
**/
gboolean
gimp_image_convert_color_profile_from_file (GimpImage *image,
- const gchar *uri,
+ GFile *file,
GimpColorRenderingIntent intent,
gboolean bpc)
{
@@ -299,7 +299,7 @@ gimp_image_convert_color_profile_from_file (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE, image,
- G_TYPE_STRING, uri,
+ G_TYPE_FILE, file,
GIMP_TYPE_COLOR_RENDERING_INTENT, intent,
G_TYPE_BOOLEAN, bpc,
G_TYPE_NONE);
diff --git a/libgimp/gimpimagecolorprofile_pdb.h b/libgimp/gimpimagecolorprofile_pdb.h
index 454a837bfe..0731a9eb1e 100644
--- a/libgimp/gimpimagecolorprofile_pdb.h
+++ b/libgimp/gimpimagecolorprofile_pdb.h
@@ -40,14 +40,14 @@ G_GNUC_INTERNAL gboolean _gimp_image_set_color_profile (GimpImage
gint num_bytes,
const guint8
*color_profile);
gboolean gimp_image_set_color_profile_from_file (GimpImage *image,
- const gchar *uri);
+ GFile *file);
G_GNUC_INTERNAL gboolean _gimp_image_convert_color_profile (GimpImage *image,
gint num_bytes,
const guint8 *color_profile,
GimpColorRenderingIntent intent,
gboolean bpc);
gboolean gimp_image_convert_color_profile_from_file (GimpImage *image,
- const gchar *uri,
+ GFile *file,
GimpColorRenderingIntent intent,
gboolean bpc);
diff --git a/pdb/groups/image_color_profile.pdb b/pdb/groups/image_color_profile.pdb
index e2a1347776..107749a29a 100644
--- a/pdb/groups/image_color_profile.pdb
+++ b/pdb/groups/image_color_profile.pdb
@@ -181,16 +181,15 @@ HELP
@inargs = (
{ name => 'image', type => 'image',
desc => 'The image' },
- { name => 'uri', type => 'string',
- desc => 'The URI of the file containing the new color profile' }
+ { name => 'file', type => 'file',
+ desc => 'The file containing the new color profile' }
);
%invoke = (
code => <<'CODE'
{
- if (uri)
+ if (file)
{
- GFile *file = g_file_new_for_uri (uri);
GimpColorProfile *profile;
profile = gimp_color_profile_new_from_file (file, error);
@@ -203,8 +202,6 @@ HELP
}
else
success = FALSE;
-
- g_object_unref (file);
}
else
{
@@ -277,7 +274,7 @@ sub image_convert_color_profile_from_file {
$help = <<'HELP';
This procedure converts from the image's color profile (or the default
RGB or grayscale profile if none is set) to an ICC profile specified by
-'uri'. Only RGB and grayscale color profiles are accepted, according to
+'file'. Only RGB and grayscale color profiles are accepted, according to
the image's type.
HELP
@@ -286,8 +283,8 @@ HELP
@inargs = (
{ name => 'image', type => 'image',
desc => 'The image' },
- { name => 'uri', type => 'string',
- desc => 'The URI of the file containing the new color profile' },
+ { name => 'file', type => 'file',
+ desc => 'The file containing the new color profile' },
{ name => 'intent', type => 'enum GimpColorRenderingIntent',
desc => 'Rendering intent' },
{ name => 'bpc', type => 'boolean',
@@ -297,9 +294,8 @@ HELP
%invoke = (
code => <<'CODE'
{
- if (uri)
+ if (file)
{
- GFile *file = g_file_new_for_uri (uri);
GimpColorProfile *profile;
profile = gimp_color_profile_new_from_file (file, error);
@@ -313,8 +309,6 @@ HELP
}
else
success = FALSE;
-
- g_object_unref (file);
}
else
success = FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]