[gimp] Bug 596410 - gimp-image-get-filename returns NULL for imported files



commit da37e9ff3ea0599bd615e55e8a6fd6b75b409be1
Author: Eric Grivel <gimp lumenssolutions com>
Date:   Fri Aug 12 21:15:16 2011 +0200

    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().

 AUTHORS                    |    1 +
 NEWS                       |    1 +
 app/core/gimpimage.c       |   28 +++++++
 app/core/gimpimage.h       |    1 +
 app/pdb/image-cmds.c       |  183 +++++++++++++++++++++++++++++++++++++++++++-
 app/pdb/internal-procs.c   |    2 +-
 authors.xml                |    1 +
 libgimp/gimp.def           |    3 +
 libgimp/gimpimage_pdb.c    |  115 ++++++++++++++++++++++++++-
 libgimp/gimpimage_pdb.h    |    3 +
 tools/pdbgen/pdb/image.pdb |  122 ++++++++++++++++++++++++++++--
 11 files changed, 446 insertions(+), 14 deletions(-)
---
diff --git a/AUTHORS b/AUTHORS
index 7125cca..9731b94 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -91,6 +91,7 @@ The following people have contributed code to GIMP:
  Saul Goode
  David Gowers
  Cameron Gregory
+ Eric Grivel
  Stephen Griffiths
  Pavel Grinfeld
  Dov Grobgeld
diff --git a/NEWS b/NEWS
index c361d72..940b22d 100644
--- a/NEWS
+++ b/NEWS
@@ -71,6 +71,7 @@ Plug-ins:
  - Update libpng code to not use deprecated API (file-mng and file-png)
  - Add an Item class to pygimp
  - 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:
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index 8661e8c..9a4aac2 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -1624,6 +1624,34 @@ gimp_image_get_save_a_copy_uri (const GimpImage *image)
 }
 
 /**
+ * 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:
  * @image: A #GimpImage.
  * @uri:
diff --git a/app/core/gimpimage.h b/app/core/gimpimage.h
index d28bdb4..d64c8a7 100644
--- a/app/core/gimpimage.h
+++ b/app/core/gimpimage.h
@@ -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_exported_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,
                                                   const gchar        *uri);
diff --git a/app/pdb/image-cmds.c b/app/pdb/image-cmds.c
index 96cfd0a..231ad3f 100644
--- a/app/pdb/image-cmds.c
+++ b/app/pdb/image-cmds.c
@@ -2102,7 +2102,7 @@ image_get_filename_invoker (GimpProcedure      *procedure,
 
   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,
@@ -2173,6 +2173,35 @@ image_get_uri_invoker (GimpProcedure      *procedure,
 
   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)
+    {
       uri = g_strdup (gimp_image_get_uri (image));
     }
 
@@ -2186,6 +2215,64 @@ image_get_uri_invoker (GimpProcedure      *procedure,
 }
 
 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 *
 image_get_name_invoker (GimpProcedure      *procedure,
                         Gimp               *gimp,
                         GimpContext        *context,
@@ -4671,7 +4758,7 @@ register_image_procs (GimpPDB *pdb)
   gimp_procedure_set_static_strings (procedure,
                                      "gimp-image-get-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",
                                      "1995-1996",
@@ -4731,7 +4818,7 @@ register_image_procs (GimpPDB *pdb)
   gimp_procedure_set_static_strings (procedure,
                                      "gimp-image-get-uri",
                                      "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",
                                      "2009",
@@ -4753,6 +4840,96 @@ register_image_procs (GimpPDB *pdb)
   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
    */
   procedure = gimp_procedure_new (image_get_name_invoker);
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index 85277f1..269f64b 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
 #include "internal-procs.h"
 
 
-/* 630 procedures registered total */
+/* 633 procedures registered total */
 
 void
 internal_procs_init (GimpPDB *pdb)
diff --git a/authors.xml b/authors.xml
index b2fb75f..35f0186 100644
--- a/authors.xml
+++ b/authors.xml
@@ -100,6 +100,7 @@
   <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.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="1.2">Pavel Grinfeld</contributor>
   <contributor role="author" last-active="2.4">Dov Grobgeld</contributor>
