[gimp] Bug 706361 - Printer queue dosn't show the filename of the printing image



commit fea22c345ce0a1b13be3eeb48a9f232f3dee6a43
Author: Michael Natterer <mitch gimp org>
Date:   Sat Mar 15 17:50:35 2014 +0100

    Bug 706361 - Printer queue dosn't show the filename of the printing image
    
    Change the gimp-image-get-name procedure to return the same string
    as shown in the image title, and mention in its API docs that this
    string is meant for annotating UI elements only.

 app/pdb/image-cmds.c       |    8 ++------
 libgimp/gimpimage_pdb.c    |    8 ++++++--
 tools/pdbgen/pdb/image.pdb |   16 ++++++++--------
 3 files changed, 16 insertions(+), 16 deletions(-)
---
diff --git a/app/pdb/image-cmds.c b/app/pdb/image-cmds.c
index f171fce..7a74054 100644
--- a/app/pdb/image-cmds.c
+++ b/app/pdb/image-cmds.c
@@ -2439,11 +2439,7 @@ image_get_name_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      /* XXX do we really want to return this, or the name as in the title? */
-
-      const gchar *uri = gimp_image_get_uri_or_untitled (image);
-
-      name = file_utils_uri_display_basename (uri);
+      name = g_strdup (gimp_image_get_display_name (image));
     }
 
   return_vals = gimp_procedure_get_return_values (procedure, success,
@@ -5327,7 +5323,7 @@ register_image_procs (GimpPDB *pdb)
   gimp_procedure_set_static_strings (procedure,
                                      "gimp-image-get-name",
                                      "Returns the specified image's name.",
-                                     "This procedure returns the image's name. If the image has a filename 
or an URI, then this is the base name (the last component of the path). Otherwise it is the translated string 
\"Untitled\".",
+                                     "This procedure returns the image's name. If the image has a filename 
or an URI, then the returned name contains the filename's or URI's base name (the last component of the 
path). Otherwise it is the translated string \"Untitled\". The returned name is formatted like the image name 
in the image window title, it may contain '[]', '(imported)' etc. and should only be used to label user 
interface elements. Never use it to construct filenames.",
                                      "Spencer Kimball & Peter Mattis",
                                      "Spencer Kimball & Peter Mattis",
                                      "1995-1996",
diff --git a/libgimp/gimpimage_pdb.c b/libgimp/gimpimage_pdb.c
index 76d9c15..638f65a 100644
--- a/libgimp/gimpimage_pdb.c
+++ b/libgimp/gimpimage_pdb.c
@@ -2587,8 +2587,12 @@ gimp_image_get_exported_uri (gint32 image_ID)
  * Returns the specified image's name.
  *
  * This procedure returns the image's name. If the image has a filename
- * or an URI, then this is the base name (the last component of the
- * path). Otherwise it is the translated string \"Untitled\".
+ * or an URI, then the returned name contains the filename's or URI's
+ * base name (the last component of the path). Otherwise it is the
+ * translated string \"Untitled\". The returned name is formatted like
+ * the image name in the image window title, it may contain '[]',
+ * '(imported)' etc. and should only be used to label user interface
+ * elements. Never use it to construct filenames.
  *
  * Returns: The name. The returned value must be freed with g_free().
  **/
diff --git a/tools/pdbgen/pdb/image.pdb b/tools/pdbgen/pdb/image.pdb
index a34b484..b6b8eaf 100644
--- a/tools/pdbgen/pdb/image.pdb
+++ b/tools/pdbgen/pdb/image.pdb
@@ -2433,9 +2433,13 @@ CODE
 sub image_get_name {
     $blurb = "Returns the specified image's name.";
     $help  =  <<'HELP';
-This procedure returns the image's name. If the image has a filename or
-an URI, then this is the base name (the last component of the path).
-Otherwise it is the translated string "Untitled".
+This procedure returns the image's name. If the image has a filename
+or an URI, then the returned name contains the filename's or URI's
+base name (the last component of the path). Otherwise it is the
+translated string "Untitled". The returned name is formatted like the
+image name in the image window title, it may contain '[]',
+'(imported)' etc. and should only be used to label user interface
+elements. Never use it to construct filenames.
 HELP
 
     &std_pdb_misc;
@@ -2453,11 +2457,7 @@ HELP
     %invoke = (
         code => <<'CODE'
 {
-  /* XXX do we really want to return this, or the name as in the title? */
-
-  const gchar *uri = gimp_image_get_uri_or_untitled (image);
-
-  name = file_utils_uri_display_basename (uri);
+  name = g_strdup (gimp_image_get_display_name (image));
 }
 CODE
     );


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