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.
This commit is contained in:
Michael Natterer 2014-03-15 17:50:35 +01:00
parent 4321cda30c
commit fea22c345c
3 changed files with 16 additions and 16 deletions

View file

@ -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",

View file

@ -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().
**/

View file

@ -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
);