diff --git a/libgimp/gimp.def b/libgimp/gimp.def
index 8894eb5..347f606 100644
--- a/libgimp/gimp.def
+++ b/libgimp/gimp.def
@@ -359,10 +359,12 @@ EXPORTS
 	gimp_image_get_colormap
 	gimp_image_get_component_active
 	gimp_image_get_component_visible
+	gimp_image_get_exported_uri
 	gimp_image_get_filename
 	gimp_image_get_floating_sel
 	gimp_image_get_guide_orientation
 	gimp_image_get_guide_position
+	gimp_image_get_imported_uri
 	gimp_image_get_item_position
 	gimp_image_get_layer_by_tattoo
 	gimp_image_get_layer_position
@@ -380,6 +382,7 @@ EXPORTS
 	gimp_image_get_vectors
 	gimp_image_get_vectors_by_tattoo
 	gimp_image_get_vectors_position
+	gimp_image_get_xcf_uri
 	gimp_image_grid_get_background_color
 	gimp_image_grid_get_foreground_color
 	gimp_image_grid_get_offset
diff --git a/libgimp/gimpimage_pdb.c b/libgimp/gimpimage_pdb.c
index 145627e..ce7b82d 100644
--- a/libgimp/gimpimage_pdb.c
+++ b/libgimp/gimpimage_pdb.c
@@ -2229,8 +2229,9 @@ gimp_image_set_component_visible (gint32          image_ID,
  *
  * 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().
+ * or imported from a file or has since been saved or exported.
+ * Otherwise, this function returns %NULL. See also
+ * gimp_image_get_uri().
  *
  * Returns: The filename.
  **/
@@ -2294,8 +2295,12 @@ gimp_image_set_filename (gint32       image_ID,
  * 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.
+ * 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.
  *
  * Returns: The URI.
  *
@@ -2322,6 +2327,108 @@ gimp_image_get_uri (gint32 image_ID)
 }
 
 /**
+ * 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:
  * @image_ID: The image.
  *
diff --git a/libgimp/gimpimage_pdb.h b/libgimp/gimpimage_pdb.h
index 0d2fa24..28003a6 100644
--- a/libgimp/gimpimage_pdb.h
+++ b/libgimp/gimpimage_pdb.h
@@ -182,6 +182,9 @@ gchar*                   gimp_image_get_filename             (gint32
 gboolean                 gimp_image_set_filename             (gint32                  image_ID,
                                                               const gchar            *filename);
 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);
 gboolean                 gimp_image_get_resolution           (gint32                  image_ID,
                                                               gdouble                *xresolution,
diff --git a/tools/pdbgen/pdb/image.pdb b/tools/pdbgen/pdb/image.pdb
index 3f1d248..4edcdb1 100644
--- a/tools/pdbgen/pdb/image.pdb
+++ b/tools/pdbgen/pdb/image.pdb
@@ -2079,8 +2079,8 @@ sub image_get_filename {
 
     $help = <<'HELP';
 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,
+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().
 HELP
 
@@ -2099,7 +2099,7 @@ HELP
     %invoke = (
         code => <<'CODE'
 {
-  filename = gimp_image_get_filename (image);
+  filename = g_filename_from_uri (gimp_image_get_any_uri (image), NULL, NULL);
 }
 CODE
     );
@@ -2154,8 +2154,12 @@ sub image_get_uri {
 
     $help = <<'HELP';
 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.
+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.
 HELP
 
     &neo_pdb_misc('2009', '2.8');
@@ -2173,12 +2177,111 @@ HELP
     %invoke = (
         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));
 }
 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 {
     $blurb = "Returns the specified image's name.";
     $help  =  <<'HELP';
@@ -2742,6 +2845,9 @@ CODE
             image_get_component_visible image_set_component_visible
             image_get_filename image_set_filename
             image_get_uri
+            image_get_xcf_uri
+            image_get_imported_uri
+            image_get_exported_uri
             image_get_name
             image_get_resolution image_set_resolution
             image_get_unit image_set_unit
@@ -2753,7 +2859,11 @@ CODE
             image_get_parasite
             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';
 $doc_title = 'gimpimage';



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