mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-04 09:53:25 +00:00
Bug 596410 - gimp-image-get-filename returns NULL for imported files
Make gimp_image_get_uri() and gimp_image_get_filename() behave as in the GIMP 2.6 days. Add new functions gimp_image_get_xcf_uri(), gimp_image_get_exported_uri() and gimp_image_get_imported_uri().
This commit is contained in:
parent
0f58d779c1
commit
da37e9ff3e
11 changed files with 446 additions and 14 deletions
1
AUTHORS
1
AUTHORS
|
@ -91,6 +91,7 @@ The following people have contributed code to GIMP:
|
||||||
Saul Goode
|
Saul Goode
|
||||||
David Gowers
|
David Gowers
|
||||||
Cameron Gregory
|
Cameron Gregory
|
||||||
|
Eric Grivel
|
||||||
Stephen Griffiths
|
Stephen Griffiths
|
||||||
Pavel Grinfeld
|
Pavel Grinfeld
|
||||||
Dov Grobgeld
|
Dov Grobgeld
|
||||||
|
|
1
NEWS
1
NEWS
|
@ -71,6 +71,7 @@ Plug-ins:
|
||||||
- Update libpng code to not use deprecated API (file-mng and file-png)
|
- Update libpng code to not use deprecated API (file-mng and file-png)
|
||||||
- Add an Item class to pygimp
|
- Add an Item class to pygimp
|
||||||
- Correct/update some labels and defaults in the JPEG plug-in's save dialog UI
|
- Correct/update some labels and defaults in the JPEG plug-in's save dialog UI
|
||||||
|
- Fix "Bug 596410 - gimp-image-get-filename returns NULL for imported files"
|
||||||
|
|
||||||
|
|
||||||
Developer documentation:
|
Developer documentation:
|
||||||
|
|
|
@ -1623,6 +1623,34 @@ gimp_image_get_save_a_copy_uri (const GimpImage *image)
|
||||||
GIMP_FILE_SAVE_A_COPY_URI_KEY);
|
GIMP_FILE_SAVE_A_COPY_URI_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gimp_image_get_any_uri:
|
||||||
|
* @image: A #GimpImage.
|
||||||
|
*
|
||||||
|
* Returns: The XCF file URI, the imported file URI, or the exported
|
||||||
|
* file URI, in that order of precedence. Only to help implement
|
||||||
|
* backwards compatibility with GIMP 2.6 API.
|
||||||
|
**/
|
||||||
|
const gchar *
|
||||||
|
gimp_image_get_any_uri (const GimpImage *image)
|
||||||
|
{
|
||||||
|
const gchar *uri;
|
||||||
|
|
||||||
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
||||||
|
|
||||||
|
uri = gimp_image_get_uri (image);
|
||||||
|
if (! uri)
|
||||||
|
{
|
||||||
|
uri = gimp_image_get_imported_uri (image);
|
||||||
|
if (! uri)
|
||||||
|
{
|
||||||
|
uri = gimp_image_get_exported_uri (image);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gimp_image_set_imported_uri:
|
* gimp_image_set_imported_uri:
|
||||||
* @image: A #GimpImage.
|
* @image: A #GimpImage.
|
||||||
|
|
|
@ -175,6 +175,7 @@ const gchar * gimp_image_get_uri_or_untitled (const GimpImage *image);
|
||||||
const gchar * gimp_image_get_imported_uri (const GimpImage *image);
|
const gchar * gimp_image_get_imported_uri (const GimpImage *image);
|
||||||
const gchar * gimp_image_get_exported_uri (const GimpImage *image);
|
const gchar * gimp_image_get_exported_uri (const GimpImage *image);
|
||||||
const gchar * gimp_image_get_save_a_copy_uri (const GimpImage *image);
|
const gchar * gimp_image_get_save_a_copy_uri (const GimpImage *image);
|
||||||
|
const gchar * gimp_image_get_any_uri (const GimpImage *image);
|
||||||
|
|
||||||
void gimp_image_set_uri (GimpImage *image,
|
void gimp_image_set_uri (GimpImage *image,
|
||||||
const gchar *uri);
|
const gchar *uri);
|
||||||
|
|
|
@ -2102,7 +2102,7 @@ image_get_filename_invoker (GimpProcedure *procedure,
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
filename = gimp_image_get_filename (image);
|
filename = g_filename_from_uri (gimp_image_get_any_uri (image), NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_vals = gimp_procedure_get_return_values (procedure, success,
|
return_vals = gimp_procedure_get_return_values (procedure, success,
|
||||||
|
@ -2171,6 +2171,35 @@ image_get_uri_invoker (GimpProcedure *procedure,
|
||||||
|
|
||||||
image = gimp_value_get_image (&args->values[0], gimp);
|
image = gimp_value_get_image (&args->values[0], gimp);
|
||||||
|
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
uri = g_strdup (gimp_image_get_any_uri (image));
|
||||||
|
}
|
||||||
|
|
||||||
|
return_vals = gimp_procedure_get_return_values (procedure, success,
|
||||||
|
error ? *error : NULL);
|
||||||
|
|
||||||
|
if (success)
|
||||||
|
g_value_take_string (&return_vals->values[1], uri);
|
||||||
|
|
||||||
|
return return_vals;
|
||||||
|
}
|
||||||
|
|
||||||
|
static GValueArray *
|
||||||
|
image_get_xcf_uri_invoker (GimpProcedure *procedure,
|
||||||
|
Gimp *gimp,
|
||||||
|
GimpContext *context,
|
||||||
|
GimpProgress *progress,
|
||||||
|
const GValueArray *args,
|
||||||
|
GError **error)
|
||||||
|
{
|
||||||
|
gboolean success = TRUE;
|
||||||
|
GValueArray *return_vals;
|
||||||
|
GimpImage *image;
|
||||||
|
gchar *uri = NULL;
|
||||||
|
|
||||||
|
image = gimp_value_get_image (&args->values[0], gimp);
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
uri = g_strdup (gimp_image_get_uri (image));
|
uri = g_strdup (gimp_image_get_uri (image));
|
||||||
|
@ -2185,6 +2214,64 @@ image_get_uri_invoker (GimpProcedure *procedure,
|
||||||
return return_vals;
|
return return_vals;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GValueArray *
|
||||||
|
image_get_imported_uri_invoker (GimpProcedure *procedure,
|
||||||
|
Gimp *gimp,
|
||||||
|
GimpContext *context,
|
||||||
|
GimpProgress *progress,
|
||||||
|
const GValueArray *args,
|
||||||
|
GError **error)
|
||||||
|
{
|
||||||
|
gboolean success = TRUE;
|
||||||
|
GValueArray *return_vals;
|
||||||
|
GimpImage *image;
|
||||||
|
gchar *uri = NULL;
|
||||||
|
|
||||||
|
image = gimp_value_get_image (&args->values[0], gimp);
|
||||||
|
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
uri = g_strdup (gimp_image_get_imported_uri (image));
|
||||||
|
}
|
||||||
|
|
||||||
|
return_vals = gimp_procedure_get_return_values (procedure, success,
|
||||||
|
error ? *error : NULL);
|
||||||
|
|
||||||
|
if (success)
|
||||||
|
g_value_take_string (&return_vals->values[1], uri);
|
||||||
|
|
||||||
|
return return_vals;
|
||||||
|
}
|
||||||
|
|
||||||
|
static GValueArray *
|
||||||
|
image_get_exported_uri_invoker (GimpProcedure *procedure,
|
||||||
|
Gimp *gimp,
|
||||||
|
GimpContext *context,
|
||||||
|
GimpProgress *progress,
|
||||||
|
const GValueArray *args,
|
||||||
|
GError **error)
|
||||||
|
{
|
||||||
|
gboolean success = TRUE;
|
||||||
|
GValueArray *return_vals;
|
||||||
|
GimpImage *image;
|
||||||
|
gchar *uri = NULL;
|
||||||
|
|
||||||
|
image = gimp_value_get_image (&args->values[0], gimp);
|
||||||
|
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
uri = g_strdup (gimp_image_get_exported_uri (image));
|
||||||
|
}
|
||||||
|
|
||||||
|
return_vals = gimp_procedure_get_return_values (procedure, success,
|
||||||
|
error ? *error : NULL);
|
||||||
|
|
||||||
|
if (success)
|
||||||
|
g_value_take_string (&return_vals->values[1], uri);
|
||||||
|
|
||||||
|
return return_vals;
|
||||||
|
}
|
||||||
|
|
||||||
static GValueArray *
|
static GValueArray *
|
||||||
image_get_name_invoker (GimpProcedure *procedure,
|
image_get_name_invoker (GimpProcedure *procedure,
|
||||||
Gimp *gimp,
|
Gimp *gimp,
|
||||||
|
@ -4671,7 +4758,7 @@ register_image_procs (GimpPDB *pdb)
|
||||||
gimp_procedure_set_static_strings (procedure,
|
gimp_procedure_set_static_strings (procedure,
|
||||||
"gimp-image-get-filename",
|
"gimp-image-get-filename",
|
||||||
"Returns the specified image's filename.",
|
"Returns the specified image's filename.",
|
||||||
"This procedure returns the specified image's filename in the filesystem encoding. The image has a filename only if it was loaded from a local filesystem or has since been saved locally. Otherwise, this function returns %NULL. See also 'gimp-image-get-uri'.",
|
"This procedure returns the specified image's filename in the filesystem encoding. The image has a filename only if it was loaded or imported from a file or has since been saved or exported. Otherwise, this function returns %NULL. See also 'gimp-image-get-uri'.",
|
||||||
"Spencer Kimball & Peter Mattis",
|
"Spencer Kimball & Peter Mattis",
|
||||||
"Spencer Kimball & Peter Mattis",
|
"Spencer Kimball & Peter Mattis",
|
||||||
"1995-1996",
|
"1995-1996",
|
||||||
|
@ -4731,7 +4818,7 @@ register_image_procs (GimpPDB *pdb)
|
||||||
gimp_procedure_set_static_strings (procedure,
|
gimp_procedure_set_static_strings (procedure,
|
||||||
"gimp-image-get-uri",
|
"gimp-image-get-uri",
|
||||||
"Returns the URI for the specified image.",
|
"Returns the URI for the specified image.",
|
||||||
"This procedure returns the URI associated with the specified image. The image has an URI only if it was loaded from a file or has since been saved. Otherwise, this function returns %NULL.",
|
"This procedure returns the URI associated with the specified image. The image has an URI only if it was loaded or imported from a file or has since been saved or exported. Otherwise, this function returns %NULL. See also gimp-image-get-imported-uri to get the URI of the current file if it was imported from a non-GIMP file format and not yet saved, or gimp-image-get-exported-uri if the image has been exported to a non-GIMP file format.",
|
||||||
"Sven Neumann <sven@gimp.org>",
|
"Sven Neumann <sven@gimp.org>",
|
||||||
"Sven Neumann",
|
"Sven Neumann",
|
||||||
"2009",
|
"2009",
|
||||||
|
@ -4752,6 +4839,96 @@ register_image_procs (GimpPDB *pdb)
|
||||||
gimp_pdb_register_procedure (pdb, procedure);
|
gimp_pdb_register_procedure (pdb, procedure);
|
||||||
g_object_unref (procedure);
|
g_object_unref (procedure);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gimp-image-get-xcf-uri
|
||||||
|
*/
|
||||||
|
procedure = gimp_procedure_new (image_get_xcf_uri_invoker);
|
||||||
|
gimp_object_set_static_name (GIMP_OBJECT (procedure),
|
||||||
|
"gimp-image-get-xcf-uri");
|
||||||
|
gimp_procedure_set_static_strings (procedure,
|
||||||
|
"gimp-image-get-xcf-uri",
|
||||||
|
"Returns the XCF URI for the specified image.",
|
||||||
|
"This procedure returns the XCF URI associated with the image. If there is no such URI, this procedure returns %NULL.",
|
||||||
|
"Eric Grivel <gimp@lumenssolutions.com>",
|
||||||
|
"Eric Grivel",
|
||||||
|
"2011",
|
||||||
|
NULL);
|
||||||
|
gimp_procedure_add_argument (procedure,
|
||||||
|
gimp_param_spec_image_id ("image",
|
||||||
|
"image",
|
||||||
|
"The image",
|
||||||
|
pdb->gimp, FALSE,
|
||||||
|
GIMP_PARAM_READWRITE));
|
||||||
|
gimp_procedure_add_return_value (procedure,
|
||||||
|
gimp_param_spec_string ("uri",
|
||||||
|
"uri",
|
||||||
|
"The imported URI",
|
||||||
|
FALSE, FALSE, FALSE,
|
||||||
|
NULL,
|
||||||
|
GIMP_PARAM_READWRITE));
|
||||||
|
gimp_pdb_register_procedure (pdb, procedure);
|
||||||
|
g_object_unref (procedure);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gimp-image-get-imported-uri
|
||||||
|
*/
|
||||||
|
procedure = gimp_procedure_new (image_get_imported_uri_invoker);
|
||||||
|
gimp_object_set_static_name (GIMP_OBJECT (procedure),
|
||||||
|
"gimp-image-get-imported-uri");
|
||||||
|
gimp_procedure_set_static_strings (procedure,
|
||||||
|
"gimp-image-get-imported-uri",
|
||||||
|
"Returns the imported URI for the specified image.",
|
||||||
|
"This procedure returns the URI associated with the specified image if the image was imported from a non-native Gimp format. If the image was not imported, or has since been saved in the native Gimp format, this procedure returns %NULL.",
|
||||||
|
"Eric Grivel <gimp@lumenssolutions.com>",
|
||||||
|
"Eric Grivel",
|
||||||
|
"2011",
|
||||||
|
NULL);
|
||||||
|
gimp_procedure_add_argument (procedure,
|
||||||
|
gimp_param_spec_image_id ("image",
|
||||||
|
"image",
|
||||||
|
"The image",
|
||||||
|
pdb->gimp, FALSE,
|
||||||
|
GIMP_PARAM_READWRITE));
|
||||||
|
gimp_procedure_add_return_value (procedure,
|
||||||
|
gimp_param_spec_string ("uri",
|
||||||
|
"uri",
|
||||||
|
"The imported URI",
|
||||||
|
FALSE, FALSE, FALSE,
|
||||||
|
NULL,
|
||||||
|
GIMP_PARAM_READWRITE));
|
||||||
|
gimp_pdb_register_procedure (pdb, procedure);
|
||||||
|
g_object_unref (procedure);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gimp-image-get-exported-uri
|
||||||
|
*/
|
||||||
|
procedure = gimp_procedure_new (image_get_exported_uri_invoker);
|
||||||
|
gimp_object_set_static_name (GIMP_OBJECT (procedure),
|
||||||
|
"gimp-image-get-exported-uri");
|
||||||
|
gimp_procedure_set_static_strings (procedure,
|
||||||
|
"gimp-image-get-exported-uri",
|
||||||
|
"Returns the exported URI for the specified image.",
|
||||||
|
"This procedure returns the URI associated with the specified image if the image was exported a non-native GIMP format. If the image was not exported, this procedure returns %NULL.",
|
||||||
|
"Eric Grivel <gimp@lumenssolutions.com>",
|
||||||
|
"Eric Grivel",
|
||||||
|
"2011",
|
||||||
|
NULL);
|
||||||
|
gimp_procedure_add_argument (procedure,
|
||||||
|
gimp_param_spec_image_id ("image",
|
||||||
|
"image",
|
||||||
|
"The image",
|
||||||
|
pdb->gimp, FALSE,
|
||||||
|
GIMP_PARAM_READWRITE));
|
||||||
|
gimp_procedure_add_return_value (procedure,
|
||||||
|
gimp_param_spec_string ("uri",
|
||||||
|
"uri",
|
||||||
|
"The exported URI",
|
||||||
|
FALSE, FALSE, FALSE,
|
||||||
|
NULL,
|
||||||
|
GIMP_PARAM_READWRITE));
|
||||||
|
gimp_pdb_register_procedure (pdb, procedure);
|
||||||
|
g_object_unref (procedure);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* gimp-image-get-name
|
* gimp-image-get-name
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include "internal-procs.h"
|
#include "internal-procs.h"
|
||||||
|
|
||||||
|
|
||||||
/* 630 procedures registered total */
|
/* 633 procedures registered total */
|
||||||
|
|
||||||
void
|
void
|
||||||
internal_procs_init (GimpPDB *pdb)
|
internal_procs_init (GimpPDB *pdb)
|
||||||
|
|
|
@ -100,6 +100,7 @@
|
||||||
<contributor role="author" last-active="2.4">Saul Goode</contributor>
|
<contributor role="author" last-active="2.4">Saul Goode</contributor>
|
||||||
<contributor role="author" last-active="2.6">David Gowers</contributor>
|
<contributor role="author" last-active="2.6">David Gowers</contributor>
|
||||||
<contributor role="author" last-active="2.0">Cameron Gregory</contributor>
|
<contributor role="author" last-active="2.0">Cameron Gregory</contributor>
|
||||||
|
<contributor role="author" last-active="2.8">Eric Grivel</contributor>
|
||||||
<contributor role="author" last-active="2.8">Stephen Griffiths</contributor>
|
<contributor role="author" last-active="2.8">Stephen Griffiths</contributor>
|
||||||
<contributor role="author" last-active="1.2">Pavel Grinfeld</contributor>
|
<contributor role="author" last-active="1.2">Pavel Grinfeld</contributor>
|
||||||
<contributor role="author" last-active="2.4">Dov Grobgeld</contributor>
|
<contributor role="author" last-active="2.4">Dov Grobgeld</contributor>
|
||||||
|
|
|
@ -359,10 +359,12 @@ EXPORTS
|
||||||
gimp_image_get_colormap
|
gimp_image_get_colormap
|
||||||
gimp_image_get_component_active
|
gimp_image_get_component_active
|
||||||
gimp_image_get_component_visible
|
gimp_image_get_component_visible
|
||||||
|
gimp_image_get_exported_uri
|
||||||
gimp_image_get_filename
|
gimp_image_get_filename
|
||||||
gimp_image_get_floating_sel
|
gimp_image_get_floating_sel
|
||||||
gimp_image_get_guide_orientation
|
gimp_image_get_guide_orientation
|
||||||
gimp_image_get_guide_position
|
gimp_image_get_guide_position
|
||||||
|
gimp_image_get_imported_uri
|
||||||
gimp_image_get_item_position
|
gimp_image_get_item_position
|
||||||
gimp_image_get_layer_by_tattoo
|
gimp_image_get_layer_by_tattoo
|
||||||
gimp_image_get_layer_position
|
gimp_image_get_layer_position
|
||||||
|
@ -380,6 +382,7 @@ EXPORTS
|
||||||
gimp_image_get_vectors
|
gimp_image_get_vectors
|
||||||
gimp_image_get_vectors_by_tattoo
|
gimp_image_get_vectors_by_tattoo
|
||||||
gimp_image_get_vectors_position
|
gimp_image_get_vectors_position
|
||||||
|
gimp_image_get_xcf_uri
|
||||||
gimp_image_grid_get_background_color
|
gimp_image_grid_get_background_color
|
||||||
gimp_image_grid_get_foreground_color
|
gimp_image_grid_get_foreground_color
|
||||||
gimp_image_grid_get_offset
|
gimp_image_grid_get_offset
|
||||||
|
|
|
@ -2229,8 +2229,9 @@ gimp_image_set_component_visible (gint32 image_ID,
|
||||||
*
|
*
|
||||||
* This procedure returns the specified image's filename in the
|
* This procedure returns the specified image's filename in the
|
||||||
* filesystem encoding. The image has a filename only if it was loaded
|
* filesystem encoding. The image has a filename only if it was loaded
|
||||||
* from a local filesystem or has since been saved locally. Otherwise,
|
* or imported from a file or has since been saved or exported.
|
||||||
* this function returns %NULL. See also gimp_image_get_uri().
|
* Otherwise, this function returns %NULL. See also
|
||||||
|
* gimp_image_get_uri().
|
||||||
*
|
*
|
||||||
* Returns: The filename.
|
* Returns: The filename.
|
||||||
**/
|
**/
|
||||||
|
@ -2294,8 +2295,12 @@ gimp_image_set_filename (gint32 image_ID,
|
||||||
* Returns the URI for the specified image.
|
* Returns the URI for the specified image.
|
||||||
*
|
*
|
||||||
* This procedure returns the URI associated with the specified image.
|
* This procedure returns the URI associated with the specified image.
|
||||||
* The image has an URI only if it was loaded from a file or has since
|
* The image has an URI only if it was loaded or imported from a file
|
||||||
* been saved. Otherwise, this function returns %NULL.
|
* or has since been saved or exported. Otherwise, this function
|
||||||
|
* returns %NULL. See also gimp-image-get-imported-uri to get the URI
|
||||||
|
* of the current file if it was imported from a non-GIMP file format
|
||||||
|
* and not yet saved, or gimp-image-get-exported-uri if the image has
|
||||||
|
* been exported to a non-GIMP file format.
|
||||||
*
|
*
|
||||||
* Returns: The URI.
|
* Returns: The URI.
|
||||||
*
|
*
|
||||||
|
@ -2321,6 +2326,108 @@ gimp_image_get_uri (gint32 image_ID)
|
||||||
return uri;
|
return uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gimp_image_get_xcf_uri:
|
||||||
|
* @image_ID: The image.
|
||||||
|
*
|
||||||
|
* Returns the XCF URI for the specified image.
|
||||||
|
*
|
||||||
|
* This procedure returns the XCF URI associated with the image. If
|
||||||
|
* there is no such URI, this procedure returns %NULL.
|
||||||
|
*
|
||||||
|
* Returns: The imported URI.
|
||||||
|
*
|
||||||
|
* Since: GIMP 2.8
|
||||||
|
**/
|
||||||
|
gchar *
|
||||||
|
gimp_image_get_xcf_uri (gint32 image_ID)
|
||||||
|
{
|
||||||
|
GimpParam *return_vals;
|
||||||
|
gint nreturn_vals;
|
||||||
|
gchar *uri = NULL;
|
||||||
|
|
||||||
|
return_vals = gimp_run_procedure ("gimp-image-get-xcf-uri",
|
||||||
|
&nreturn_vals,
|
||||||
|
GIMP_PDB_IMAGE, image_ID,
|
||||||
|
GIMP_PDB_END);
|
||||||
|
|
||||||
|
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
||||||
|
uri = g_strdup (return_vals[1].data.d_string);
|
||||||
|
|
||||||
|
gimp_destroy_params (return_vals, nreturn_vals);
|
||||||
|
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gimp_image_get_imported_uri:
|
||||||
|
* @image_ID: The image.
|
||||||
|
*
|
||||||
|
* Returns the imported URI for the specified image.
|
||||||
|
*
|
||||||
|
* This procedure returns the URI associated with the specified image
|
||||||
|
* if the image was imported from a non-native Gimp format. If the
|
||||||
|
* image was not imported, or has since been saved in the native Gimp
|
||||||
|
* format, this procedure returns %NULL.
|
||||||
|
*
|
||||||
|
* Returns: The imported URI.
|
||||||
|
*
|
||||||
|
* Since: GIMP 2.8
|
||||||
|
**/
|
||||||
|
gchar *
|
||||||
|
gimp_image_get_imported_uri (gint32 image_ID)
|
||||||
|
{
|
||||||
|
GimpParam *return_vals;
|
||||||
|
gint nreturn_vals;
|
||||||
|
gchar *uri = NULL;
|
||||||
|
|
||||||
|
return_vals = gimp_run_procedure ("gimp-image-get-imported-uri",
|
||||||
|
&nreturn_vals,
|
||||||
|
GIMP_PDB_IMAGE, image_ID,
|
||||||
|
GIMP_PDB_END);
|
||||||
|
|
||||||
|
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
||||||
|
uri = g_strdup (return_vals[1].data.d_string);
|
||||||
|
|
||||||
|
gimp_destroy_params (return_vals, nreturn_vals);
|
||||||
|
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gimp_image_get_exported_uri:
|
||||||
|
* @image_ID: The image.
|
||||||
|
*
|
||||||
|
* Returns the exported URI for the specified image.
|
||||||
|
*
|
||||||
|
* This procedure returns the URI associated with the specified image
|
||||||
|
* if the image was exported a non-native GIMP format. If the image was
|
||||||
|
* not exported, this procedure returns %NULL.
|
||||||
|
*
|
||||||
|
* Returns: The exported URI.
|
||||||
|
*
|
||||||
|
* Since: GIMP 2.8
|
||||||
|
**/
|
||||||
|
gchar *
|
||||||
|
gimp_image_get_exported_uri (gint32 image_ID)
|
||||||
|
{
|
||||||
|
GimpParam *return_vals;
|
||||||
|
gint nreturn_vals;
|
||||||
|
gchar *uri = NULL;
|
||||||
|
|
||||||
|
return_vals = gimp_run_procedure ("gimp-image-get-exported-uri",
|
||||||
|
&nreturn_vals,
|
||||||
|
GIMP_PDB_IMAGE, image_ID,
|
||||||
|
GIMP_PDB_END);
|
||||||
|
|
||||||
|
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
||||||
|
uri = g_strdup (return_vals[1].data.d_string);
|
||||||
|
|
||||||
|
gimp_destroy_params (return_vals, nreturn_vals);
|
||||||
|
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gimp_image_get_name:
|
* gimp_image_get_name:
|
||||||
* @image_ID: The image.
|
* @image_ID: The image.
|
||||||
|
|
|
@ -182,6 +182,9 @@ gchar* gimp_image_get_filename (gint32
|
||||||
gboolean gimp_image_set_filename (gint32 image_ID,
|
gboolean gimp_image_set_filename (gint32 image_ID,
|
||||||
const gchar *filename);
|
const gchar *filename);
|
||||||
gchar* gimp_image_get_uri (gint32 image_ID);
|
gchar* gimp_image_get_uri (gint32 image_ID);
|
||||||
|
gchar* gimp_image_get_xcf_uri (gint32 image_ID);
|
||||||
|
gchar* gimp_image_get_imported_uri (gint32 image_ID);
|
||||||
|
gchar* gimp_image_get_exported_uri (gint32 image_ID);
|
||||||
gchar* gimp_image_get_name (gint32 image_ID);
|
gchar* gimp_image_get_name (gint32 image_ID);
|
||||||
gboolean gimp_image_get_resolution (gint32 image_ID,
|
gboolean gimp_image_get_resolution (gint32 image_ID,
|
||||||
gdouble *xresolution,
|
gdouble *xresolution,
|
||||||
|
|
|
@ -2079,8 +2079,8 @@ sub image_get_filename {
|
||||||
|
|
||||||
$help = <<'HELP';
|
$help = <<'HELP';
|
||||||
This procedure returns the specified image's filename in the
|
This procedure returns the specified image's filename in the
|
||||||
filesystem encoding. The image has a filename only if it was loaded
|
filesystem encoding. The image has a filename only if it was loaded or
|
||||||
from a local filesystem or has since been saved locally. Otherwise,
|
imported from a file or has since been saved or exported. Otherwise,
|
||||||
this function returns %NULL. See also gimp_image_get_uri().
|
this function returns %NULL. See also gimp_image_get_uri().
|
||||||
HELP
|
HELP
|
||||||
|
|
||||||
|
@ -2099,7 +2099,7 @@ HELP
|
||||||
%invoke = (
|
%invoke = (
|
||||||
code => <<'CODE'
|
code => <<'CODE'
|
||||||
{
|
{
|
||||||
filename = gimp_image_get_filename (image);
|
filename = g_filename_from_uri (gimp_image_get_any_uri (image), NULL, NULL);
|
||||||
}
|
}
|
||||||
CODE
|
CODE
|
||||||
);
|
);
|
||||||
|
@ -2154,8 +2154,12 @@ sub image_get_uri {
|
||||||
|
|
||||||
$help = <<'HELP';
|
$help = <<'HELP';
|
||||||
This procedure returns the URI associated with the specified image.
|
This procedure returns the URI associated with the specified image.
|
||||||
The image has an URI only if it was loaded from a file or has since
|
The image has an URI only if it was loaded or imported from a file or
|
||||||
been saved. Otherwise, this function returns %NULL.
|
has since been saved or exported. Otherwise, this function returns
|
||||||
|
%NULL. See also gimp-image-get-imported-uri to get the URI of the
|
||||||
|
current file if it was imported from a non-GIMP file format and not
|
||||||
|
yet saved, or gimp-image-get-exported-uri if the image has been
|
||||||
|
exported to a non-GIMP file format.
|
||||||
HELP
|
HELP
|
||||||
|
|
||||||
&neo_pdb_misc('2009', '2.8');
|
&neo_pdb_misc('2009', '2.8');
|
||||||
|
@ -2173,12 +2177,111 @@ HELP
|
||||||
%invoke = (
|
%invoke = (
|
||||||
code => <<'CODE'
|
code => <<'CODE'
|
||||||
{
|
{
|
||||||
|
uri = g_strdup (gimp_image_get_any_uri (image));
|
||||||
|
}
|
||||||
|
CODE
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub image_get_xcf_uri {
|
||||||
|
$blurb = "Returns the XCF URI for the specified image.";
|
||||||
|
|
||||||
|
$help = <<'HELP';
|
||||||
|
This procedure returns the XCF URI associated with the image. If
|
||||||
|
there is no such URI, this procedure returns %NULL.
|
||||||
|
HELP
|
||||||
|
|
||||||
|
$author = 'Eric Grivel <gimp@lumenssolutions.com>';
|
||||||
|
$copyright = 'Eric Grivel';
|
||||||
|
$date = '2011';
|
||||||
|
$since = '2.8';
|
||||||
|
|
||||||
|
@inargs = (
|
||||||
|
{ name => 'image', type => 'image',
|
||||||
|
desc => 'The image' }
|
||||||
|
);
|
||||||
|
|
||||||
|
@outargs = (
|
||||||
|
{ name => 'uri', type => 'string',
|
||||||
|
desc => 'The imported URI' }
|
||||||
|
);
|
||||||
|
|
||||||
|
%invoke = (
|
||||||
|
code => <<'CODE'
|
||||||
|
{
|
||||||
uri = g_strdup (gimp_image_get_uri (image));
|
uri = g_strdup (gimp_image_get_uri (image));
|
||||||
}
|
}
|
||||||
CODE
|
CODE
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub image_get_imported_uri {
|
||||||
|
$blurb = "Returns the imported URI for the specified image.";
|
||||||
|
|
||||||
|
$help = <<'HELP';
|
||||||
|
This procedure returns the URI associated with the specified image
|
||||||
|
if the image was imported from a non-native Gimp format. If the
|
||||||
|
image was not imported, or has since been saved in the native Gimp
|
||||||
|
format, this procedure returns %NULL.
|
||||||
|
HELP
|
||||||
|
|
||||||
|
$author = 'Eric Grivel <gimp@lumenssolutions.com>';
|
||||||
|
$copyright = 'Eric Grivel';
|
||||||
|
$date = '2011';
|
||||||
|
$since = '2.8';
|
||||||
|
|
||||||
|
@inargs = (
|
||||||
|
{ name => 'image', type => 'image',
|
||||||
|
desc => 'The image' }
|
||||||
|
);
|
||||||
|
|
||||||
|
@outargs = (
|
||||||
|
{ name => 'uri', type => 'string',
|
||||||
|
desc => 'The imported URI' }
|
||||||
|
);
|
||||||
|
|
||||||
|
%invoke = (
|
||||||
|
code => <<'CODE'
|
||||||
|
{
|
||||||
|
uri = g_strdup (gimp_image_get_imported_uri (image));
|
||||||
|
}
|
||||||
|
CODE
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub image_get_exported_uri {
|
||||||
|
$blurb = "Returns the exported URI for the specified image.";
|
||||||
|
|
||||||
|
$help = <<'HELP';
|
||||||
|
This procedure returns the URI associated with the specified image
|
||||||
|
if the image was exported a non-native GIMP format. If the
|
||||||
|
image was not exported, this procedure returns %NULL.
|
||||||
|
HELP
|
||||||
|
|
||||||
|
$author = 'Eric Grivel <gimp@lumenssolutions.com>';
|
||||||
|
$copyright = 'Eric Grivel';
|
||||||
|
$date = '2011';
|
||||||
|
$since = '2.8';
|
||||||
|
|
||||||
|
@inargs = (
|
||||||
|
{ name => 'image', type => 'image',
|
||||||
|
desc => 'The image' }
|
||||||
|
);
|
||||||
|
|
||||||
|
@outargs = (
|
||||||
|
{ name => 'uri', type => 'string',
|
||||||
|
desc => 'The exported URI' }
|
||||||
|
);
|
||||||
|
|
||||||
|
%invoke = (
|
||||||
|
code => <<'CODE'
|
||||||
|
{
|
||||||
|
uri = g_strdup (gimp_image_get_exported_uri (image));
|
||||||
|
}
|
||||||
|
CODE
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
sub image_get_name {
|
sub image_get_name {
|
||||||
$blurb = "Returns the specified image's name.";
|
$blurb = "Returns the specified image's name.";
|
||||||
$help = <<'HELP';
|
$help = <<'HELP';
|
||||||
|
@ -2742,6 +2845,9 @@ CODE
|
||||||
image_get_component_visible image_set_component_visible
|
image_get_component_visible image_set_component_visible
|
||||||
image_get_filename image_set_filename
|
image_get_filename image_set_filename
|
||||||
image_get_uri
|
image_get_uri
|
||||||
|
image_get_xcf_uri
|
||||||
|
image_get_imported_uri
|
||||||
|
image_get_exported_uri
|
||||||
image_get_name
|
image_get_name
|
||||||
image_get_resolution image_set_resolution
|
image_get_resolution image_set_resolution
|
||||||
image_get_unit image_set_unit
|
image_get_unit image_set_unit
|
||||||
|
@ -2753,7 +2859,11 @@ CODE
|
||||||
image_get_parasite
|
image_get_parasite
|
||||||
image_get_parasite_list);
|
image_get_parasite_list);
|
||||||
|
|
||||||
%exports = (app => [@procs], lib => [@procs[0..42,45..77]]);
|
# For the lib parameter EXCLUDE functions #43 and #44, which are
|
||||||
|
# image_add_layer_mask and image_remove_layer_mask.
|
||||||
|
# If adding or removing functions, make sure the range below is
|
||||||
|
# updated correctly!
|
||||||
|
%exports = (app => [@procs], lib => [@procs[0..42,45..80]]);
|
||||||
|
|
||||||
$desc = 'Image';
|
$desc = 'Image';
|
||||||
$doc_title = 'gimpimage';
|
$doc_title = 'gimpimage';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue