From 9a9a3ba3de81adf121e39b419ee10e05803358b6 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Sat, 13 Nov 2004 20:34:43 +0000 Subject: [PATCH] document the fact that gimp_image_get_filename() returns the filename in 2004-11-13 Sven Neumann * tools/pdbgen/pdb/image.pdb: document the fact that gimp_image_get_filename() returns the filename in the filesystem encoding. Fixed gimp_image_get_name() to actually return the name in UTF-8 encoding. * app/pdb/image_cmds.c * libgimp/gimpimage_pdb.c * app/vectors/gimpbezierstroke.h: formatting. --- ChangeLog | 12 ++++++++++++ app/pdb/image_cmds.c | 10 +++++++--- app/vectors/gimpbezierstroke.h | 8 ++++---- libgimp/gimpimage_pdb.c | 5 +++-- tools/pdbgen/pdb/image.pdb | 11 ++++++++--- 5 files changed, 34 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 96b3542841..dfcf70c12f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2004-11-13 Sven Neumann + + * tools/pdbgen/pdb/image.pdb: document the fact that + gimp_image_get_filename() returns the filename in the filesystem + encoding. Fixed gimp_image_get_name() to actually return the name + in UTF-8 encoding. + + * app/pdb/image_cmds.c + * libgimp/gimpimage_pdb.c + + * app/vectors/gimpbezierstroke.h: formatting. + 2004-11-13 Sven Neumann * app/core/gimpimagefile.[ch] diff --git a/app/pdb/image_cmds.c b/app/pdb/image_cmds.c index a3af7937e7..5f1b35f39e 100644 --- a/app/pdb/image_cmds.c +++ b/app/pdb/image_cmds.c @@ -3774,7 +3774,7 @@ static ProcRecord image_get_filename_proc = { "gimp_image_get_filename", "Returns the specified image's filename.", - "This procedure returns the specified image's filename -- if it was loaded or has since been saved. Otherwise, returns NULL.", + "This procedure returns the specified image's filename in the filesystem encoding. The image has a filename only if it was loaded or has since been saved. Otherwise, this function returns %NULL.", "Spencer Kimball & Peter Mattis", "Spencer Kimball & Peter Mattis", "1995-1996", @@ -3864,8 +3864,12 @@ image_get_name_invoker (Gimp *gimp, if (filename) { - name = g_path_get_basename (filename); - g_free (filename); + gchar *basename = g_path_get_basename (filename); + name = g_filename_to_utf8 (basename, -1, NULL, NULL, NULL); + g_free (basename); + + if (! name) + name = g_strdup (_("(invalid UTF-8 string)")); } else { diff --git a/app/vectors/gimpbezierstroke.h b/app/vectors/gimpbezierstroke.h index 22de7205e2..8f7e24e3f9 100644 --- a/app/vectors/gimpbezierstroke.h +++ b/app/vectors/gimpbezierstroke.h @@ -77,10 +77,10 @@ GimpStroke * gimp_bezier_stroke_new_ellipse (const GimpCoords *center, gdouble radius_y); -GimpAnchor * gimp_bezier_stroke_extend (GimpStroke *stroke, - const GimpCoords *coords, - GimpAnchor *neighbor, - GimpVectorExtendMode extend_mode); +GimpAnchor * gimp_bezier_stroke_extend (GimpStroke *stroke, + const GimpCoords *coords, + GimpAnchor *neighbor, + GimpVectorExtendMode extend_mode); #endif /* __GIMP_BEZIER_STROKE_H__ */ diff --git a/libgimp/gimpimage_pdb.c b/libgimp/gimpimage_pdb.c index 494f4af418..f8aba5a14f 100644 --- a/libgimp/gimpimage_pdb.c +++ b/libgimp/gimpimage_pdb.c @@ -1835,8 +1835,9 @@ gimp_image_set_component_visible (gint32 image_ID, * * Returns the specified image's filename. * - * This procedure returns the specified image's filename -- if it was - * loaded or has since been saved. Otherwise, returns NULL. + * This procedure returns the specified image's filename in the + * filesystem encoding. The image has a filename only if it was loaded + * or has since been saved. Otherwise, this function returns %NULL. * * Returns: The filename. */ diff --git a/tools/pdbgen/pdb/image.pdb b/tools/pdbgen/pdb/image.pdb index cac10f3a67..c3360e24d9 100644 --- a/tools/pdbgen/pdb/image.pdb +++ b/tools/pdbgen/pdb/image.pdb @@ -1283,7 +1283,8 @@ CODE2 [ <<'CODE1', <<'CODE2' ]); $help =~ s/\. $//; $help .= <<'HELP'; - -- if it was loaded or has since been saved. Otherwise, returns NULL. + in the filesystem encoding. The image has a filename only if it was loaded +or has since been saved. Otherwise, this function returns %NULL. HELP $outargs[0]->{alias} =~ s/g_strdup \((.*)\)/$1/; @@ -1305,8 +1306,12 @@ CODE2 if (filename) { - name = g_path_get_basename (filename); - g_free (filename); + gchar *basename = g_path_get_basename (filename); + name = g_filename_to_utf8 (basename, -1, NULL, NULL, NULL); + g_free (basename); + + if (! name) + name = g_strdup (_("(invalid UTF-8 string)")); } else {