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



commit 86385cfa282ee0c9fa137f94a68ec5f6bc613c71
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.
    
    (cherry picked from commit fea22c345ce0a1b13be3eeb48a9f232f3dee6a43)

 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 5c194a3..e65a333 100644
--- a/app/pdb/image-cmds.c
+++ b/app/pdb/image-cmds.c
@@ -2287,11 +2287,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,
@@ -5034,7 +5030,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 f54d24f..5cce425 100644
--- a/libgimp/gimpimage_pdb.c
+++ b/libgimp/gimpimage_pdb.c
@@ -2436,8 +2436,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.
  **/
diff --git a/tools/pdbgen/pdb/image.pdb b/tools/pdbgen/pdb/image.pdb
index aca9e67..f856a57 100644
--- a/tools/pdbgen/pdb/image.pdb
+++ b/tools/pdbgen/pdb/image.pdb
@@ -2288,9 +2288,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;
@@ -2308,11 +2312,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]