Add new function file_utils_filename_to_utf8(), which is to be used when

2004-01-14  Tor Lillqvist  <tml@iki.fi>

	* app/file/file-utils.[ch]: Add new function
	file_utils_filename_to_utf8(), which is to be used when converting
	file names (which are kept in the on-disk encoding) to UTF-8 for
	passing to GTK, or to g_print() etc.

	* app/*/*.c: Call file_utils_filename_to_utf8(). Should fix most
	of the warnings generated by non-UTF8 pathnames. See #130118.

	* libgimpbase/gimpenv.b: Document that gimp_directory() etc return
	strings in the on-disk encoding.

	* libgimpmodule/gimpmodule.c: Convert filenames to UTF-8 (using
	g_filename_to_utf8()) before passing to g_print().
This commit is contained in:
Tor Lillqvist 2004-01-14 02:03:37 +00:00 committed by Tor Lillqvist
parent 6c4deef6b0
commit 18485018b3
45 changed files with 534 additions and 274 deletions

View File

@ -1,3 +1,19 @@
2004-01-14 Tor Lillqvist <tml@iki.fi>
* app/file/file-utils.[ch]: Add new function
file_utils_filename_to_utf8(), which is to be used when converting
file names (which are kept in the on-disk encoding) to UTF-8 for
passing to GTK, or to g_print() etc.
* app/*/*.c: Call file_utils_filename_to_utf8(). Should fix most
of the warnings generated by non-UTF8 pathnames. See #130118.
* libgimpbase/gimpenv.b: Document that gimp_directory() etc return
strings in the on-disk encoding.
* libgimpmodule/gimpmodule.c: Convert filenames to UTF-8 (using
g_filename_to_utf8()) before passing to g_print().
2004-01-14 Simon Budig <simon@gimp.org> 2004-01-14 Simon Budig <simon@gimp.org>
* app/gui/about-dialog.c: Fixed small refresh issue. * app/gui/about-dialog.c: Fixed small refresh issue.

View File

@ -40,6 +40,8 @@
#include "config/gimpbaseconfig.h" #include "config/gimpbaseconfig.h"
#include "config/gimpconfig-path.h" #include "config/gimpconfig-path.h"
#include "file/file-utils.h"
#include "pixel-region.h" #include "pixel-region.h"
#include "temp-buf.h" #include "temp-buf.h"
@ -714,7 +716,8 @@ temp_buf_swap (TempBuf *buf)
/* Check if generated filename is valid */ /* Check if generated filename is valid */
if (g_file_test (filename, G_FILE_TEST_IS_DIR)) if (g_file_test (filename, G_FILE_TEST_IS_DIR))
{ {
g_message ("Error in temp buf caching: \"%s\" is a directory (cannot overwrite)", filename); g_message ("Error in temp buf caching: \"%s\" is a directory (cannot overwrite)",
file_utils_filename_to_utf8 (filename));
g_free (filename); g_free (filename);
return; return;
} }
@ -734,7 +737,8 @@ temp_buf_swap (TempBuf *buf)
{ {
unlink (filename); unlink (filename);
perror ("Write error on temp buf"); perror ("Write error on temp buf");
g_message ("Cannot write \"%s\"", filename); g_message ("Cannot write \"%s\"",
file_utils_filename_to_utf8 (filename));
g_free (filename); g_free (filename);
return; return;
} }
@ -743,7 +747,8 @@ temp_buf_swap (TempBuf *buf)
{ {
unlink (filename); unlink (filename);
perror ("Error in temp buf caching"); perror ("Error in temp buf caching");
g_message ("Cannot write \"%s\"", filename); g_message ("Cannot write \"%s\"",
file_utils_filename_to_utf8 (filename));
g_free (filename); g_free (filename);
return; return;
} }

View File

@ -45,6 +45,8 @@
#define _O_TEMPORARY 0 #define _O_TEMPORARY 0
#endif #endif
#include "file/file-utils.h"
#include "tile.h" #include "tile.h"
#include "tile-private.h" #include "tile-private.h"
#include "tile-swap.h" #include "tile-swap.h"
@ -182,7 +184,8 @@ tile_swap_exit1 (gpointer key,
def_swap_file = swap_file->user_data; def_swap_file = swap_file->user_data;
if (def_swap_file->swap_file_end != 0) if (def_swap_file->swap_file_end != 0)
{ {
g_warning ("swap file not empty: \"%s\"\n", swap_file->filename); g_warning ("swap file not empty: \"%s\"\n",
file_utils_filename_to_utf8 (swap_file->filename));
tile_swap_print_gaps (def_swap_file); tile_swap_print_gaps (def_swap_file);
} }

View File

@ -28,6 +28,8 @@
#include "libgimpbase/gimpenv.h" #include "libgimpbase/gimpenv.h"
#include "file/file-utils.h"
#include "gimpconfig-path.h" #include "gimpconfig-path.h"
#include "gimp-intl.h" #include "gimp-intl.h"
@ -104,7 +106,7 @@ gimp_config_path_expand_only (const gchar *path,
#ifndef G_OS_WIN32 #ifndef G_OS_WIN32
if (*p == '~') if (*p == '~')
{ {
length += strlen (g_get_home_dir ()); length += strlen (file_utils_filename_to_utf8 (g_get_home_dir ()));
p += 1; p += 1;
} }
else else
@ -124,18 +126,14 @@ gimp_config_path_expand_only (const gchar *path,
{ {
s = NULL; s = NULL;
if (!s && strcmp (token, "gimp_dir") == 0) if (strcmp (token, "gimp_dir") == 0)
s = gimp_directory (); s = gimp_directory ();
else if (strcmp (token, "gimp_data_dir") == 0)
if (!s && strcmp (token, "gimp_data_dir") == 0)
s = gimp_data_directory (); s = gimp_data_directory ();
else if (strcmp (token, "gimp_plug_in_dir") == 0 ||
if (!s && strcmp (token, "gimp_plugin_dir") == 0)
((strcmp (token, "gimp_plug_in_dir")) == 0 ||
(strcmp (token, "gimp_plugin_dir")) == 0))
s = gimp_plug_in_directory (); s = gimp_plug_in_directory ();
else if (strcmp (token, "gimp_sysconf_dir") == 0)
if (!s && strcmp (token, "gimp_sysconf_dir") == 0)
s = gimp_sysconf_directory (); s = gimp_sysconf_directory ();
if (!s) if (!s)
@ -163,7 +161,7 @@ gimp_config_path_expand_only (const gchar *path,
substs = g_renew (gchar *, substs, 2 * (n_substs + SUBSTS_ALLOC)); substs = g_renew (gchar *, substs, 2 * (n_substs + SUBSTS_ALLOC));
substs[2*n_substs] = token; substs[2*n_substs] = token;
substs[2*n_substs + 1] = (gchar *) s; substs[2*n_substs + 1] = file_utils_filename_to_utf8 (s);
n_substs++; n_substs++;
length += strlen (s); length += strlen (s);
@ -190,8 +188,8 @@ gimp_config_path_expand_only (const gchar *path,
if (*p == '~') if (*p == '~')
{ {
*n = '\0'; *n = '\0';
strcat (n, g_get_home_dir ()); strcat (n, file_utils_filename_to_utf8 (g_get_home_dir ()));
n += strlen (g_get_home_dir ()); n += strlen (file_utils_filename_to_utf8 (g_get_home_dir ()));
p += 1; p += 1;
} }
else else

View File

@ -470,7 +470,7 @@ gimp_config_file_copy (const gchar *source,
{ {
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno), g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
_("Could not open '%s' for reading: %s"), _("Could not open '%s' for reading: %s"),
source, g_strerror (errno)); file_utils_filename_to_utf8 (source), g_strerror (errno));
return FALSE; return FALSE;
} }
@ -479,7 +479,7 @@ gimp_config_file_copy (const gchar *source,
{ {
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno), g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
_("Could not open '%s' for writing: %s"), _("Could not open '%s' for writing: %s"),
dest, g_strerror (errno)); file_utils_filename_to_utf8 (dest), g_strerror (errno));
fclose (sfile); fclose (sfile);
return FALSE; return FALSE;
} }
@ -490,7 +490,7 @@ gimp_config_file_copy (const gchar *source,
{ {
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno), g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
_("Error while writing '%s': %s"), _("Error while writing '%s': %s"),
dest, g_strerror (errno)); file_utils_filename_to_utf8 (dest), g_strerror (errno));
fclose (sfile); fclose (sfile);
fclose (dfile); fclose (dfile);
return FALSE; return FALSE;
@ -501,7 +501,7 @@ gimp_config_file_copy (const gchar *source,
{ {
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno), g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
_("Error while reading '%s': %s"), _("Error while reading '%s': %s"),
source, g_strerror (errno)); file_utils_filename_to_utf8 (source), g_strerror (errno));
fclose (sfile); fclose (sfile);
fclose (dfile); fclose (dfile);
return FALSE; return FALSE;
@ -513,7 +513,7 @@ gimp_config_file_copy (const gchar *source,
{ {
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno), g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
_("Error while writing '%s': %s"), _("Error while writing '%s': %s"),
dest, g_strerror (errno)); file_utils_filename_to_utf8 (dest), g_strerror (errno));
return FALSE; return FALSE;
} }
@ -540,7 +540,7 @@ gimp_config_file_backup_on_error (const gchar *filename,
g_message (_("There was an error parsing your '%s' file. " g_message (_("There was an error parsing your '%s' file. "
"Default values will be used. A backup of your " "Default values will be used. A backup of your "
"configuration has been created at '%s'."), "configuration has been created at '%s'."),
name, backup); name, file_utils_filename_to_utf8 (backup));
g_free (backup); g_free (backup);

View File

@ -37,6 +37,8 @@
#include "config-types.h" #include "config-types.h"
#include "file/file-utils.h"
#include "gimpconfig.h" #include "gimpconfig.h"
#include "gimpconfig-deserialize.h" #include "gimpconfig-deserialize.h"
#include "gimpconfig-error.h" #include "gimpconfig-error.h"
@ -338,7 +340,8 @@ gimp_rc_load (GimpRc *rc)
g_return_if_fail (GIMP_IS_RC (rc)); g_return_if_fail (GIMP_IS_RC (rc));
if (rc->verbose) if (rc->verbose)
g_print (_("Parsing '%s'\n"), rc->system_gimprc); g_print (_("Parsing '%s'\n"),
file_utils_filename_to_utf8 (rc->system_gimprc));
if (! gimp_config_deserialize_file (GIMP_CONFIG (rc), if (! gimp_config_deserialize_file (GIMP_CONFIG (rc),
rc->system_gimprc, NULL, &error)) rc->system_gimprc, NULL, &error))
@ -350,7 +353,8 @@ gimp_rc_load (GimpRc *rc)
} }
if (rc->verbose) if (rc->verbose)
g_print (_("Parsing '%s'\n"), rc->user_gimprc); g_print (_("Parsing '%s'\n"),
file_utils_filename_to_utf8 (rc->user_gimprc));
if (! gimp_config_deserialize_file (GIMP_CONFIG (rc), if (! gimp_config_deserialize_file (GIMP_CONFIG (rc),
rc->user_gimprc, NULL, &error)) rc->user_gimprc, NULL, &error))
@ -574,7 +578,8 @@ gimp_rc_save (GimpRc *rc)
header = g_strconcat (top, rc->system_gimprc, bottom, NULL); header = g_strconcat (top, rc->system_gimprc, bottom, NULL);
if (rc->verbose) if (rc->verbose)
g_print (_("Saving '%s'\n"), rc->user_gimprc); g_print (_("Saving '%s'\n"),
file_utils_filename_to_utf8 (rc->user_gimprc));
if (! gimp_config_serialize_to_file (GIMP_CONFIG (rc), if (! gimp_config_serialize_to_file (GIMP_CONFIG (rc),
rc->user_gimprc, rc->user_gimprc,

View File

@ -41,6 +41,8 @@
#include "libgimpcolor/gimpcolor.h" #include "libgimpcolor/gimpcolor.h"
#include "libgimpmath/gimpmath.h" #include "libgimpmath/gimpmath.h"
#include "file/file-utils.h"
#include "config-types.h" #include "config-types.h"
#include "gimpconfig-error.h" #include "gimpconfig-error.h"
@ -90,12 +92,15 @@ gimp_scanner_new_file (const gchar *filename,
g_set_error (error, GIMP_CONFIG_ERROR, code, g_set_error (error, GIMP_CONFIG_ERROR, code,
_("Could not open '%s' for reading: %s"), _("Could not open '%s' for reading: %s"),
filename, g_strerror (errno)); file_utils_filename_to_utf8 (filename), g_strerror (errno));
return NULL; return NULL;
} }
scanner = gimp_scanner_new (filename, fd, error); /* gimp_scanner_new() takes a "name" for the scanner, not a filename. Thus
* do convert to UTF-8.
*/
scanner = gimp_scanner_new (file_utils_filename_to_utf8 (filename), fd, error);
g_scanner_input_file (scanner, fd); g_scanner_input_file (scanner, fd);

View File

@ -51,6 +51,8 @@
#include "config/gimpbaseconfig.h" #include "config/gimpbaseconfig.h"
#include "file/file-utils.h"
#include "gimpbrush.h" #include "gimpbrush.h"
#include "gimpbrush-header.h" #include "gimpbrush-header.h"
#include "gimpbrushgenerated.h" #include "gimpbrushgenerated.h"
@ -412,7 +414,7 @@ gimp_brush_load (const gchar *filename,
{ {
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN,
_("Could not open '%s' for reading: %s"), _("Could not open '%s' for reading: %s"),
filename, g_strerror (errno)); file_utils_filename_to_utf8 (filename), g_strerror (errno));
return NULL; return NULL;
} }
@ -554,7 +556,8 @@ gimp_brush_load_brush (gint fd,
{ {
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Could not read %d bytes from '%s': %s"), _("Could not read %d bytes from '%s': %s"),
(gint) sizeof (header), filename, g_strerror (errno)); (gint) sizeof (header),
file_utils_filename_to_utf8 (filename), g_strerror (errno));
return NULL; return NULL;
} }
@ -589,7 +592,7 @@ gimp_brush_load_brush (gint fd,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in brush file '%s': " _("Fatal parse error in brush file '%s': "
"Unknown depth %d."), "Unknown depth %d."),
filename, header.bytes); file_utils_filename_to_utf8 (filename), header.bytes);
return NULL; return NULL;
} }
/* fallthrough */ /* fallthrough */
@ -602,7 +605,7 @@ gimp_brush_load_brush (gint fd,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in brush file '%s': " _("Fatal parse error in brush file '%s': "
"Unknown version %d."), "Unknown version %d."),
filename, header.version); file_utils_filename_to_utf8 (filename), header.version);
return NULL; return NULL;
} }
@ -618,14 +621,14 @@ gimp_brush_load_brush (gint fd,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in brush file '%s': " _("Fatal parse error in brush file '%s': "
"File appears truncated."), "File appears truncated."),
filename); file_utils_filename_to_utf8 (filename));
g_free (name); g_free (name);
return NULL; return NULL;
} }
utf8 = gimp_any_to_utf8 (name, -1, utf8 = gimp_any_to_utf8 (name, -1,
_("Invalid UTF-8 string in brush file '%s'."), _("Invalid UTF-8 string in brush file '%s'."),
filename); file_utils_filename_to_utf8 (filename));
g_free (name); g_free (name);
name = utf8; name = utf8;
} }
@ -723,7 +726,7 @@ gimp_brush_load_brush (gint fd,
_("Fatal parse error in brush file '%s': " _("Fatal parse error in brush file '%s': "
"Unsupported brush depth %d\n" "Unsupported brush depth %d\n"
"GIMP brushes must be GRAY or RGBA."), "GIMP brushes must be GRAY or RGBA."),
filename, header.bytes); file_utils_filename_to_utf8 (filename), header.bytes);
g_free (name); g_free (name);
return NULL; return NULL;
} }
@ -734,7 +737,7 @@ gimp_brush_load_brush (gint fd,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in brush file '%s': " _("Fatal parse error in brush file '%s': "
"File appears truncated."), "File appears truncated."),
filename); file_utils_filename_to_utf8 (filename));
g_free (name); g_free (name);
return NULL; return NULL;
} }

View File

@ -51,6 +51,8 @@
#include "config/gimpbaseconfig.h" #include "config/gimpbaseconfig.h"
#include "file/file-utils.h"
#include "gimpbrush.h" #include "gimpbrush.h"
#include "gimpbrush-header.h" #include "gimpbrush-header.h"
#include "gimpbrushgenerated.h" #include "gimpbrushgenerated.h"
@ -412,7 +414,7 @@ gimp_brush_load (const gchar *filename,
{ {
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN,
_("Could not open '%s' for reading: %s"), _("Could not open '%s' for reading: %s"),
filename, g_strerror (errno)); file_utils_filename_to_utf8 (filename), g_strerror (errno));
return NULL; return NULL;
} }
@ -554,7 +556,8 @@ gimp_brush_load_brush (gint fd,
{ {
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Could not read %d bytes from '%s': %s"), _("Could not read %d bytes from '%s': %s"),
(gint) sizeof (header), filename, g_strerror (errno)); (gint) sizeof (header),
file_utils_filename_to_utf8 (filename), g_strerror (errno));
return NULL; return NULL;
} }
@ -589,7 +592,7 @@ gimp_brush_load_brush (gint fd,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in brush file '%s': " _("Fatal parse error in brush file '%s': "
"Unknown depth %d."), "Unknown depth %d."),
filename, header.bytes); file_utils_filename_to_utf8 (filename), header.bytes);
return NULL; return NULL;
} }
/* fallthrough */ /* fallthrough */
@ -602,7 +605,7 @@ gimp_brush_load_brush (gint fd,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in brush file '%s': " _("Fatal parse error in brush file '%s': "
"Unknown version %d."), "Unknown version %d."),
filename, header.version); file_utils_filename_to_utf8 (filename), header.version);
return NULL; return NULL;
} }
@ -618,14 +621,14 @@ gimp_brush_load_brush (gint fd,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in brush file '%s': " _("Fatal parse error in brush file '%s': "
"File appears truncated."), "File appears truncated."),
filename); file_utils_filename_to_utf8 (filename));
g_free (name); g_free (name);
return NULL; return NULL;
} }
utf8 = gimp_any_to_utf8 (name, -1, utf8 = gimp_any_to_utf8 (name, -1,
_("Invalid UTF-8 string in brush file '%s'."), _("Invalid UTF-8 string in brush file '%s'."),
filename); file_utils_filename_to_utf8 (filename));
g_free (name); g_free (name);
name = utf8; name = utf8;
} }
@ -723,7 +726,7 @@ gimp_brush_load_brush (gint fd,
_("Fatal parse error in brush file '%s': " _("Fatal parse error in brush file '%s': "
"Unsupported brush depth %d\n" "Unsupported brush depth %d\n"
"GIMP brushes must be GRAY or RGBA."), "GIMP brushes must be GRAY or RGBA."),
filename, header.bytes); file_utils_filename_to_utf8 (filename), header.bytes);
g_free (name); g_free (name);
return NULL; return NULL;
} }
@ -734,7 +737,7 @@ gimp_brush_load_brush (gint fd,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in brush file '%s': " _("Fatal parse error in brush file '%s': "
"File appears truncated."), "File appears truncated."),
filename); file_utils_filename_to_utf8 (filename));
g_free (name); g_free (name);
return NULL; return NULL;
} }

View File

@ -36,6 +36,8 @@
#include "base/temp-buf.h" #include "base/temp-buf.h"
#include "file/file-utils.h"
#include "gimpbrushgenerated.h" #include "gimpbrushgenerated.h"
#include "gimp-intl.h" #include "gimp-intl.h"
@ -127,7 +129,8 @@ gimp_brush_generated_save (GimpData *data,
{ {
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN,
_("Could not open '%s' for writing: %s"), _("Could not open '%s' for writing: %s"),
data->filename, g_strerror (errno)); file_utils_filename_to_utf8 (data->filename),
g_strerror (errno));
return FALSE; return FALSE;
} }
@ -375,7 +378,7 @@ gimp_brush_generated_load (const gchar *filename,
{ {
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN,
_("Could not open '%s' for reading: %s"), _("Could not open '%s' for reading: %s"),
filename, g_strerror (errno)); file_utils_filename_to_utf8 (filename), g_strerror (errno));
return NULL; return NULL;
} }
@ -387,7 +390,7 @@ gimp_brush_generated_load (const gchar *filename,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in brush file '%s': " _("Fatal parse error in brush file '%s': "
"Not a GIMP brush file."), "Not a GIMP brush file."),
filename); file_utils_filename_to_utf8 (filename));
return NULL; return NULL;
} }
@ -398,7 +401,7 @@ gimp_brush_generated_load (const gchar *filename,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in brush file '%s': " _("Fatal parse error in brush file '%s': "
"Unknown GIMP brush version."), "Unknown GIMP brush version."),
filename); file_utils_filename_to_utf8 (filename));
return NULL; return NULL;
} }

View File

@ -36,6 +36,8 @@
#include "base/temp-buf.h" #include "base/temp-buf.h"
#include "file/file-utils.h"
#include "gimpbrushgenerated.h" #include "gimpbrushgenerated.h"
#include "gimp-intl.h" #include "gimp-intl.h"
@ -127,7 +129,8 @@ gimp_brush_generated_save (GimpData *data,
{ {
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN,
_("Could not open '%s' for writing: %s"), _("Could not open '%s' for writing: %s"),
data->filename, g_strerror (errno)); file_utils_filename_to_utf8 (data->filename),
g_strerror (errno));
return FALSE; return FALSE;
} }
@ -375,7 +378,7 @@ gimp_brush_generated_load (const gchar *filename,
{ {
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN,
_("Could not open '%s' for reading: %s"), _("Could not open '%s' for reading: %s"),
filename, g_strerror (errno)); file_utils_filename_to_utf8 (filename), g_strerror (errno));
return NULL; return NULL;
} }
@ -387,7 +390,7 @@ gimp_brush_generated_load (const gchar *filename,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in brush file '%s': " _("Fatal parse error in brush file '%s': "
"Not a GIMP brush file."), "Not a GIMP brush file."),
filename); file_utils_filename_to_utf8 (filename));
return NULL; return NULL;
} }
@ -398,7 +401,7 @@ gimp_brush_generated_load (const gchar *filename,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in brush file '%s': " _("Fatal parse error in brush file '%s': "
"Unknown GIMP brush version."), "Unknown GIMP brush version."),
filename); file_utils_filename_to_utf8 (filename));
return NULL; return NULL;
} }

View File

@ -36,6 +36,8 @@
#include "base/temp-buf.h" #include "base/temp-buf.h"
#include "file/file-utils.h"
#include "gimpbrushgenerated.h" #include "gimpbrushgenerated.h"
#include "gimp-intl.h" #include "gimp-intl.h"
@ -127,7 +129,8 @@ gimp_brush_generated_save (GimpData *data,
{ {
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN,
_("Could not open '%s' for writing: %s"), _("Could not open '%s' for writing: %s"),
data->filename, g_strerror (errno)); file_utils_filename_to_utf8 (data->filename),
g_strerror (errno));
return FALSE; return FALSE;
} }
@ -375,7 +378,7 @@ gimp_brush_generated_load (const gchar *filename,
{ {
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN,
_("Could not open '%s' for reading: %s"), _("Could not open '%s' for reading: %s"),
filename, g_strerror (errno)); file_utils_filename_to_utf8 (filename), g_strerror (errno));
return NULL; return NULL;
} }
@ -387,7 +390,7 @@ gimp_brush_generated_load (const gchar *filename,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in brush file '%s': " _("Fatal parse error in brush file '%s': "
"Not a GIMP brush file."), "Not a GIMP brush file."),
filename); file_utils_filename_to_utf8 (filename));
return NULL; return NULL;
} }
@ -398,7 +401,7 @@ gimp_brush_generated_load (const gchar *filename,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in brush file '%s': " _("Fatal parse error in brush file '%s': "
"Unknown GIMP brush version."), "Unknown GIMP brush version."),
filename); file_utils_filename_to_utf8 (filename));
return NULL; return NULL;
} }

View File

@ -47,6 +47,8 @@
#include "base/temp-buf.h" #include "base/temp-buf.h"
#include "file/file-utils.h"
#include "gimpbrush.h" #include "gimpbrush.h"
#include "gimpbrush-header.h" #include "gimpbrush-header.h"
#include "gimpbrushpipe.h" #include "gimpbrushpipe.h"
@ -350,7 +352,7 @@ gimp_brush_pipe_load (const gchar *filename,
{ {
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN,
_("Could not open '%s' for reading: %s"), _("Could not open '%s' for reading: %s"),
filename, g_strerror (errno)); file_utils_filename_to_utf8 (filename), g_strerror (errno));
return NULL; return NULL;
} }
@ -372,7 +374,7 @@ gimp_brush_pipe_load (const gchar *filename,
else else
{ {
g_message (_("Invalid UTF-8 string in brush file '%s'."), g_message (_("Invalid UTF-8 string in brush file '%s'."),
filename); file_utils_filename_to_utf8 (filename));
gimp_object_set_name (GIMP_OBJECT (pipe), _("Unnamed")); gimp_object_set_name (GIMP_OBJECT (pipe), _("Unnamed"));
} }
} }
@ -383,7 +385,7 @@ gimp_brush_pipe_load (const gchar *filename,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in brush file '%s': " _("Fatal parse error in brush file '%s': "
"File is corrupt."), "File is corrupt."),
filename); file_utils_filename_to_utf8 (filename));
close (fd); close (fd);
return NULL; return NULL;
} }
@ -403,7 +405,7 @@ gimp_brush_pipe_load (const gchar *filename,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in brush file '%s': " _("Fatal parse error in brush file '%s': "
"File is corrupt."), "File is corrupt."),
filename); file_utils_filename_to_utf8 (filename));
close (fd); close (fd);
g_object_unref (pipe); g_object_unref (pipe);
g_string_free (buffer, TRUE); g_string_free (buffer, TRUE);
@ -493,7 +495,7 @@ gimp_brush_pipe_load (const gchar *filename,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in brush file '%s': " _("Fatal parse error in brush file '%s': "
"File is corrupt."), "File is corrupt."),
filename); file_utils_filename_to_utf8 (filename));
close (fd); close (fd);
g_object_unref (pipe); g_object_unref (pipe);
return NULL; return NULL;

View File

@ -47,6 +47,8 @@
#include "base/temp-buf.h" #include "base/temp-buf.h"
#include "file/file-utils.h"
#include "gimpbrush.h" #include "gimpbrush.h"
#include "gimpbrush-header.h" #include "gimpbrush-header.h"
#include "gimpbrushpipe.h" #include "gimpbrushpipe.h"
@ -350,7 +352,7 @@ gimp_brush_pipe_load (const gchar *filename,
{ {
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN,
_("Could not open '%s' for reading: %s"), _("Could not open '%s' for reading: %s"),
filename, g_strerror (errno)); file_utils_filename_to_utf8 (filename), g_strerror (errno));
return NULL; return NULL;
} }
@ -372,7 +374,7 @@ gimp_brush_pipe_load (const gchar *filename,
else else
{ {
g_message (_("Invalid UTF-8 string in brush file '%s'."), g_message (_("Invalid UTF-8 string in brush file '%s'."),
filename); file_utils_filename_to_utf8 (filename));
gimp_object_set_name (GIMP_OBJECT (pipe), _("Unnamed")); gimp_object_set_name (GIMP_OBJECT (pipe), _("Unnamed"));
} }
} }
@ -383,7 +385,7 @@ gimp_brush_pipe_load (const gchar *filename,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in brush file '%s': " _("Fatal parse error in brush file '%s': "
"File is corrupt."), "File is corrupt."),
filename); file_utils_filename_to_utf8 (filename));
close (fd); close (fd);
return NULL; return NULL;
} }
@ -403,7 +405,7 @@ gimp_brush_pipe_load (const gchar *filename,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in brush file '%s': " _("Fatal parse error in brush file '%s': "
"File is corrupt."), "File is corrupt."),
filename); file_utils_filename_to_utf8 (filename));
close (fd); close (fd);
g_object_unref (pipe); g_object_unref (pipe);
g_string_free (buffer, TRUE); g_string_free (buffer, TRUE);
@ -493,7 +495,7 @@ gimp_brush_pipe_load (const gchar *filename,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in brush file '%s': " _("Fatal parse error in brush file '%s': "
"File is corrupt."), "File is corrupt."),
filename); file_utils_filename_to_utf8 (filename));
close (fd); close (fd);
g_object_unref (pipe); g_object_unref (pipe);
return NULL; return NULL;

View File

@ -29,6 +29,8 @@
#include "libgimpbase/gimpbase.h" #include "libgimpbase/gimpbase.h"
#include "file/file-utils.h"
#include "core-types.h" #include "core-types.h"
#include "gimpenvirontable.h" #include "gimpenvirontable.h"
@ -283,7 +285,7 @@ gimp_environ_table_load_env_file (const GimpDatafileData *file_data,
if (name[0] == '\0') if (name[0] == '\0')
{ {
g_message (_("Empty variable name in environment file %s"), g_message (_("Empty variable name in environment file %s"),
file_data->filename); file_utils_filename_to_utf8 (file_data->filename));
continue; continue;
} }
@ -301,7 +303,7 @@ gimp_environ_table_load_env_file (const GimpDatafileData *file_data,
if (! gimp_environ_table_legal_name (name)) if (! gimp_environ_table_legal_name (name))
{ {
g_message (_("Illegal variable name in environment file %s: %s"), g_message (_("Illegal variable name in environment file %s: %s"),
file_data->filename, name); file_utils_filename_to_utf8 (file_data->filename), name);
continue; continue;
} }

View File

@ -33,6 +33,8 @@
#include "base/temp-buf.h" #include "base/temp-buf.h"
#include "file/file-utils.h"
#include "gimpimage.h" #include "gimpimage.h"
#include "gimpgradient.h" #include "gimpgradient.h"
@ -354,7 +356,7 @@ gimp_gradient_load (const gchar *filename,
{ {
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN,
_("Could not open '%s' for reading: %s"), _("Could not open '%s' for reading: %s"),
filename, g_strerror (errno)); file_utils_filename_to_utf8 (filename), g_strerror (errno));
return NULL; return NULL;
} }
@ -364,7 +366,7 @@ gimp_gradient_load (const gchar *filename,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in gradient file '%s': " _("Fatal parse error in gradient file '%s': "
"Not a GIMP gradient file."), "Not a GIMP gradient file."),
filename); file_utils_filename_to_utf8 (filename));
fclose (file); fclose (file);
return NULL; return NULL;
} }
@ -380,7 +382,7 @@ gimp_gradient_load (const gchar *filename,
utf8 = gimp_any_to_utf8 (&line[strlen ("Name: ")], -1, utf8 = gimp_any_to_utf8 (&line[strlen ("Name: ")], -1,
_("Invalid UTF-8 string in gradient file '%s'."), _("Invalid UTF-8 string in gradient file '%s'."),
filename); file_utils_filename_to_utf8 (filename));
g_strstrip (utf8); g_strstrip (utf8);
gimp_object_set_name (GIMP_OBJECT (gradient), utf8); gimp_object_set_name (GIMP_OBJECT (gradient), utf8);
@ -409,7 +411,7 @@ gimp_gradient_load (const gchar *filename,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in gradient file '%s': " _("Fatal parse error in gradient file '%s': "
"File is corrupt."), "File is corrupt."),
filename); file_utils_filename_to_utf8 (filename));
g_object_unref (gradient); g_object_unref (gradient);
fclose (file); fclose (file);
return NULL; return NULL;
@ -465,7 +467,7 @@ gimp_gradient_load (const gchar *filename,
else else
{ {
g_message (_("Corrupt segment %d in gradient file '%s'."), g_message (_("Corrupt segment %d in gradient file '%s'."),
i, filename); i, file_utils_filename_to_utf8 (filename));
} }
prev = seg; prev = seg;
@ -507,7 +509,8 @@ gimp_gradient_save (GimpData *data,
{ {
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN,
_("Could not open '%s' for writing: %s"), _("Could not open '%s' for writing: %s"),
data->filename, g_strerror (errno)); file_utils_filename_to_utf8 (data->filename),
g_strerror (errno));
return FALSE; return FALSE;
} }
@ -592,7 +595,7 @@ gimp_gradient_save_as_pov (GimpGradient *gradient,
{ {
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN,
_("Could not open '%s' for writing: %s"), _("Could not open '%s' for writing: %s"),
filename, g_strerror (errno)); file_utils_filename_to_utf8 (filename), g_strerror (errno));
return FALSE; return FALSE;
} }
else else

View File

@ -35,6 +35,8 @@
#include "base/temp-buf.h" #include "base/temp-buf.h"
#include "file/file-utils.h"
#include "gimppalette.h" #include "gimppalette.h"
#include "gimp-intl.h" #include "gimp-intl.h"
@ -377,7 +379,7 @@ gimp_palette_load (const gchar *filename,
{ {
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN,
_("Could not open '%s' for reading: %s"), _("Could not open '%s' for reading: %s"),
filename, g_strerror (errno)); file_utils_filename_to_utf8 (filename), g_strerror (errno));
return NULL; return NULL;
} }
@ -394,12 +396,12 @@ gimp_palette_load (const gchar *filename,
_("Fatal parse error in palette file '%s': " _("Fatal parse error in palette file '%s': "
"Missing magic header.\n" "Missing magic header.\n"
"Does this file need converting from DOS?"), "Does this file need converting from DOS?"),
filename); file_utils_filename_to_utf8 (filename));
else else
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in palette file '%s': " _("Fatal parse error in palette file '%s': "
"Missing magic header."), "Missing magic header."),
filename); file_utils_filename_to_utf8 (filename));
fclose (fp); fclose (fp);
@ -415,7 +417,7 @@ gimp_palette_load (const gchar *filename,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in palette file '%s': " _("Fatal parse error in palette file '%s': "
"Read error in line %d."), "Read error in line %d."),
filename, linenum); file_utils_filename_to_utf8 (filename), linenum);
fclose (fp); fclose (fp);
g_object_unref (palette); g_object_unref (palette);
return NULL; return NULL;
@ -429,7 +431,7 @@ gimp_palette_load (const gchar *filename,
utf8 = gimp_any_to_utf8 (&str[strlen ("Name: ")], -1, utf8 = gimp_any_to_utf8 (&str[strlen ("Name: ")], -1,
_("Invalid UTF-8 string in palette file '%s'"), _("Invalid UTF-8 string in palette file '%s'"),
filename); file_utils_filename_to_utf8 (filename));
g_strstrip (utf8); g_strstrip (utf8);
gimp_object_set_name (GIMP_OBJECT (palette), utf8); gimp_object_set_name (GIMP_OBJECT (palette), utf8);
@ -440,7 +442,7 @@ gimp_palette_load (const gchar *filename,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in palette file '%s': " _("Fatal parse error in palette file '%s': "
"Read error in line %d."), "Read error in line %d."),
filename, linenum); file_utils_filename_to_utf8 (filename), linenum);
fclose (fp); fclose (fp);
g_object_unref (palette); g_object_unref (palette);
return NULL; return NULL;
@ -459,7 +461,7 @@ gimp_palette_load (const gchar *filename,
g_message (_("Reading palette file '%s': " g_message (_("Reading palette file '%s': "
"Invalid number of columns in line %d. " "Invalid number of columns in line %d. "
"Using default value."), "Using default value."),
filename, linenum); file_utils_filename_to_utf8 (filename), linenum);
columns = 0; columns = 0;
} }
@ -470,7 +472,7 @@ gimp_palette_load (const gchar *filename,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in palette file '%s': " _("Fatal parse error in palette file '%s': "
"Read error in line %d."), "Read error in line %d."),
filename, linenum); file_utils_filename_to_utf8 (filename), linenum);
fclose (fp); fclose (fp);
g_object_unref (palette); g_object_unref (palette);
return NULL; return NULL;
@ -504,7 +506,7 @@ gimp_palette_load (const gchar *filename,
/* maybe we should just abort? */ /* maybe we should just abort? */
g_message (_("Reading palette file '%s': " g_message (_("Reading palette file '%s': "
"Missing RED component in line %d."), "Missing RED component in line %d."),
filename, linenum); file_utils_filename_to_utf8 (filename), linenum);
tok = strtok (NULL, " \t"); tok = strtok (NULL, " \t");
if (tok) if (tok)
@ -512,7 +514,7 @@ gimp_palette_load (const gchar *filename,
else else
g_message (_("Reading palette '%s': " g_message (_("Reading palette '%s': "
"Missing GREEN component in line %d."), "Missing GREEN component in line %d."),
filename, linenum); file_utils_filename_to_utf8 (filename), linenum);
tok = strtok (NULL, " \t"); tok = strtok (NULL, " \t");
if (tok) if (tok)
@ -520,7 +522,7 @@ gimp_palette_load (const gchar *filename,
else else
g_message (_("Reading palette file '%s': " g_message (_("Reading palette file '%s': "
"Missing BLUE component in line %d."), "Missing BLUE component in line %d."),
filename, linenum); file_utils_filename_to_utf8 (filename), linenum);
/* optional name */ /* optional name */
tok = strtok (NULL, "\n"); tok = strtok (NULL, "\n");
@ -530,7 +532,7 @@ gimp_palette_load (const gchar *filename,
b < 0 || b > 255) b < 0 || b > 255)
g_message (_("Reading palette file '%s': " g_message (_("Reading palette file '%s': "
"RGB value out of range in line %d."), "RGB value out of range in line %d."),
filename, linenum); file_utils_filename_to_utf8 (filename), linenum);
gimp_rgba_set_uchar (&color, gimp_rgba_set_uchar (&color,
(guchar) r, (guchar) r,
@ -549,7 +551,7 @@ gimp_palette_load (const gchar *filename,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in palette file '%s': " _("Fatal parse error in palette file '%s': "
"Read error in line %d."), "Read error in line %d."),
filename, linenum); file_utils_filename_to_utf8 (filename), linenum);
fclose (fp); fclose (fp);
g_object_unref (palette); g_object_unref (palette);
return NULL; return NULL;
@ -588,7 +590,8 @@ gimp_palette_save (GimpData *data,
{ {
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN,
_("Could not open '%s' for writing: %s"), _("Could not open '%s' for writing: %s"),
data->filename, g_strerror (errno)); file_utils_filename_to_utf8 (data->filename),
g_strerror (errno));
return FALSE; return FALSE;
} }

View File

@ -35,6 +35,8 @@
#include "base/temp-buf.h" #include "base/temp-buf.h"
#include "file/file-utils.h"
#include "gimppalette.h" #include "gimppalette.h"
#include "gimp-intl.h" #include "gimp-intl.h"
@ -377,7 +379,7 @@ gimp_palette_load (const gchar *filename,
{ {
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN,
_("Could not open '%s' for reading: %s"), _("Could not open '%s' for reading: %s"),
filename, g_strerror (errno)); file_utils_filename_to_utf8 (filename), g_strerror (errno));
return NULL; return NULL;
} }
@ -394,12 +396,12 @@ gimp_palette_load (const gchar *filename,
_("Fatal parse error in palette file '%s': " _("Fatal parse error in palette file '%s': "
"Missing magic header.\n" "Missing magic header.\n"
"Does this file need converting from DOS?"), "Does this file need converting from DOS?"),
filename); file_utils_filename_to_utf8 (filename));
else else
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in palette file '%s': " _("Fatal parse error in palette file '%s': "
"Missing magic header."), "Missing magic header."),
filename); file_utils_filename_to_utf8 (filename));
fclose (fp); fclose (fp);
@ -415,7 +417,7 @@ gimp_palette_load (const gchar *filename,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in palette file '%s': " _("Fatal parse error in palette file '%s': "
"Read error in line %d."), "Read error in line %d."),
filename, linenum); file_utils_filename_to_utf8 (filename), linenum);
fclose (fp); fclose (fp);
g_object_unref (palette); g_object_unref (palette);
return NULL; return NULL;
@ -429,7 +431,7 @@ gimp_palette_load (const gchar *filename,
utf8 = gimp_any_to_utf8 (&str[strlen ("Name: ")], -1, utf8 = gimp_any_to_utf8 (&str[strlen ("Name: ")], -1,
_("Invalid UTF-8 string in palette file '%s'"), _("Invalid UTF-8 string in palette file '%s'"),
filename); file_utils_filename_to_utf8 (filename));
g_strstrip (utf8); g_strstrip (utf8);
gimp_object_set_name (GIMP_OBJECT (palette), utf8); gimp_object_set_name (GIMP_OBJECT (palette), utf8);
@ -440,7 +442,7 @@ gimp_palette_load (const gchar *filename,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in palette file '%s': " _("Fatal parse error in palette file '%s': "
"Read error in line %d."), "Read error in line %d."),
filename, linenum); file_utils_filename_to_utf8 (filename), linenum);
fclose (fp); fclose (fp);
g_object_unref (palette); g_object_unref (palette);
return NULL; return NULL;
@ -459,7 +461,7 @@ gimp_palette_load (const gchar *filename,
g_message (_("Reading palette file '%s': " g_message (_("Reading palette file '%s': "
"Invalid number of columns in line %d. " "Invalid number of columns in line %d. "
"Using default value."), "Using default value."),
filename, linenum); file_utils_filename_to_utf8 (filename), linenum);
columns = 0; columns = 0;
} }
@ -470,7 +472,7 @@ gimp_palette_load (const gchar *filename,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in palette file '%s': " _("Fatal parse error in palette file '%s': "
"Read error in line %d."), "Read error in line %d."),
filename, linenum); file_utils_filename_to_utf8 (filename), linenum);
fclose (fp); fclose (fp);
g_object_unref (palette); g_object_unref (palette);
return NULL; return NULL;
@ -504,7 +506,7 @@ gimp_palette_load (const gchar *filename,
/* maybe we should just abort? */ /* maybe we should just abort? */
g_message (_("Reading palette file '%s': " g_message (_("Reading palette file '%s': "
"Missing RED component in line %d."), "Missing RED component in line %d."),
filename, linenum); file_utils_filename_to_utf8 (filename), linenum);
tok = strtok (NULL, " \t"); tok = strtok (NULL, " \t");
if (tok) if (tok)
@ -512,7 +514,7 @@ gimp_palette_load (const gchar *filename,
else else
g_message (_("Reading palette '%s': " g_message (_("Reading palette '%s': "
"Missing GREEN component in line %d."), "Missing GREEN component in line %d."),
filename, linenum); file_utils_filename_to_utf8 (filename), linenum);
tok = strtok (NULL, " \t"); tok = strtok (NULL, " \t");
if (tok) if (tok)
@ -520,7 +522,7 @@ gimp_palette_load (const gchar *filename,
else else
g_message (_("Reading palette file '%s': " g_message (_("Reading palette file '%s': "
"Missing BLUE component in line %d."), "Missing BLUE component in line %d."),
filename, linenum); file_utils_filename_to_utf8 (filename), linenum);
/* optional name */ /* optional name */
tok = strtok (NULL, "\n"); tok = strtok (NULL, "\n");
@ -530,7 +532,7 @@ gimp_palette_load (const gchar *filename,
b < 0 || b > 255) b < 0 || b > 255)
g_message (_("Reading palette file '%s': " g_message (_("Reading palette file '%s': "
"RGB value out of range in line %d."), "RGB value out of range in line %d."),
filename, linenum); file_utils_filename_to_utf8 (filename), linenum);
gimp_rgba_set_uchar (&color, gimp_rgba_set_uchar (&color,
(guchar) r, (guchar) r,
@ -549,7 +551,7 @@ gimp_palette_load (const gchar *filename,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in palette file '%s': " _("Fatal parse error in palette file '%s': "
"Read error in line %d."), "Read error in line %d."),
filename, linenum); file_utils_filename_to_utf8 (filename), linenum);
fclose (fp); fclose (fp);
g_object_unref (palette); g_object_unref (palette);
return NULL; return NULL;
@ -588,7 +590,8 @@ gimp_palette_save (GimpData *data,
{ {
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN,
_("Could not open '%s' for writing: %s"), _("Could not open '%s' for writing: %s"),
data->filename, g_strerror (errno)); file_utils_filename_to_utf8 (data->filename),
g_strerror (errno));
return FALSE; return FALSE;
} }

View File

@ -35,6 +35,8 @@
#include "base/temp-buf.h" #include "base/temp-buf.h"
#include "file/file-utils.h"
#include "gimppalette.h" #include "gimppalette.h"
#include "gimp-intl.h" #include "gimp-intl.h"
@ -377,7 +379,7 @@ gimp_palette_load (const gchar *filename,
{ {
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN,
_("Could not open '%s' for reading: %s"), _("Could not open '%s' for reading: %s"),
filename, g_strerror (errno)); file_utils_filename_to_utf8 (filename), g_strerror (errno));
return NULL; return NULL;
} }
@ -394,12 +396,12 @@ gimp_palette_load (const gchar *filename,
_("Fatal parse error in palette file '%s': " _("Fatal parse error in palette file '%s': "
"Missing magic header.\n" "Missing magic header.\n"
"Does this file need converting from DOS?"), "Does this file need converting from DOS?"),
filename); file_utils_filename_to_utf8 (filename));
else else
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in palette file '%s': " _("Fatal parse error in palette file '%s': "
"Missing magic header."), "Missing magic header."),
filename); file_utils_filename_to_utf8 (filename));
fclose (fp); fclose (fp);
@ -415,7 +417,7 @@ gimp_palette_load (const gchar *filename,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in palette file '%s': " _("Fatal parse error in palette file '%s': "
"Read error in line %d."), "Read error in line %d."),
filename, linenum); file_utils_filename_to_utf8 (filename), linenum);
fclose (fp); fclose (fp);
g_object_unref (palette); g_object_unref (palette);
return NULL; return NULL;
@ -429,7 +431,7 @@ gimp_palette_load (const gchar *filename,
utf8 = gimp_any_to_utf8 (&str[strlen ("Name: ")], -1, utf8 = gimp_any_to_utf8 (&str[strlen ("Name: ")], -1,
_("Invalid UTF-8 string in palette file '%s'"), _("Invalid UTF-8 string in palette file '%s'"),
filename); file_utils_filename_to_utf8 (filename));
g_strstrip (utf8); g_strstrip (utf8);
gimp_object_set_name (GIMP_OBJECT (palette), utf8); gimp_object_set_name (GIMP_OBJECT (palette), utf8);
@ -440,7 +442,7 @@ gimp_palette_load (const gchar *filename,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in palette file '%s': " _("Fatal parse error in palette file '%s': "
"Read error in line %d."), "Read error in line %d."),
filename, linenum); file_utils_filename_to_utf8 (filename), linenum);
fclose (fp); fclose (fp);
g_object_unref (palette); g_object_unref (palette);
return NULL; return NULL;
@ -459,7 +461,7 @@ gimp_palette_load (const gchar *filename,
g_message (_("Reading palette file '%s': " g_message (_("Reading palette file '%s': "
"Invalid number of columns in line %d. " "Invalid number of columns in line %d. "
"Using default value."), "Using default value."),
filename, linenum); file_utils_filename_to_utf8 (filename), linenum);
columns = 0; columns = 0;
} }
@ -470,7 +472,7 @@ gimp_palette_load (const gchar *filename,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in palette file '%s': " _("Fatal parse error in palette file '%s': "
"Read error in line %d."), "Read error in line %d."),
filename, linenum); file_utils_filename_to_utf8 (filename), linenum);
fclose (fp); fclose (fp);
g_object_unref (palette); g_object_unref (palette);
return NULL; return NULL;
@ -504,7 +506,7 @@ gimp_palette_load (const gchar *filename,
/* maybe we should just abort? */ /* maybe we should just abort? */
g_message (_("Reading palette file '%s': " g_message (_("Reading palette file '%s': "
"Missing RED component in line %d."), "Missing RED component in line %d."),
filename, linenum); file_utils_filename_to_utf8 (filename), linenum);
tok = strtok (NULL, " \t"); tok = strtok (NULL, " \t");
if (tok) if (tok)
@ -512,7 +514,7 @@ gimp_palette_load (const gchar *filename,
else else
g_message (_("Reading palette '%s': " g_message (_("Reading palette '%s': "
"Missing GREEN component in line %d."), "Missing GREEN component in line %d."),
filename, linenum); file_utils_filename_to_utf8 (filename), linenum);
tok = strtok (NULL, " \t"); tok = strtok (NULL, " \t");
if (tok) if (tok)
@ -520,7 +522,7 @@ gimp_palette_load (const gchar *filename,
else else
g_message (_("Reading palette file '%s': " g_message (_("Reading palette file '%s': "
"Missing BLUE component in line %d."), "Missing BLUE component in line %d."),
filename, linenum); file_utils_filename_to_utf8 (filename), linenum);
/* optional name */ /* optional name */
tok = strtok (NULL, "\n"); tok = strtok (NULL, "\n");
@ -530,7 +532,7 @@ gimp_palette_load (const gchar *filename,
b < 0 || b > 255) b < 0 || b > 255)
g_message (_("Reading palette file '%s': " g_message (_("Reading palette file '%s': "
"RGB value out of range in line %d."), "RGB value out of range in line %d."),
filename, linenum); file_utils_filename_to_utf8 (filename), linenum);
gimp_rgba_set_uchar (&color, gimp_rgba_set_uchar (&color,
(guchar) r, (guchar) r,
@ -549,7 +551,7 @@ gimp_palette_load (const gchar *filename,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in palette file '%s': " _("Fatal parse error in palette file '%s': "
"Read error in line %d."), "Read error in line %d."),
filename, linenum); file_utils_filename_to_utf8 (filename), linenum);
fclose (fp); fclose (fp);
g_object_unref (palette); g_object_unref (palette);
return NULL; return NULL;
@ -588,7 +590,8 @@ gimp_palette_save (GimpData *data,
{ {
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN,
_("Could not open '%s' for writing: %s"), _("Could not open '%s' for writing: %s"),
data->filename, g_strerror (errno)); file_utils_filename_to_utf8 (data->filename),
g_strerror (errno));
return FALSE; return FALSE;
} }

View File

@ -49,6 +49,8 @@
#include "base/temp-buf.h" #include "base/temp-buf.h"
#include "file/file-utils.h"
#include "gimpimage.h" #include "gimpimage.h"
#include "gimppattern.h" #include "gimppattern.h"
#include "gimppattern-header.h" #include "gimppattern-header.h"
@ -342,7 +344,7 @@ gimp_pattern_load (const gchar *filename,
{ {
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN,
_("Could not open '%s' for reading: %s"), _("Could not open '%s' for reading: %s"),
filename, g_strerror (errno)); file_utils_filename_to_utf8 (filename), g_strerror (errno));
return NULL; return NULL;
} }
@ -352,7 +354,8 @@ gimp_pattern_load (const gchar *filename,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in pattern file '%s': " _("Fatal parse error in pattern file '%s': "
"Could not read %d bytes: %s"), "Could not read %d bytes: %s"),
filename, (gint) sizeof (header), g_strerror (errno)); file_utils_filename_to_utf8 (filename),
(gint) sizeof (header), g_strerror (errno));
goto error; goto error;
} }
@ -371,7 +374,7 @@ gimp_pattern_load (const gchar *filename,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in pattern file '%s': " _("Fatal parse error in pattern file '%s': "
"Unknown pattern format version %d."), "Unknown pattern format version %d."),
filename, header.version); file_utils_filename_to_utf8 (filename), header.version);
goto error; goto error;
} }
@ -382,7 +385,7 @@ gimp_pattern_load (const gchar *filename,
_("Fatal parse error in pattern file '%s: " _("Fatal parse error in pattern file '%s: "
"Unsupported pattern depth %d.\n" "Unsupported pattern depth %d.\n"
"GIMP Patterns must be GRAY or RGB."), "GIMP Patterns must be GRAY or RGB."),
filename, header.bytes); file_utils_filename_to_utf8 (filename), header.bytes);
goto error; goto error;
} }
@ -398,13 +401,14 @@ gimp_pattern_load (const gchar *filename,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in pattern file '%s': " _("Fatal parse error in pattern file '%s': "
"Could not read %d bytes: %s"), "Could not read %d bytes: %s"),
filename, bn_size, g_strerror (errno)); file_utils_filename_to_utf8 (filename), bn_size,
g_strerror (errno));
goto error; goto error;
} }
utf8 = gimp_any_to_utf8 (name, -1, utf8 = gimp_any_to_utf8 (name, -1,
_("Invalid UTF-8 string in pattern file '%s'."), _("Invalid UTF-8 string in pattern file '%s'."),
filename); file_utils_filename_to_utf8 (filename));
g_free (name); g_free (name);
name = utf8; name = utf8;
} }
@ -423,7 +427,8 @@ gimp_pattern_load (const gchar *filename,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in pattern file '%s': " _("Fatal parse error in pattern file '%s': "
"Could not read %d bytes: %s"), "Could not read %d bytes: %s"),
filename, header.width * header.height * header.bytes, file_utils_filename_to_utf8 (filename),
header.width * header.height * header.bytes,
g_strerror (errno)); g_strerror (errno));
goto error; goto error;
} }

View File

@ -49,6 +49,8 @@
#include "base/temp-buf.h" #include "base/temp-buf.h"
#include "file/file-utils.h"
#include "gimpimage.h" #include "gimpimage.h"
#include "gimppattern.h" #include "gimppattern.h"
#include "gimppattern-header.h" #include "gimppattern-header.h"
@ -342,7 +344,7 @@ gimp_pattern_load (const gchar *filename,
{ {
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN,
_("Could not open '%s' for reading: %s"), _("Could not open '%s' for reading: %s"),
filename, g_strerror (errno)); file_utils_filename_to_utf8 (filename), g_strerror (errno));
return NULL; return NULL;
} }
@ -352,7 +354,8 @@ gimp_pattern_load (const gchar *filename,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in pattern file '%s': " _("Fatal parse error in pattern file '%s': "
"Could not read %d bytes: %s"), "Could not read %d bytes: %s"),
filename, (gint) sizeof (header), g_strerror (errno)); file_utils_filename_to_utf8 (filename),
(gint) sizeof (header), g_strerror (errno));
goto error; goto error;
} }
@ -371,7 +374,7 @@ gimp_pattern_load (const gchar *filename,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in pattern file '%s': " _("Fatal parse error in pattern file '%s': "
"Unknown pattern format version %d."), "Unknown pattern format version %d."),
filename, header.version); file_utils_filename_to_utf8 (filename), header.version);
goto error; goto error;
} }
@ -382,7 +385,7 @@ gimp_pattern_load (const gchar *filename,
_("Fatal parse error in pattern file '%s: " _("Fatal parse error in pattern file '%s: "
"Unsupported pattern depth %d.\n" "Unsupported pattern depth %d.\n"
"GIMP Patterns must be GRAY or RGB."), "GIMP Patterns must be GRAY or RGB."),
filename, header.bytes); file_utils_filename_to_utf8 (filename), header.bytes);
goto error; goto error;
} }
@ -398,13 +401,14 @@ gimp_pattern_load (const gchar *filename,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in pattern file '%s': " _("Fatal parse error in pattern file '%s': "
"Could not read %d bytes: %s"), "Could not read %d bytes: %s"),
filename, bn_size, g_strerror (errno)); file_utils_filename_to_utf8 (filename), bn_size,
g_strerror (errno));
goto error; goto error;
} }
utf8 = gimp_any_to_utf8 (name, -1, utf8 = gimp_any_to_utf8 (name, -1,
_("Invalid UTF-8 string in pattern file '%s'."), _("Invalid UTF-8 string in pattern file '%s'."),
filename); file_utils_filename_to_utf8 (filename));
g_free (name); g_free (name);
name = utf8; name = utf8;
} }
@ -423,7 +427,8 @@ gimp_pattern_load (const gchar *filename,
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Fatal parse error in pattern file '%s': " _("Fatal parse error in pattern file '%s': "
"Could not read %d bytes: %s"), "Could not read %d bytes: %s"),
filename, header.width * header.height * header.bytes, file_utils_filename_to_utf8 (filename),
header.width * header.height * header.bytes,
g_strerror (errno)); g_strerror (errno));
goto error; goto error;
} }

View File

@ -43,6 +43,8 @@
#include "config/gimpconfig-utils.h" #include "config/gimpconfig-utils.h"
#include "config/gimprc.h" #include "config/gimprc.h"
#include "file/file-utils.h"
#include "widgets/gimppropwidgets.h" #include "widgets/gimppropwidgets.h"
#include "widgets/gimpwidgets-utils.h" #include "widgets/gimpwidgets-utils.h"
@ -846,7 +848,7 @@ user_install_dialog_run (const gchar *alternate_system_gimprc,
str = g_strdup_printf (_("For a proper GIMP installation, a folder named " str = g_strdup_printf (_("For a proper GIMP installation, a folder named "
"'<b>%s</b>' needs to be created."), "'<b>%s</b>' needs to be created."),
gimp_directory ()); file_utils_filename_to_utf8 (gimp_directory ()));
add_label (GTK_BOX (vbox), str); add_label (GTK_BOX (vbox), str);
g_free (str); g_free (str);
@ -880,7 +882,7 @@ user_install_dialog_run (const gchar *alternate_system_gimprc,
gtk_tree_store_append (tree, &iter, NULL); gtk_tree_store_append (tree, &iter, NULL);
gtk_tree_store_set (tree, &iter, gtk_tree_store_set (tree, &iter,
DIRENT_COLUMN, gimp_directory (), DIRENT_COLUMN, file_utils_filename_to_utf8 (gimp_directory ()),
PIXBUF_COLUMN, folder_pixbuf, PIXBUF_COLUMN, folder_pixbuf,
DESC_COLUMN, 0, DESC_COLUMN, 0,
-1); -1);
@ -1054,7 +1056,7 @@ user_install_run (void)
gtk_widget_show (log_view); gtk_widget_show (log_view);
g_snprintf (log_line, sizeof (log_line), _("Creating folder '%s'..."), g_snprintf (log_line, sizeof (log_line), _("Creating folder '%s'..."),
gimp_directory ()); file_utils_filename_to_utf8 (gimp_directory ()));
gtk_text_buffer_insert_at_cursor (log_buffer, log_line, -1); gtk_text_buffer_insert_at_cursor (log_buffer, log_line, -1);
while (gtk_events_pending ()) while (gtk_events_pending ())
@ -1068,7 +1070,7 @@ user_install_run (void)
g_set_error (&error, g_set_error (&error,
G_FILE_ERROR, g_file_error_from_errno (errno), G_FILE_ERROR, g_file_error_from_errno (errno),
_("Cannot create folder '%s': %s"), _("Cannot create folder '%s': %s"),
gimp_directory (), g_strerror (errno)); file_utils_filename_to_utf8 (gimp_directory ()), g_strerror (errno));
goto break_out_of_loop; goto break_out_of_loop;
} }
@ -1086,7 +1088,8 @@ user_install_run (void)
case TREE_ITEM_MKDIR: case TREE_ITEM_MKDIR:
g_snprintf (log_line, sizeof (log_line), g_snprintf (log_line, sizeof (log_line),
_("Creating folder '%s'..."), dest); _("Creating folder '%s'..."),
file_utils_filename_to_utf8 (dest));
gtk_text_buffer_insert_at_cursor (log_buffer, log_line, -1); gtk_text_buffer_insert_at_cursor (log_buffer, log_line, -1);
while (gtk_events_pending ()) while (gtk_events_pending ())
@ -1111,7 +1114,9 @@ user_install_run (void)
g_assert (! tree_items[i].directory); g_assert (! tree_items[i].directory);
g_snprintf (log_line, sizeof (log_line), g_snprintf (log_line, sizeof (log_line),
_("Copying file '%s' from '%s'..."), dest, source); _("Copying file '%s' from '%s'..."),
file_utils_filename_to_utf8 (dest),
file_utils_filename_to_utf8 (source));
gtk_text_buffer_insert_at_cursor (log_buffer, log_line, -1); gtk_text_buffer_insert_at_cursor (log_buffer, log_line, -1);
while (gtk_events_pending ()) while (gtk_events_pending ())

View File

@ -591,3 +591,30 @@ file_check_magic_list (GSList *magics_list,
return 0; return 0;
} }
gchar *
file_utils_filename_to_utf8 (const gchar *filename)
{
/* Simpleminded implementation, but at least allocates just one copy
* of each translation. Could check if already UTF-8, and if so
* return filename as is. Could perhaps (re)use a suitably large
* cyclic buffer, but then would have to verify that all calls
* really need the return value just for a "short" time.
*/
static GHashTable *ht = NULL;
gchar *filename_utf8;
if (ht == NULL)
ht = g_hash_table_new (g_str_hash, g_str_equal);
filename_utf8 = g_hash_table_lookup (ht, filename);
if (filename_utf8 == NULL)
{
filename_utf8 = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
g_hash_table_insert (ht, g_strdup (filename), filename_utf8);
}
return filename_utf8;
}

View File

@ -23,6 +23,8 @@
#include <stdio.h> #include <stdio.h>
#include "plug-in/plug-in-types.h"
gchar * file_utils_filename_to_uri (GSList *procs, gchar * file_utils_filename_to_uri (GSList *procs,
const gchar *filename, const gchar *filename,
GError **error); GError **error);
@ -31,5 +33,6 @@ PlugInProcDef * file_utils_find_proc (GSList *procs,
gchar * file_utils_uri_to_utf8_basename (const gchar *uri); gchar * file_utils_uri_to_utf8_basename (const gchar *uri);
gchar * file_utils_uri_to_utf8_filename (const gchar *uri); gchar * file_utils_uri_to_utf8_filename (const gchar *uri);
gchar * file_utils_filename_to_utf8 (const gchar *filename);
#endif /* __FILE_UTILS_H__ */ #endif /* __FILE_UTILS_H__ */

View File

@ -33,6 +33,8 @@
#include "core/gimp.h" #include "core/gimp.h"
#include "file/file-utils.h"
#include "themes.h" #include "themes.h"
#include "gimp-intl.h" #include "gimp-intl.h"
@ -228,14 +230,15 @@ themes_apply_theme (Gimp *gimp,
themerc = gimp_personal_rc_file ("themerc"); themerc = gimp_personal_rc_file ("themerc");
if (gimp->be_verbose) if (gimp->be_verbose)
g_print (_("Writing '%s'\n"), themerc); g_print (_("Writing '%s'\n"),
file_utils_filename_to_utf8 (themerc));
file = fopen (themerc, "w"); file = fopen (themerc, "w");
if (! file) if (! file)
{ {
g_message (_("Could not open '%s' for writing: %s"), g_message (_("Could not open '%s' for writing: %s"),
themerc, g_strerror (errno)); file_utils_filename_to_utf8 (themerc), g_strerror (errno));
goto cleanup; goto cleanup;
} }
@ -281,7 +284,8 @@ themes_directories_foreach (const GimpDatafileData *file_data,
if (gimp->be_verbose) if (gimp->be_verbose)
g_print (_("Adding theme '%s' (%s)\n"), g_print (_("Adding theme '%s' (%s)\n"),
file_data->basename, file_data->filename); file_utils_filename_to_utf8 (file_data->basename),
file_utils_filename_to_utf8 (file_data->filename));
g_hash_table_insert (themes_hash, g_hash_table_insert (themes_hash,
g_strdup (file_data->basename), g_strdup (file_data->basename),

View File

@ -43,6 +43,8 @@
#include "config/gimpconfig-utils.h" #include "config/gimpconfig-utils.h"
#include "config/gimprc.h" #include "config/gimprc.h"
#include "file/file-utils.h"
#include "widgets/gimppropwidgets.h" #include "widgets/gimppropwidgets.h"
#include "widgets/gimpwidgets-utils.h" #include "widgets/gimpwidgets-utils.h"
@ -846,7 +848,7 @@ user_install_dialog_run (const gchar *alternate_system_gimprc,
str = g_strdup_printf (_("For a proper GIMP installation, a folder named " str = g_strdup_printf (_("For a proper GIMP installation, a folder named "
"'<b>%s</b>' needs to be created."), "'<b>%s</b>' needs to be created."),
gimp_directory ()); file_utils_filename_to_utf8 (gimp_directory ()));
add_label (GTK_BOX (vbox), str); add_label (GTK_BOX (vbox), str);
g_free (str); g_free (str);
@ -880,7 +882,7 @@ user_install_dialog_run (const gchar *alternate_system_gimprc,
gtk_tree_store_append (tree, &iter, NULL); gtk_tree_store_append (tree, &iter, NULL);
gtk_tree_store_set (tree, &iter, gtk_tree_store_set (tree, &iter,
DIRENT_COLUMN, gimp_directory (), DIRENT_COLUMN, file_utils_filename_to_utf8 (gimp_directory ()),
PIXBUF_COLUMN, folder_pixbuf, PIXBUF_COLUMN, folder_pixbuf,
DESC_COLUMN, 0, DESC_COLUMN, 0,
-1); -1);
@ -1054,7 +1056,7 @@ user_install_run (void)
gtk_widget_show (log_view); gtk_widget_show (log_view);
g_snprintf (log_line, sizeof (log_line), _("Creating folder '%s'..."), g_snprintf (log_line, sizeof (log_line), _("Creating folder '%s'..."),
gimp_directory ()); file_utils_filename_to_utf8 (gimp_directory ()));
gtk_text_buffer_insert_at_cursor (log_buffer, log_line, -1); gtk_text_buffer_insert_at_cursor (log_buffer, log_line, -1);
while (gtk_events_pending ()) while (gtk_events_pending ())
@ -1068,7 +1070,7 @@ user_install_run (void)
g_set_error (&error, g_set_error (&error,
G_FILE_ERROR, g_file_error_from_errno (errno), G_FILE_ERROR, g_file_error_from_errno (errno),
_("Cannot create folder '%s': %s"), _("Cannot create folder '%s': %s"),
gimp_directory (), g_strerror (errno)); file_utils_filename_to_utf8 (gimp_directory ()), g_strerror (errno));
goto break_out_of_loop; goto break_out_of_loop;
} }
@ -1086,7 +1088,8 @@ user_install_run (void)
case TREE_ITEM_MKDIR: case TREE_ITEM_MKDIR:
g_snprintf (log_line, sizeof (log_line), g_snprintf (log_line, sizeof (log_line),
_("Creating folder '%s'..."), dest); _("Creating folder '%s'..."),
file_utils_filename_to_utf8 (dest));
gtk_text_buffer_insert_at_cursor (log_buffer, log_line, -1); gtk_text_buffer_insert_at_cursor (log_buffer, log_line, -1);
while (gtk_events_pending ()) while (gtk_events_pending ())
@ -1111,7 +1114,9 @@ user_install_run (void)
g_assert (! tree_items[i].directory); g_assert (! tree_items[i].directory);
g_snprintf (log_line, sizeof (log_line), g_snprintf (log_line, sizeof (log_line),
_("Copying file '%s' from '%s'..."), dest, source); _("Copying file '%s' from '%s'..."),
file_utils_filename_to_utf8 (dest),
file_utils_filename_to_utf8 (source));
gtk_text_buffer_insert_at_cursor (log_buffer, log_line, -1); gtk_text_buffer_insert_at_cursor (log_buffer, log_line, -1);
while (gtk_events_pending ()) while (gtk_events_pending ())

View File

@ -29,6 +29,8 @@
#include "libgimpbase/gimpbase.h" #include "libgimpbase/gimpbase.h"
#include "file/file-utils.h"
#include "core-types.h" #include "core-types.h"
#include "gimpenvirontable.h" #include "gimpenvirontable.h"
@ -283,7 +285,7 @@ gimp_environ_table_load_env_file (const GimpDatafileData *file_data,
if (name[0] == '\0') if (name[0] == '\0')
{ {
g_message (_("Empty variable name in environment file %s"), g_message (_("Empty variable name in environment file %s"),
file_data->filename); file_utils_filename_to_utf8 (file_data->filename));
continue; continue;
} }
@ -301,7 +303,7 @@ gimp_environ_table_load_env_file (const GimpDatafileData *file_data,
if (! gimp_environ_table_legal_name (name)) if (! gimp_environ_table_legal_name (name))
{ {
g_message (_("Illegal variable name in environment file %s: %s"), g_message (_("Illegal variable name in environment file %s: %s"),
file_data->filename, name); file_utils_filename_to_utf8 (file_data->filename), name);
continue; continue;
} }

View File

@ -34,6 +34,8 @@
#include "core/gimp.h" #include "core/gimp.h"
#include "core/gimpdrawable.h" #include "core/gimpdrawable.h"
#include "file/file-utils.h"
#include "plug-in.h" #include "plug-in.h"
#include "plug-ins.h" #include "plug-ins.h"
#include "plug-in-def.h" #include "plug-in-def.h"
@ -94,7 +96,8 @@ plug_in_handle_message (PlugIn *plug_in,
case GP_CONFIG: case GP_CONFIG:
g_message ("Plug-In \"%s\"\n(%s)\n\n" g_message ("Plug-In \"%s\"\n(%s)\n\n"
"sent a CONFIG message (should not happen)", "sent a CONFIG message (should not happen)",
plug_in->name, plug_in->prog); file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog));
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
break; break;
@ -105,14 +108,16 @@ plug_in_handle_message (PlugIn *plug_in,
case GP_TILE_ACK: case GP_TILE_ACK:
g_message ("Plug-In \"%s\"\n(%s)\n\n" g_message ("Plug-In \"%s\"\n(%s)\n\n"
"sent a TILE_ACK message (should not happen)", "sent a TILE_ACK message (should not happen)",
plug_in->name, plug_in->prog); file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog));
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
break; break;
case GP_TILE_DATA: case GP_TILE_DATA:
g_message ("Plug-In \"%s\"\n(%s)\n\n" g_message ("Plug-In \"%s\"\n(%s)\n\n"
"sent a TILE_DATA message (should not happen)", "sent a TILE_DATA message (should not happen)",
plug_in->name, plug_in->prog); file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog));
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
break; break;
@ -127,7 +132,8 @@ plug_in_handle_message (PlugIn *plug_in,
case GP_TEMP_PROC_RUN: case GP_TEMP_PROC_RUN:
g_message ("Plug-In \"%s\"\n(%s)\n\n" g_message ("Plug-In \"%s\"\n(%s)\n\n"
"sent a TEMP_PROC_RUN message (should not happen)", "sent a TEMP_PROC_RUN message (should not happen)",
plug_in->name, plug_in->prog); file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog));
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
break; break;
@ -137,7 +143,8 @@ plug_in_handle_message (PlugIn *plug_in,
#else #else
g_message ("Plug-In \"%s\"\n(%s)\n\n" g_message ("Plug-In \"%s\"\n(%s)\n\n"
"sent a TEMP_PROC_RETURN message (should not happen)", "sent a TEMP_PROC_RETURN message (should not happen)",
plug_in->name, plug_in->prog); file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog));
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
#endif #endif
break; break;
@ -226,7 +233,8 @@ plug_in_handle_tile_req (PlugIn *plug_in,
{ {
g_message ("Plug-In \"%s\"\n(%s)\n\n" g_message ("Plug-In \"%s\"\n(%s)\n\n"
"requested invalid drawable (killing)", "requested invalid drawable (killing)",
plug_in->name, plug_in->prog); file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog));
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
return; return;
} }
@ -242,7 +250,8 @@ plug_in_handle_tile_req (PlugIn *plug_in,
{ {
g_message ("Plug-In \"%s\"\n(%s)\n\n" g_message ("Plug-In \"%s\"\n(%s)\n\n"
"requested invalid tile (killing)", "requested invalid tile (killing)",
plug_in->name, plug_in->prog); file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog));
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
return; return;
} }
@ -277,7 +286,8 @@ plug_in_handle_tile_req (PlugIn *plug_in,
{ {
g_message ("Plug-In \"%s\"\n(%s)\n\n" g_message ("Plug-In \"%s\"\n(%s)\n\n"
"requested invalid drawable (killing)", "requested invalid drawable (killing)",
plug_in->name, plug_in->prog); file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog));
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
return; return;
} }
@ -293,7 +303,8 @@ plug_in_handle_tile_req (PlugIn *plug_in,
{ {
g_message ("Plug-In \"%s\"\n(%s)\n\n" g_message ("Plug-In \"%s\"\n(%s)\n\n"
"requested invalid tile (killing)", "requested invalid tile (killing)",
plug_in->name, plug_in->prog); file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog));
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
return; return;
} }
@ -365,7 +376,8 @@ plug_in_handle_proc_run (PlugIn *plug_in,
g_message ("WARNING: Plug-In \"%s\"\n(%s)\n\n" g_message ("WARNING: Plug-In \"%s\"\n(%s)\n\n"
"called deprecated procedure '%s'.\n" "called deprecated procedure '%s'.\n"
"It should call '%s' instead!", "It should call '%s' instead!",
plug_in->name, plug_in->prog, file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog),
proc_run->name, proc_name); proc_run->name, proc_name);
} }
} }
@ -506,7 +518,8 @@ plug_in_handle_temp_proc_return (PlugIn *plug_in,
g_message ("Plug-In \"%s\"\n(%s)\n\n" g_message ("Plug-In \"%s\"\n(%s)\n\n"
"sent a TEMP_PROC_RETURN message while not running " "sent a TEMP_PROC_RETURN message while not running "
"a temp proc (should not happen)", "a temp proc (should not happen)",
plug_in->name, plug_in->prog); file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog));
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
} }
} }
@ -540,7 +553,8 @@ plug_in_handle_proc_install (PlugIn *plug_in,
"which does not take the standard <Toolbox> Plug-In " "which does not take the standard <Toolbox> Plug-In "
"args.\n" "args.\n"
"(INT32)", "(INT32)",
plug_in->name, plug_in->prog, file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog),
proc_install->name); proc_install->name);
return; return;
} }
@ -557,7 +571,8 @@ plug_in_handle_proc_install (PlugIn *plug_in,
"which does not take the standard <Image> Plug-In " "which does not take the standard <Image> Plug-In "
"args.\n" "args.\n"
"(INT32, IMAGE, DRAWABLE)", "(INT32, IMAGE, DRAWABLE)",
plug_in->name, plug_in->prog, file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog),
proc_install->name); proc_install->name);
return; return;
} }
@ -574,7 +589,8 @@ plug_in_handle_proc_install (PlugIn *plug_in,
"which does not take the standard <Load> Plug-In " "which does not take the standard <Load> Plug-In "
"args.\n" "args.\n"
"(INT32, STRING, STRING)", "(INT32, STRING, STRING)",
plug_in->name, plug_in->prog, file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog),
proc_install->name); proc_install->name);
return; return;
} }
@ -593,7 +609,8 @@ plug_in_handle_proc_install (PlugIn *plug_in,
"which does not take the standard <Save> Plug-In " "which does not take the standard <Save> Plug-In "
"args.\n" "args.\n"
"(INT32, IMAGE, DRAWABLE, STRING, STRING)", "(INT32, IMAGE, DRAWABLE, STRING, STRING)",
plug_in->name, plug_in->prog, file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog),
proc_install->name); proc_install->name);
return; return;
} }
@ -605,7 +622,8 @@ plug_in_handle_proc_install (PlugIn *plug_in,
"in an invalid menu location.\n" "in an invalid menu location.\n"
"Use either \"<Toolbox>\", \"<Image>\", " "Use either \"<Toolbox>\", \"<Image>\", "
"\"<Load>\", or \"<Save>\".", "\"<Load>\", or \"<Save>\".",
plug_in->name, plug_in->prog, file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog),
proc_install->name); proc_install->name);
return; return;
} }
@ -626,7 +644,8 @@ plug_in_handle_proc_install (PlugIn *plug_in,
"attempted to install procedure \"%s\" " "attempted to install procedure \"%s\" "
"which fails to comply with the array parameter " "which fails to comply with the array parameter "
"passing standard. Argument %d is noncompliant.", "passing standard. Argument %d is noncompliant.",
plug_in->name, plug_in->prog, file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog),
proc_install->name, i); proc_install->name, i);
return; return;
} }
@ -671,7 +690,8 @@ plug_in_handle_proc_install (PlugIn *plug_in,
{ {
g_message ("Plug-In \"%s\"\n(%s)\n\n" g_message ("Plug-In \"%s\"\n(%s)\n\n"
"attempted to install a procedure with invalid UTF-8 strings.", "attempted to install a procedure with invalid UTF-8 strings.",
plug_in->name, plug_in->prog); file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog));
return; return;
} }
@ -820,7 +840,8 @@ plug_in_handle_extension_ack (PlugIn *plug_in)
g_message ("Plug-In \"%s\"\n(%s)\n\n" g_message ("Plug-In \"%s\"\n(%s)\n\n"
"sent an EXTENSION_ACK message while not being started " "sent an EXTENSION_ACK message while not being started "
"as extension (should not happen)", "as extension (should not happen)",
plug_in->name, plug_in->prog); file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog));
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
} }
} }
@ -837,7 +858,8 @@ plug_in_handle_has_init (PlugIn *plug_in)
g_message ("Plug-In \"%s\"\n(%s)\n\n" g_message ("Plug-In \"%s\"\n(%s)\n\n"
"sent an HAS_INIT message while not in query() " "sent an HAS_INIT message while not in query() "
"(should not happen)", "(should not happen)",
plug_in->name, plug_in->prog); file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog));
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
} }
} }

View File

@ -74,6 +74,8 @@
#include "core/gimp.h" #include "core/gimp.h"
#include "core/gimpenvirontable.h" #include "core/gimpenvirontable.h"
#include "file/file-utils.h"
#include "plug-in.h" #include "plug-in.h"
#include "plug-ins.h" #include "plug-ins.h"
#include "plug-in-debug.h" #include "plug-in-debug.h"
@ -351,7 +353,8 @@ plug_in_open (PlugIn *plug_in)
if ((pipe (my_read) == -1) || (pipe (my_write) == -1)) if ((pipe (my_read) == -1) || (pipe (my_write) == -1))
{ {
g_message ("Unable to run Plug-In \"%s\"\n(%s)\n\npipe() failed: %s", g_message ("Unable to run Plug-In \"%s\"\n(%s)\n\npipe() failed: %s",
plug_in->name, plug_in->prog, file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog),
g_strerror (errno)); g_strerror (errno));
return FALSE; return FALSE;
} }
@ -449,7 +452,8 @@ plug_in_open (PlugIn *plug_in)
&error)) &error))
{ {
g_message ("Unable to run Plug-In \"%s\"\n(%s)\n\n%s", g_message ("Unable to run Plug-In \"%s\"\n(%s)\n\n%s",
plug_in->name, plug_in->prog, file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog),
error->message); error->message);
g_error_free (error); g_error_free (error);
goto cleanup; goto cleanup;
@ -549,7 +553,8 @@ plug_in_close (PlugIn *plug_in,
} }
if (STILL_ACTIVE == dwExitCode) if (STILL_ACTIVE == dwExitCode)
{ {
g_warning ("Terminating %s ...", plug_in->prog); g_warning ("Terminating %s ...",
file_utils_filename_to_utf8 (plug_in->prog));
TerminateProcess ((HANDLE) plug_in->pid, 0); TerminateProcess ((HANDLE) plug_in->pid, 0);
} }
} }
@ -685,7 +690,8 @@ plug_in_recv_message (GIOChannel *channel,
"The dying Plug-In may have messed up GIMP's internal state. " "The dying Plug-In may have messed up GIMP's internal state. "
"You may want to save your images and restart GIMP " "You may want to save your images and restart GIMP "
"to be on the safe side."), "to be on the safe side."),
plug_in->name, plug_in->prog); file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog));
if (! plug_in->open) if (! plug_in->open)
plug_in_unref (plug_in); plug_in_unref (plug_in);
@ -764,13 +770,14 @@ plug_in_flush (GIOChannel *channel,
if (error) if (error)
{ {
g_warning ("%s: plug_in_flush(): error: %s", g_warning ("%s: plug_in_flush(): error: %s",
g_get_prgname (), error->message); file_utils_filename_to_utf8 (g_get_prgname ()),
error->message);
g_error_free (error); g_error_free (error);
} }
else else
{ {
g_warning ("%s: plug_in_flush(): error", g_warning ("%s: plug_in_flush(): error",
g_get_prgname ()); file_utils_filename_to_utf8 (g_get_prgname ()));
} }
return FALSE; return FALSE;

View File

@ -36,6 +36,8 @@
#include "core/gimpdrawable.h" #include "core/gimpdrawable.h"
#include "core/gimpimage.h" #include "core/gimpimage.h"
#include "file/file-utils.h"
#include "plug-in.h" #include "plug-in.h"
#include "plug-ins.h" #include "plug-ins.h"
#include "plug-in-def.h" #include "plug-in-def.h"
@ -131,7 +133,8 @@ plug_ins_init (Gimp *gimp,
filename = gimp_personal_rc_file ("pluginrc"); filename = gimp_personal_rc_file ("pluginrc");
} }
(* status_callback) (_("Resource configuration"), filename, -1); (* status_callback) (_("Resource configuration"),
file_utils_filename_to_utf8 (filename), -1);
if (! plug_in_rc_parse (gimp, filename, &error)) if (! plug_in_rc_parse (gimp, filename, &error))
{ {
@ -152,7 +155,8 @@ plug_ins_init (Gimp *gimp,
plug_in_def = tmp->data; plug_in_def = tmp->data;
basename = g_path_get_basename (plug_in_def->prog); basename = g_path_get_basename (plug_in_def->prog);
(* status_callback) (NULL, basename, nth / n_plugins); (* status_callback) (NULL, file_utils_filename_to_utf8 (basename),
nth / n_plugins);
g_free (basename); g_free (basename);
if (plug_in_def->needs_query) if (plug_in_def->needs_query)
@ -160,7 +164,8 @@ plug_ins_init (Gimp *gimp,
gimp->write_pluginrc = TRUE; gimp->write_pluginrc = TRUE;
if (gimp->be_verbose) if (gimp->be_verbose)
g_print (_("Querying plug-in: '%s'\n"), plug_in_def->prog); g_print (_("Querying plug-in: '%s'\n"),
file_utils_filename_to_utf8 (plug_in_def->prog));
plug_in_call_query (gimp, plug_in_def); plug_in_call_query (gimp, plug_in_def);
} }
@ -215,7 +220,8 @@ plug_ins_init (Gimp *gimp,
GError *error = NULL; GError *error = NULL;
if (gimp->be_verbose) if (gimp->be_verbose)
g_print (_("Writing '%s'\n"), filename); g_print (_("Writing '%s'\n"),
file_utils_filename_to_utf8 (filename));
if (! plug_in_rc_write (gimp->plug_in_defs, filename, &error)) if (! plug_in_rc_write (gimp->plug_in_defs, filename, &error))
{ {
@ -294,7 +300,8 @@ plug_ins_init (Gimp *gimp,
plug_in_def = tmp->data; plug_in_def = tmp->data;
basename = g_path_get_basename (plug_in_def->prog); basename = g_path_get_basename (plug_in_def->prog);
(* status_callback) (NULL, basename, nth / n_plugins); (* status_callback) (NULL, file_utils_filename_to_utf8 (basename),
nth / n_plugins);
g_free (basename); g_free (basename);
if (plug_in_def->has_init) if (plug_in_def->has_init)
@ -866,7 +873,7 @@ plug_ins_init_file (const GimpDatafileData *file_data,
if (g_ascii_strcasecmp (file_data->basename, plug_in_name) == 0) if (g_ascii_strcasecmp (file_data->basename, plug_in_name) == 0)
{ {
g_printerr ("skipping duplicate plug-in: '%s'\n", g_printerr ("skipping duplicate plug-in: '%s'\n",
file_data->filename); file_utils_filename_to_utf8 (file_data->filename));
g_free (plug_in_name); g_free (plug_in_name);

View File

@ -34,6 +34,8 @@
#include "core/gimp.h" #include "core/gimp.h"
#include "core/gimpdrawable.h" #include "core/gimpdrawable.h"
#include "file/file-utils.h"
#include "plug-in.h" #include "plug-in.h"
#include "plug-ins.h" #include "plug-ins.h"
#include "plug-in-def.h" #include "plug-in-def.h"
@ -94,7 +96,8 @@ plug_in_handle_message (PlugIn *plug_in,
case GP_CONFIG: case GP_CONFIG:
g_message ("Plug-In \"%s\"\n(%s)\n\n" g_message ("Plug-In \"%s\"\n(%s)\n\n"
"sent a CONFIG message (should not happen)", "sent a CONFIG message (should not happen)",
plug_in->name, plug_in->prog); file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog));
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
break; break;
@ -105,14 +108,16 @@ plug_in_handle_message (PlugIn *plug_in,
case GP_TILE_ACK: case GP_TILE_ACK:
g_message ("Plug-In \"%s\"\n(%s)\n\n" g_message ("Plug-In \"%s\"\n(%s)\n\n"
"sent a TILE_ACK message (should not happen)", "sent a TILE_ACK message (should not happen)",
plug_in->name, plug_in->prog); file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog));
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
break; break;
case GP_TILE_DATA: case GP_TILE_DATA:
g_message ("Plug-In \"%s\"\n(%s)\n\n" g_message ("Plug-In \"%s\"\n(%s)\n\n"
"sent a TILE_DATA message (should not happen)", "sent a TILE_DATA message (should not happen)",
plug_in->name, plug_in->prog); file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog));
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
break; break;
@ -127,7 +132,8 @@ plug_in_handle_message (PlugIn *plug_in,
case GP_TEMP_PROC_RUN: case GP_TEMP_PROC_RUN:
g_message ("Plug-In \"%s\"\n(%s)\n\n" g_message ("Plug-In \"%s\"\n(%s)\n\n"
"sent a TEMP_PROC_RUN message (should not happen)", "sent a TEMP_PROC_RUN message (should not happen)",
plug_in->name, plug_in->prog); file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog));
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
break; break;
@ -137,7 +143,8 @@ plug_in_handle_message (PlugIn *plug_in,
#else #else
g_message ("Plug-In \"%s\"\n(%s)\n\n" g_message ("Plug-In \"%s\"\n(%s)\n\n"
"sent a TEMP_PROC_RETURN message (should not happen)", "sent a TEMP_PROC_RETURN message (should not happen)",
plug_in->name, plug_in->prog); file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog));
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
#endif #endif
break; break;
@ -226,7 +233,8 @@ plug_in_handle_tile_req (PlugIn *plug_in,
{ {
g_message ("Plug-In \"%s\"\n(%s)\n\n" g_message ("Plug-In \"%s\"\n(%s)\n\n"
"requested invalid drawable (killing)", "requested invalid drawable (killing)",
plug_in->name, plug_in->prog); file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog));
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
return; return;
} }
@ -242,7 +250,8 @@ plug_in_handle_tile_req (PlugIn *plug_in,
{ {
g_message ("Plug-In \"%s\"\n(%s)\n\n" g_message ("Plug-In \"%s\"\n(%s)\n\n"
"requested invalid tile (killing)", "requested invalid tile (killing)",
plug_in->name, plug_in->prog); file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog));
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
return; return;
} }
@ -277,7 +286,8 @@ plug_in_handle_tile_req (PlugIn *plug_in,
{ {
g_message ("Plug-In \"%s\"\n(%s)\n\n" g_message ("Plug-In \"%s\"\n(%s)\n\n"
"requested invalid drawable (killing)", "requested invalid drawable (killing)",
plug_in->name, plug_in->prog); file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog));
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
return; return;
} }
@ -293,7 +303,8 @@ plug_in_handle_tile_req (PlugIn *plug_in,
{ {
g_message ("Plug-In \"%s\"\n(%s)\n\n" g_message ("Plug-In \"%s\"\n(%s)\n\n"
"requested invalid tile (killing)", "requested invalid tile (killing)",
plug_in->name, plug_in->prog); file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog));
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
return; return;
} }
@ -365,7 +376,8 @@ plug_in_handle_proc_run (PlugIn *plug_in,
g_message ("WARNING: Plug-In \"%s\"\n(%s)\n\n" g_message ("WARNING: Plug-In \"%s\"\n(%s)\n\n"
"called deprecated procedure '%s'.\n" "called deprecated procedure '%s'.\n"
"It should call '%s' instead!", "It should call '%s' instead!",
plug_in->name, plug_in->prog, file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog),
proc_run->name, proc_name); proc_run->name, proc_name);
} }
} }
@ -506,7 +518,8 @@ plug_in_handle_temp_proc_return (PlugIn *plug_in,
g_message ("Plug-In \"%s\"\n(%s)\n\n" g_message ("Plug-In \"%s\"\n(%s)\n\n"
"sent a TEMP_PROC_RETURN message while not running " "sent a TEMP_PROC_RETURN message while not running "
"a temp proc (should not happen)", "a temp proc (should not happen)",
plug_in->name, plug_in->prog); file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog));
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
} }
} }
@ -540,7 +553,8 @@ plug_in_handle_proc_install (PlugIn *plug_in,
"which does not take the standard <Toolbox> Plug-In " "which does not take the standard <Toolbox> Plug-In "
"args.\n" "args.\n"
"(INT32)", "(INT32)",
plug_in->name, plug_in->prog, file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog),
proc_install->name); proc_install->name);
return; return;
} }
@ -557,7 +571,8 @@ plug_in_handle_proc_install (PlugIn *plug_in,
"which does not take the standard <Image> Plug-In " "which does not take the standard <Image> Plug-In "
"args.\n" "args.\n"
"(INT32, IMAGE, DRAWABLE)", "(INT32, IMAGE, DRAWABLE)",
plug_in->name, plug_in->prog, file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog),
proc_install->name); proc_install->name);
return; return;
} }
@ -574,7 +589,8 @@ plug_in_handle_proc_install (PlugIn *plug_in,
"which does not take the standard <Load> Plug-In " "which does not take the standard <Load> Plug-In "
"args.\n" "args.\n"
"(INT32, STRING, STRING)", "(INT32, STRING, STRING)",
plug_in->name, plug_in->prog, file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog),
proc_install->name); proc_install->name);
return; return;
} }
@ -593,7 +609,8 @@ plug_in_handle_proc_install (PlugIn *plug_in,
"which does not take the standard <Save> Plug-In " "which does not take the standard <Save> Plug-In "
"args.\n" "args.\n"
"(INT32, IMAGE, DRAWABLE, STRING, STRING)", "(INT32, IMAGE, DRAWABLE, STRING, STRING)",
plug_in->name, plug_in->prog, file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog),
proc_install->name); proc_install->name);
return; return;
} }
@ -605,7 +622,8 @@ plug_in_handle_proc_install (PlugIn *plug_in,
"in an invalid menu location.\n" "in an invalid menu location.\n"
"Use either \"<Toolbox>\", \"<Image>\", " "Use either \"<Toolbox>\", \"<Image>\", "
"\"<Load>\", or \"<Save>\".", "\"<Load>\", or \"<Save>\".",
plug_in->name, plug_in->prog, file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog),
proc_install->name); proc_install->name);
return; return;
} }
@ -626,7 +644,8 @@ plug_in_handle_proc_install (PlugIn *plug_in,
"attempted to install procedure \"%s\" " "attempted to install procedure \"%s\" "
"which fails to comply with the array parameter " "which fails to comply with the array parameter "
"passing standard. Argument %d is noncompliant.", "passing standard. Argument %d is noncompliant.",
plug_in->name, plug_in->prog, file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog),
proc_install->name, i); proc_install->name, i);
return; return;
} }
@ -671,7 +690,8 @@ plug_in_handle_proc_install (PlugIn *plug_in,
{ {
g_message ("Plug-In \"%s\"\n(%s)\n\n" g_message ("Plug-In \"%s\"\n(%s)\n\n"
"attempted to install a procedure with invalid UTF-8 strings.", "attempted to install a procedure with invalid UTF-8 strings.",
plug_in->name, plug_in->prog); file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog));
return; return;
} }
@ -820,7 +840,8 @@ plug_in_handle_extension_ack (PlugIn *plug_in)
g_message ("Plug-In \"%s\"\n(%s)\n\n" g_message ("Plug-In \"%s\"\n(%s)\n\n"
"sent an EXTENSION_ACK message while not being started " "sent an EXTENSION_ACK message while not being started "
"as extension (should not happen)", "as extension (should not happen)",
plug_in->name, plug_in->prog); file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog));
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
} }
} }
@ -837,7 +858,8 @@ plug_in_handle_has_init (PlugIn *plug_in)
g_message ("Plug-In \"%s\"\n(%s)\n\n" g_message ("Plug-In \"%s\"\n(%s)\n\n"
"sent an HAS_INIT message while not in query() " "sent an HAS_INIT message while not in query() "
"(should not happen)", "(should not happen)",
plug_in->name, plug_in->prog); file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog));
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
} }
} }

View File

@ -34,6 +34,8 @@
#include "core/gimp.h" #include "core/gimp.h"
#include "file/file-utils.h"
#include "plug-ins.h" #include "plug-ins.h"
#include "plug-in-def.h" #include "plug-in-def.h"
#include "plug-in-proc.h" #include "plug-in-proc.h"
@ -152,7 +154,8 @@ plug_in_rc_parse (Gimp *gimp,
{ {
g_set_error (error, g_set_error (error,
GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_VERSION, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_VERSION,
_("Skipping '%s': wrong GIMP protocol version."), filename); _("Skipping '%s': wrong GIMP protocol version."),
file_utils_filename_to_utf8 (filename));
} }
else if (token != G_TOKEN_LEFT_PAREN) else if (token != G_TOKEN_LEFT_PAREN)
{ {

View File

@ -74,6 +74,8 @@
#include "core/gimp.h" #include "core/gimp.h"
#include "core/gimpenvirontable.h" #include "core/gimpenvirontable.h"
#include "file/file-utils.h"
#include "plug-in.h" #include "plug-in.h"
#include "plug-ins.h" #include "plug-ins.h"
#include "plug-in-debug.h" #include "plug-in-debug.h"
@ -351,7 +353,8 @@ plug_in_open (PlugIn *plug_in)
if ((pipe (my_read) == -1) || (pipe (my_write) == -1)) if ((pipe (my_read) == -1) || (pipe (my_write) == -1))
{ {
g_message ("Unable to run Plug-In \"%s\"\n(%s)\n\npipe() failed: %s", g_message ("Unable to run Plug-In \"%s\"\n(%s)\n\npipe() failed: %s",
plug_in->name, plug_in->prog, file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog),
g_strerror (errno)); g_strerror (errno));
return FALSE; return FALSE;
} }
@ -449,7 +452,8 @@ plug_in_open (PlugIn *plug_in)
&error)) &error))
{ {
g_message ("Unable to run Plug-In \"%s\"\n(%s)\n\n%s", g_message ("Unable to run Plug-In \"%s\"\n(%s)\n\n%s",
plug_in->name, plug_in->prog, file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog),
error->message); error->message);
g_error_free (error); g_error_free (error);
goto cleanup; goto cleanup;
@ -549,7 +553,8 @@ plug_in_close (PlugIn *plug_in,
} }
if (STILL_ACTIVE == dwExitCode) if (STILL_ACTIVE == dwExitCode)
{ {
g_warning ("Terminating %s ...", plug_in->prog); g_warning ("Terminating %s ...",
file_utils_filename_to_utf8 (plug_in->prog));
TerminateProcess ((HANDLE) plug_in->pid, 0); TerminateProcess ((HANDLE) plug_in->pid, 0);
} }
} }
@ -685,7 +690,8 @@ plug_in_recv_message (GIOChannel *channel,
"The dying Plug-In may have messed up GIMP's internal state. " "The dying Plug-In may have messed up GIMP's internal state. "
"You may want to save your images and restart GIMP " "You may want to save your images and restart GIMP "
"to be on the safe side."), "to be on the safe side."),
plug_in->name, plug_in->prog); file_utils_filename_to_utf8 (plug_in->name),
file_utils_filename_to_utf8 (plug_in->prog));
if (! plug_in->open) if (! plug_in->open)
plug_in_unref (plug_in); plug_in_unref (plug_in);
@ -764,13 +770,14 @@ plug_in_flush (GIOChannel *channel,
if (error) if (error)
{ {
g_warning ("%s: plug_in_flush(): error: %s", g_warning ("%s: plug_in_flush(): error: %s",
g_get_prgname (), error->message); file_utils_filename_to_utf8 (g_get_prgname ()),
error->message);
g_error_free (error); g_error_free (error);
} }
else else
{ {
g_warning ("%s: plug_in_flush(): error", g_warning ("%s: plug_in_flush(): error",
g_get_prgname ()); file_utils_filename_to_utf8 (g_get_prgname ()));
} }
return FALSE; return FALSE;

View File

@ -36,6 +36,8 @@
#include "core/gimpdrawable.h" #include "core/gimpdrawable.h"
#include "core/gimpimage.h" #include "core/gimpimage.h"
#include "file/file-utils.h"
#include "plug-in.h" #include "plug-in.h"
#include "plug-ins.h" #include "plug-ins.h"
#include "plug-in-def.h" #include "plug-in-def.h"
@ -131,7 +133,8 @@ plug_ins_init (Gimp *gimp,
filename = gimp_personal_rc_file ("pluginrc"); filename = gimp_personal_rc_file ("pluginrc");
} }
(* status_callback) (_("Resource configuration"), filename, -1); (* status_callback) (_("Resource configuration"),
file_utils_filename_to_utf8 (filename), -1);
if (! plug_in_rc_parse (gimp, filename, &error)) if (! plug_in_rc_parse (gimp, filename, &error))
{ {
@ -152,7 +155,8 @@ plug_ins_init (Gimp *gimp,
plug_in_def = tmp->data; plug_in_def = tmp->data;
basename = g_path_get_basename (plug_in_def->prog); basename = g_path_get_basename (plug_in_def->prog);
(* status_callback) (NULL, basename, nth / n_plugins); (* status_callback) (NULL, file_utils_filename_to_utf8 (basename),
nth / n_plugins);
g_free (basename); g_free (basename);
if (plug_in_def->needs_query) if (plug_in_def->needs_query)
@ -160,7 +164,8 @@ plug_ins_init (Gimp *gimp,
gimp->write_pluginrc = TRUE; gimp->write_pluginrc = TRUE;
if (gimp->be_verbose) if (gimp->be_verbose)
g_print (_("Querying plug-in: '%s'\n"), plug_in_def->prog); g_print (_("Querying plug-in: '%s'\n"),
file_utils_filename_to_utf8 (plug_in_def->prog));
plug_in_call_query (gimp, plug_in_def); plug_in_call_query (gimp, plug_in_def);
} }
@ -215,7 +220,8 @@ plug_ins_init (Gimp *gimp,
GError *error = NULL; GError *error = NULL;
if (gimp->be_verbose) if (gimp->be_verbose)
g_print (_("Writing '%s'\n"), filename); g_print (_("Writing '%s'\n"),
file_utils_filename_to_utf8 (filename));
if (! plug_in_rc_write (gimp->plug_in_defs, filename, &error)) if (! plug_in_rc_write (gimp->plug_in_defs, filename, &error))
{ {
@ -294,7 +300,8 @@ plug_ins_init (Gimp *gimp,
plug_in_def = tmp->data; plug_in_def = tmp->data;
basename = g_path_get_basename (plug_in_def->prog); basename = g_path_get_basename (plug_in_def->prog);
(* status_callback) (NULL, basename, nth / n_plugins); (* status_callback) (NULL, file_utils_filename_to_utf8 (basename),
nth / n_plugins);
g_free (basename); g_free (basename);
if (plug_in_def->has_init) if (plug_in_def->has_init)
@ -866,7 +873,7 @@ plug_ins_init_file (const GimpDatafileData *file_data,
if (g_ascii_strcasecmp (file_data->basename, plug_in_name) == 0) if (g_ascii_strcasecmp (file_data->basename, plug_in_name) == 0)
{ {
g_printerr ("skipping duplicate plug-in: '%s'\n", g_printerr ("skipping duplicate plug-in: '%s'\n",
file_data->filename); file_utils_filename_to_utf8 (file_data->filename));
g_free (plug_in_name); g_free (plug_in_name);

View File

@ -50,6 +50,8 @@
#include "core/gimpimagemap.h" #include "core/gimpimagemap.h"
#include "core/gimptoolinfo.h" #include "core/gimptoolinfo.h"
#include "file/file-utils.h"
#include "widgets/gimpcursor.h" #include "widgets/gimpcursor.h"
#include "widgets/gimpenummenu.h" #include "widgets/gimpenummenu.h"
#include "widgets/gimphelp-ids.h" #include "widgets/gimphelp-ids.h"
@ -1317,7 +1319,8 @@ file_dialog_response (GtkWidget *dialog,
g_message (c_tool->is_save ? g_message (c_tool->is_save ?
_("Could not open '%s' for writing: %s") : _("Could not open '%s' for writing: %s") :
_("Could not open '%s' for reading: %s"), _("Could not open '%s' for reading: %s"),
filename, g_strerror (errno)); file_utils_filename_to_utf8 (filename),
g_strerror (errno));
return; return;
} }
@ -1327,7 +1330,8 @@ file_dialog_response (GtkWidget *dialog,
} }
else if (! curves_read_from_file (c_tool, file)) else if (! curves_read_from_file (c_tool, file))
{ {
g_message ("Error in reading file '%s'.", filename); g_message ("Error in reading file '%s'.",
file_utils_filename_to_utf8 (filename));
} }
fclose (file); fclose (file);

View File

@ -49,6 +49,8 @@
#include "core/gimpimagemap.h" #include "core/gimpimagemap.h"
#include "core/gimptoolinfo.h" #include "core/gimptoolinfo.h"
#include "file/file-utils.h"
#include "widgets/gimpenummenu.h" #include "widgets/gimpenummenu.h"
#include "widgets/gimphelp-ids.h" #include "widgets/gimphelp-ids.h"
#include "widgets/gimphistogramview.h" #include "widgets/gimphistogramview.h"
@ -1486,7 +1488,8 @@ file_dialog_response (GtkWidget *dialog,
g_message (l_tool->is_save ? g_message (l_tool->is_save ?
_("Could not open '%s' for writing: %s") : _("Could not open '%s' for writing: %s") :
_("Could not open '%s' for reading: %s"), _("Could not open '%s' for reading: %s"),
filename, g_strerror (errno)); file_utils_filename_to_utf8 (filename),
g_strerror (errno));
return; return;
} }
@ -1496,7 +1499,8 @@ file_dialog_response (GtkWidget *dialog,
} }
else if (! levels_read_from_file (l_tool, file)) else if (! levels_read_from_file (l_tool, file))
{ {
g_message (("Error in reading file '%s'."), filename); g_message (("Error in reading file '%s'."),
file_utils_filename_to_utf8 (filename));
} }
fclose (file); fclose (file);

View File

@ -31,6 +31,8 @@
#include "core/gimplist.h" #include "core/gimplist.h"
#include "core/gimpunit.h" #include "core/gimpunit.h"
#include "file/file-utils.h"
#include "gimpanchor.h" #include "gimpanchor.h"
#include "gimpstroke.h" #include "gimpstroke.h"
#include "gimpbezierstroke.h" #include "gimpbezierstroke.h"
@ -79,7 +81,7 @@ gimp_vectors_export_file (const GimpImage *image,
if (!file) if (!file)
{ {
g_set_error (error, 0, 0, _("Could not open '%s' for writing: %s"), g_set_error (error, 0, 0, _("Could not open '%s' for writing: %s"),
filename, g_strerror (errno)); file_utils_filename_to_utf8 (filename), g_strerror (errno));
return FALSE; return FALSE;
} }
@ -92,7 +94,7 @@ gimp_vectors_export_file (const GimpImage *image,
if (fclose (file)) if (fclose (file))
{ {
g_set_error (error, 0, 0, _("Error while writing '%s': %s"), g_set_error (error, 0, 0, _("Error while writing '%s': %s"),
filename, g_strerror (errno)); file_utils_filename_to_utf8 (filename), g_strerror (errno));
return FALSE; return FALSE;
} }

View File

@ -55,6 +55,8 @@
#include "core/gimp.h" #include "core/gimp.h"
#include "file/file-utils.h"
#include "gimperrorconsole.h" #include "gimperrorconsole.h"
#include "gimphelp-ids.h" #include "gimphelp-ids.h"
#include "gimpitemfactory.h" #include "gimpitemfactory.h"
@ -396,7 +398,7 @@ gimp_error_console_save_response (GtkWidget *dialog,
console->save_selection)) console->save_selection))
{ {
g_message (_("Error writing file '%s':\n%s"), g_message (_("Error writing file '%s':\n%s"),
filename, g_strerror (errno)); file_utils_filename_to_utf8 (filename), g_strerror (errno));
return; return;
} }
} }

View File

@ -34,6 +34,8 @@
#include "core/gimpmarshal.h" #include "core/gimpmarshal.h"
#include "file/file-utils.h"
#include "gimpenummenu.h" #include "gimpenummenu.h"
#include "gimphelp-ids.h" #include "gimphelp-ids.h"
#include "gimptexteditor.h" #include "gimptexteditor.h"
@ -370,7 +372,7 @@ gimp_text_editor_load_file (GtkTextBuffer *buffer,
if (!file) if (!file)
{ {
g_message (_("Could not open '%s' for reading: %s"), g_message (_("Could not open '%s' for reading: %s"),
filename, g_strerror (errno)); file_utils_filename_to_utf8 (filename), g_strerror (errno));
return FALSE; return FALSE;
} }
@ -398,7 +400,8 @@ gimp_text_editor_load_file (GtkTextBuffer *buffer,
} }
if (remaining) if (remaining)
g_message (_("Invalid UTF-8 data in file '%s'."), filename); g_message (_("Invalid UTF-8 data in file '%s'."),
file_utils_filename_to_utf8 (filename));
return TRUE; return TRUE;
} }

View File

@ -30,6 +30,8 @@
#include "core/gimp.h" #include "core/gimp.h"
#include "core/gimpimage.h" #include "core/gimpimage.h"
#include "file/file-utils.h"
#include "pdb/procedural_db.h" #include "pdb/procedural_db.h"
#include "plug-in/plug-ins.h" #include "plug-in/plug-ins.h"
@ -268,12 +270,8 @@ xcf_load_invoker (Gimp *gimp,
fclose (info.fp); fclose (info.fp);
} }
else else
{ g_message (_("Could not open '%s' for reading: %s"),
gchar *utf8_filename = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL); file_utils_filename_to_utf8 (filename), g_strerror (errno));
g_message (_("Could not open '%s' for reading: %s"),
utf8_filename, g_strerror (errno));
g_free (utf8_filename);
}
return_args = procedural_db_return_args (&xcf_plug_in_load_proc.db_info, return_args = procedural_db_return_args (&xcf_plug_in_load_proc.db_info,
success); success);
@ -329,12 +327,8 @@ xcf_save_invoker (Gimp *gimp,
} }
} }
else else
{ g_message (_("Could not open '%s' for writing: %s"),
gchar *utf8_filename = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL); file_utils_filename_to_utf8 (filename), g_strerror (errno));
g_message (_("Could not open '%s' for writing: %s"),
utf8_filename, g_strerror (errno));
g_free (utf8_filename);
}
return_args = procedural_db_return_args (&xcf_plug_in_save_proc.db_info, return_args = procedural_db_return_args (&xcf_plug_in_save_proc.db_info,
success); success);

View File

@ -83,7 +83,9 @@ static gchar * gimp_env_get_dir (const gchar *gimp_env_name,
* directory or not. * directory or not.
* *
* The returned string is allocated just once, and should *NOT* be * The returned string is allocated just once, and should *NOT* be
* freed with g_free(). * freed with g_free(). The returned string is in the encoding used
* for filenames by the system, which isn't necessarily UTF-8 (never
* is on Windows).
* *
* Returns: The user-specific GIMP settings directory. * Returns: The user-specific GIMP settings directory.
**/ **/
@ -172,7 +174,9 @@ gimp_directory (void)
* Returns the name of a file in the user-specific GIMP settings directory. * Returns the name of a file in the user-specific GIMP settings directory.
* *
* The returned string is allocated dynamically and *SHOULD* be freed * The returned string is allocated dynamically and *SHOULD* be freed
* with g_free() after use. * with g_free() after use. The returned string is in the encoding used
* for filenames by the system, which isn't necessarily UTF-8 (never
* is on Windows).
* *
* Returns: The name of a file in the user-specific GIMP settings directory. * Returns: The name of a file in the user-specific GIMP settings directory.
**/ **/
@ -249,7 +253,9 @@ gimp_toplevel_directory (void)
* from the executable's name is used. * from the executable's name is used.
* *
* The returned string is allocated just once, and should *NOT* be * The returned string is allocated just once, and should *NOT* be
* freed with g_free(). * freed with g_free(). The returned string is in the encoding used
* for filenames by the system, which isn't necessarily UTF-8 (never
* is on Windows).
* *
* Returns: The top directory for GIMP data. * Returns: The top directory for GIMP data.
**/ **/
@ -274,7 +280,9 @@ gimp_data_directory (void)
* from the executable's name is used. * from the executable's name is used.
* *
* The returned string is allocated just once, and should *NOT* be * The returned string is allocated just once, and should *NOT* be
* freed with g_free(). * freed with g_free(). The returned string is in the encoding used
* for filenames by the system, which isn't necessarily UTF-8 (never
* is on Windows).
* *
* Returns: The top directory for GIMP locale files. * Returns: The top directory for GIMP locale files.
*/ */
@ -299,7 +307,9 @@ gimp_locale_directory (void)
* from the executable's name is used. * from the executable's name is used.
* *
* The returned string is allocated just once, and should *NOT* be * The returned string is allocated just once, and should *NOT* be
* freed with g_free(). * freed with g_free(). The returned string is in the encoding used
* for filenames by the system, which isn't necessarily UTF-8 (never
* is on Windows).
* *
* Returns: The top directory for GIMP config files. * Returns: The top directory for GIMP config files.
**/ **/
@ -324,7 +334,9 @@ gimp_sysconf_directory (void)
* deduced from the executable's name is used. * deduced from the executable's name is used.
* *
* The returned string is allocated just once, and should *NOT* be * The returned string is allocated just once, and should *NOT* be
* freed with g_free(). * freed with g_free(). The returned string is in the encoding used
* for filenames by the system, which isn't necessarily UTF-8 (never
* is on Windows).
* *
* Returns: The top directory for GIMP plug_ins and modules. * Returns: The top directory for GIMP plug_ins and modules.
**/ **/
@ -345,7 +357,9 @@ gimp_plug_in_directory (void)
* Returns the name of the GIMP's application-specific gtkrc file. * Returns the name of the GIMP's application-specific gtkrc file.
* *
* The returned string is allocated just once, and should *NOT* be * The returned string is allocated just once, and should *NOT* be
* freed with g_free(). * freed with g_free(). The returned string is in the encoding used
* for filenames by the system, which isn't necessarily UTF-8 (never
* is on Windows).
* *
* Returns: The name of the GIMP's application-specific gtkrc file. * Returns: The name of the GIMP's application-specific gtkrc file.
**/ **/

View File

@ -28,6 +28,8 @@
#include "libgimpbase/gimpenv.h" #include "libgimpbase/gimpenv.h"
#include "file/file-utils.h"
#include "gimpconfig-path.h" #include "gimpconfig-path.h"
#include "gimp-intl.h" #include "gimp-intl.h"
@ -104,7 +106,7 @@ gimp_config_path_expand_only (const gchar *path,
#ifndef G_OS_WIN32 #ifndef G_OS_WIN32
if (*p == '~') if (*p == '~')
{ {
length += strlen (g_get_home_dir ()); length += strlen (file_utils_filename_to_utf8 (g_get_home_dir ()));
p += 1; p += 1;
} }
else else
@ -124,18 +126,14 @@ gimp_config_path_expand_only (const gchar *path,
{ {
s = NULL; s = NULL;
if (!s && strcmp (token, "gimp_dir") == 0) if (strcmp (token, "gimp_dir") == 0)
s = gimp_directory (); s = gimp_directory ();
else if (strcmp (token, "gimp_data_dir") == 0)
if (!s && strcmp (token, "gimp_data_dir") == 0)
s = gimp_data_directory (); s = gimp_data_directory ();
else if (strcmp (token, "gimp_plug_in_dir") == 0 ||
if (!s && strcmp (token, "gimp_plugin_dir") == 0)
((strcmp (token, "gimp_plug_in_dir")) == 0 ||
(strcmp (token, "gimp_plugin_dir")) == 0))
s = gimp_plug_in_directory (); s = gimp_plug_in_directory ();
else if (strcmp (token, "gimp_sysconf_dir") == 0)
if (!s && strcmp (token, "gimp_sysconf_dir") == 0)
s = gimp_sysconf_directory (); s = gimp_sysconf_directory ();
if (!s) if (!s)
@ -163,7 +161,7 @@ gimp_config_path_expand_only (const gchar *path,
substs = g_renew (gchar *, substs, 2 * (n_substs + SUBSTS_ALLOC)); substs = g_renew (gchar *, substs, 2 * (n_substs + SUBSTS_ALLOC));
substs[2*n_substs] = token; substs[2*n_substs] = token;
substs[2*n_substs + 1] = (gchar *) s; substs[2*n_substs + 1] = file_utils_filename_to_utf8 (s);
n_substs++; n_substs++;
length += strlen (s); length += strlen (s);
@ -190,8 +188,8 @@ gimp_config_path_expand_only (const gchar *path,
if (*p == '~') if (*p == '~')
{ {
*n = '\0'; *n = '\0';
strcat (n, g_get_home_dir ()); strcat (n, file_utils_filename_to_utf8 (g_get_home_dir ()));
n += strlen (g_get_home_dir ()); n += strlen (file_utils_filename_to_utf8 (g_get_home_dir ()));
p += 1; p += 1;
} }
else else

View File

@ -470,7 +470,7 @@ gimp_config_file_copy (const gchar *source,
{ {
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno), g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
_("Could not open '%s' for reading: %s"), _("Could not open '%s' for reading: %s"),
source, g_strerror (errno)); file_utils_filename_to_utf8 (source), g_strerror (errno));
return FALSE; return FALSE;
} }
@ -479,7 +479,7 @@ gimp_config_file_copy (const gchar *source,
{ {
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno), g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
_("Could not open '%s' for writing: %s"), _("Could not open '%s' for writing: %s"),
dest, g_strerror (errno)); file_utils_filename_to_utf8 (dest), g_strerror (errno));
fclose (sfile); fclose (sfile);
return FALSE; return FALSE;
} }
@ -490,7 +490,7 @@ gimp_config_file_copy (const gchar *source,
{ {
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno), g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
_("Error while writing '%s': %s"), _("Error while writing '%s': %s"),
dest, g_strerror (errno)); file_utils_filename_to_utf8 (dest), g_strerror (errno));
fclose (sfile); fclose (sfile);
fclose (dfile); fclose (dfile);
return FALSE; return FALSE;
@ -501,7 +501,7 @@ gimp_config_file_copy (const gchar *source,
{ {
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno), g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
_("Error while reading '%s': %s"), _("Error while reading '%s': %s"),
source, g_strerror (errno)); file_utils_filename_to_utf8 (source), g_strerror (errno));
fclose (sfile); fclose (sfile);
fclose (dfile); fclose (dfile);
return FALSE; return FALSE;
@ -513,7 +513,7 @@ gimp_config_file_copy (const gchar *source,
{ {
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno), g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
_("Error while writing '%s': %s"), _("Error while writing '%s': %s"),
dest, g_strerror (errno)); file_utils_filename_to_utf8 (dest), g_strerror (errno));
return FALSE; return FALSE;
} }
@ -540,7 +540,7 @@ gimp_config_file_backup_on_error (const gchar *filename,
g_message (_("There was an error parsing your '%s' file. " g_message (_("There was an error parsing your '%s' file. "
"Default values will be used. A backup of your " "Default values will be used. A backup of your "
"configuration has been created at '%s'."), "configuration has been created at '%s'."),
name, backup); name, file_utils_filename_to_utf8 (backup));
g_free (backup); g_free (backup);

View File

@ -41,6 +41,8 @@
#include "libgimpcolor/gimpcolor.h" #include "libgimpcolor/gimpcolor.h"
#include "libgimpmath/gimpmath.h" #include "libgimpmath/gimpmath.h"
#include "file/file-utils.h"
#include "config-types.h" #include "config-types.h"
#include "gimpconfig-error.h" #include "gimpconfig-error.h"
@ -90,12 +92,15 @@ gimp_scanner_new_file (const gchar *filename,
g_set_error (error, GIMP_CONFIG_ERROR, code, g_set_error (error, GIMP_CONFIG_ERROR, code,
_("Could not open '%s' for reading: %s"), _("Could not open '%s' for reading: %s"),
filename, g_strerror (errno)); file_utils_filename_to_utf8 (filename), g_strerror (errno));
return NULL; return NULL;
} }
scanner = gimp_scanner_new (filename, fd, error); /* gimp_scanner_new() takes a "name" for the scanner, not a filename. Thus
* do convert to UTF-8.
*/
scanner = gimp_scanner_new (file_utils_filename_to_utf8 (filename), fd, error);
g_scanner_input_file (scanner, fd); g_scanner_input_file (scanner, fd);

View File

@ -163,6 +163,7 @@ gimp_module_load (GTypeModule *module)
{ {
GimpModule *gimp_module; GimpModule *gimp_module;
GimpModuleRegisterFunc func; GimpModuleRegisterFunc func;
gchar *module_filename_utf8;
g_return_val_if_fail (GIMP_IS_MODULE (module), FALSE); g_return_val_if_fail (GIMP_IS_MODULE (module), FALSE);
@ -171,14 +172,22 @@ gimp_module_load (GTypeModule *module)
g_return_val_if_fail (gimp_module->filename != NULL, FALSE); g_return_val_if_fail (gimp_module->filename != NULL, FALSE);
g_return_val_if_fail (gimp_module->module == NULL, FALSE); g_return_val_if_fail (gimp_module->module == NULL, FALSE);
module_filename_utf8 = g_filename_to_utf8 (gimp_module->filename,
-1, NULL, NULL, NULL);
if (gimp_module->verbose) if (gimp_module->verbose)
g_print (_("Loading module: '%s'\n"), gimp_module->filename); g_print (_("Loading module: '%s'\n"), module_filename_utf8);
if (! gimp_module_open (gimp_module)) if (! gimp_module_open (gimp_module))
return FALSE; {
g_free (module_filename_utf8);
return FALSE;
}
if (! gimp_module_query_module (gimp_module)) if (! gimp_module_query_module (gimp_module))
return FALSE; {
g_free (module_filename_utf8);
return FALSE;
}
/* find the gimp_module_register symbol */ /* find the gimp_module_register symbol */
if (! g_module_symbol (gimp_module->module, "gimp_module_register", if (! g_module_symbol (gimp_module->module, "gimp_module_register",
@ -189,11 +198,14 @@ gimp_module_load (GTypeModule *module)
if (gimp_module->verbose) if (gimp_module->verbose)
g_message (_("Module '%s' load error: %s"), g_message (_("Module '%s' load error: %s"),
gimp_module->filename, gimp_module->last_module_error); module_filename_utf8, gimp_module->last_module_error);
gimp_module_close (gimp_module); gimp_module_close (gimp_module);
gimp_module->state = GIMP_MODULE_STATE_ERROR; gimp_module->state = GIMP_MODULE_STATE_ERROR;
g_free (module_filename_utf8);
return FALSE; return FALSE;
} }
@ -206,15 +218,21 @@ gimp_module_load (GTypeModule *module)
if (gimp_module->verbose) if (gimp_module->verbose)
g_message (_("Module '%s' load error: %s"), g_message (_("Module '%s' load error: %s"),
gimp_module->filename, gimp_module->last_module_error); module_filename_utf8, gimp_module->last_module_error);
gimp_module_close (gimp_module); gimp_module_close (gimp_module);
gimp_module->state = GIMP_MODULE_STATE_LOAD_FAILED; gimp_module->state = GIMP_MODULE_STATE_LOAD_FAILED;
g_free (module_filename_utf8);
return FALSE; return FALSE;
} }
gimp_module->state = GIMP_MODULE_STATE_LOADED; gimp_module->state = GIMP_MODULE_STATE_LOADED;
g_free (module_filename_utf8);
return TRUE; return TRUE;
} }
@ -269,7 +287,12 @@ gimp_module_new (const gchar *filename,
else else
{ {
if (verbose) if (verbose)
g_print (_("Skipping module: '%s'\n"), filename); {
gchar *filename_utf8 = g_filename_to_utf8 (filename,
-1, NULL, NULL, NULL);
g_print (_("Skipping module: '%s'\n"), filename_utf8);
g_free (filename_utf8);
}
module->state = GIMP_MODULE_STATE_NOT_LOADED; module->state = GIMP_MODULE_STATE_NOT_LOADED;
} }
@ -312,8 +335,13 @@ gimp_module_query_module (GimpModule *module)
"Missing gimp_module_query() symbol"); "Missing gimp_module_query() symbol");
if (module->verbose) if (module->verbose)
g_message (_("Module '%s' load error: %s"), {
module->filename, module->last_module_error); gchar *filename_utf8 = g_filename_to_utf8 (module->filename,
-1, NULL, NULL, NULL);
g_message (_("Module '%s' load error: %s"),
filename_utf8, module->last_module_error);
g_free (filename_utf8);
}
gimp_module_close (module); gimp_module_close (module);
@ -339,8 +367,13 @@ gimp_module_query_module (GimpModule *module)
"gimp_module_query() returned NULL"); "gimp_module_query() returned NULL");
if (module->verbose) if (module->verbose)
g_message (_("Module '%s' load error: %s"), {
module->filename, module->last_module_error); gchar *filename_utf8 = g_filename_to_utf8 (module->filename,
-1, NULL, NULL, NULL);
g_message (_("Module '%s' load error: %s"),
filename_utf8, module->last_module_error);
g_free (filename_utf8);
}
gimp_module_close (module); gimp_module_close (module);
@ -432,8 +465,13 @@ gimp_module_open (GimpModule *module)
gimp_module_set_last_error (module, g_module_error ()); gimp_module_set_last_error (module, g_module_error ());
if (module->verbose) if (module->verbose)
g_message (_("Module '%s' load error: %s"), {
module->filename, module->last_module_error); gchar *filename_utf8 = g_filename_to_utf8 (module->filename,
-1, NULL, NULL, NULL);
g_message (_("Module '%s' load error: %s"),
filename_utf8, module->last_module_error);
g_free (filename_utf8);
}
return FALSE; return FALSE;
} }