app/app_procs.c app/errors.c app/main.c app/config/gimpconfigwriter.c

2004-01-23  Michael Natterer  <mitch@gimp.org>

	* app/app_procs.c
	* app/errors.c
	* app/main.c
	* app/config/gimpconfigwriter.c
	* app/core/gimpdata.c
	* app/core/gimpdatafactory.c
	* app/gui/user-install-dialog.c
	* app/plug-in/plug-ins.c
	* app/vectors/gimpvectors-import.c: some more gimp_filename_to_utf8().

	* libgimp/gimp.c
	* libgimpmodule/gimpmodule.c
	* libgimpmodule/gimpmoduledb.c: use it here, too, now that is in
	libgimpbase.
This commit is contained in:
Michael Natterer 2004-01-23 17:24:44 +00:00 committed by Michael Natterer
parent 62c71b91c9
commit 57911bbcba
16 changed files with 126 additions and 113 deletions

View File

@ -1,3 +1,20 @@
2004-01-23 Michael Natterer <mitch@gimp.org>
* app/app_procs.c
* app/errors.c
* app/main.c
* app/config/gimpconfigwriter.c
* app/core/gimpdata.c
* app/core/gimpdatafactory.c
* app/gui/user-install-dialog.c
* app/plug-in/plug-ins.c
* app/vectors/gimpvectors-import.c: some more gimp_filename_to_utf8().
* libgimp/gimp.c
* libgimpmodule/gimpmodule.c
* libgimpmodule/gimpmoduledb.c: use it here, too, now that is in
libgimpbase.
2004-01-23 Henrik Brix Andersen <brix@gimp.org>
* plug-ins/common/.cvsignore: s/ps/postscript/ to shut up cvs.

View File

@ -262,9 +262,7 @@ app_run (const gchar *full_prog_name,
if (! gimage && status != GIMP_PDB_CANCEL)
{
gchar *filename;
filename = file_utils_uri_to_utf8_filename (uri);
gchar *filename = file_utils_uri_to_utf8_filename (uri);
g_message (_("Opening '%s' failed: %s"),
filename, error->message);

View File

@ -37,6 +37,8 @@
#include <io.h>
#endif
#include "libgimpbase/gimpbase.h"
#include "config-types.h"
#include "gimpconfig-error.h"
@ -103,7 +105,7 @@ gimp_config_writer_new_file (const gchar *filename,
{
g_set_error (error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_WRITE,
_("Could not create temporary file for '%s': %s"),
filename, g_strerror (errno));
gimp_filename_to_utf8 (filename), g_strerror (errno));
g_free (tmpname);
return NULL;
}
@ -116,7 +118,7 @@ gimp_config_writer_new_file (const gchar *filename,
{
g_set_error (error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_WRITE,
_("Could not open '%s' for writing: %s"),
filename, g_strerror (errno));
gimp_filename_to_utf8 (filename), g_strerror (errno));
return NULL;
}
}
@ -565,14 +567,16 @@ gimp_config_writer_close_file (GimpConfigWriter *writer,
g_set_error (error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_WRITE,
_("Error writing to temporary file for '%s': %s\n"
"The original file has not been touched."),
writer->filename, g_strerror (errno));
gimp_filename_to_utf8 (writer->filename),
g_strerror (errno));
}
else
{
g_set_error (error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_WRITE,
_("Error writing to temporary file for '%s': %s\n"
"No file has been created."),
writer->filename, g_strerror (errno));
gimp_filename_to_utf8 (writer->filename),
g_strerror (errno));
}
unlink (writer->tmpname);
@ -581,7 +585,8 @@ gimp_config_writer_close_file (GimpConfigWriter *writer,
{
g_set_error (error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_WRITE,
_("Error writing to '%s': %s"),
writer->filename, g_strerror (errno));
gimp_filename_to_utf8 (writer->filename),
g_strerror (errno));
}
return FALSE;
@ -598,7 +603,8 @@ gimp_config_writer_close_file (GimpConfigWriter *writer,
{
g_set_error (error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_WRITE,
_("Could not create '%s': %s"),
writer->filename, g_strerror (errno));
gimp_filename_to_utf8 (writer->filename),
g_strerror (errno));
unlink (writer->tmpname);
return FALSE;

View File

@ -240,7 +240,7 @@ gimp_data_delete_from_disk (GimpData *data,
{
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_DELETE,
_("Could not delete '%s': %s"),
data->filename, g_strerror (errno));
gimp_filename_to_utf8 (data->filename), g_strerror (errno));
return FALSE;
}

View File

@ -439,7 +439,7 @@ gimp_data_factory_load_data (const GimpDatafileData *file_data,
{
g_message (_("Trying legacy loader on file '%s' "
"with unknown extension."),
file_data->filename);
gimp_filename_to_utf8 (file_data->filename));
goto insert;
}
}

View File

@ -1065,10 +1065,10 @@ user_install_run (void)
S_IRGRP | S_IXGRP |
S_IROTH | S_IXOTH) == -1)
{
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),
_("Cannot create folder '%s': %s"),
gimp_filename_to_utf8 (gimp_directory ()), g_strerror (errno));
gimp_filename_to_utf8 (gimp_directory ()),
g_strerror (errno));
goto break_out_of_loop;
}
@ -1098,9 +1098,9 @@ user_install_run (void)
S_IRGRP | S_IXGRP |
S_IROTH | S_IXOTH) == -1)
{
g_set_error (&error,
G_FILE_ERROR, g_file_error_from_errno (errno),
_("Cannot create folder: %s"), g_strerror (errno));
g_set_error (&error, G_FILE_ERROR, g_file_error_from_errno (errno),
_("Cannot create folder '%s': %s"),
gimp_filename_to_utf8 (dest), g_strerror (errno));
goto break_out_of_loop;
}
break;

View File

@ -28,7 +28,7 @@
#include <glib-object.h>
#include "libgimpbase/gimpversion.h"
#include "libgimpbase/gimpbase.h"
#include "core/core-types.h"
@ -93,7 +93,7 @@ gimp_message_log_func (const gchar *log_domain,
return;
}
g_printerr ("%s: %s\n\n", full_prog_name, message);
g_printerr ("%s: %s\n\n", gimp_filename_to_utf8 (full_prog_name), message);
}
void
@ -141,7 +141,8 @@ gimp_eek (const gchar *reason,
{
#ifndef G_OS_WIN32
g_printerr ("%s: %s: %s\n", full_prog_name, reason, message);
g_printerr ("%s: %s: %s\n", gimp_filename_to_utf8 (full_prog_name),
reason, message);
if (use_handler)
{

View File

@ -1065,10 +1065,10 @@ user_install_run (void)
S_IRGRP | S_IXGRP |
S_IROTH | S_IXOTH) == -1)
{
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),
_("Cannot create folder '%s': %s"),
gimp_filename_to_utf8 (gimp_directory ()), g_strerror (errno));
gimp_filename_to_utf8 (gimp_directory ()),
g_strerror (errno));
goto break_out_of_loop;
}
@ -1098,9 +1098,9 @@ user_install_run (void)
S_IRGRP | S_IXGRP |
S_IROTH | S_IXOTH) == -1)
{
g_set_error (&error,
G_FILE_ERROR, g_file_error_from_errno (errno),
_("Cannot create folder: %s"), g_strerror (errno));
g_set_error (&error, G_FILE_ERROR, g_file_error_from_errno (errno),
_("Cannot create folder '%s': %s"),
gimp_filename_to_utf8 (dest), g_strerror (errno));
goto break_out_of_loop;
}
break;

View File

@ -503,7 +503,8 @@ gimp_show_help (const gchar *progname)
{
gimp_show_version ();
g_print (_("\nUsage: %s [option ... ] [file ... ]\n\n"), progname);
g_print (_("\nUsage: %s [option ... ] [file ... ]\n\n"),
gimp_filename_to_utf8 (progname));
g_print (_("Options:\n"));
g_print (_(" -h, --help Output this help.\n"));
g_print (_(" -v, --version Output version information.\n"));

View File

@ -260,7 +260,8 @@ plug_ins_init (Gimp *gimp,
#ifdef VERBOSE
g_print ("added locale domain \"%s\" for path \"%s\"\n",
def->domain_name ? def->domain_name : "(null)",
def->domain_path ? def->domain_path : "(null)");
def->domain_path ?
gimp_filename_to_utf8 (def->domain_path) : "(null)");
#endif
}
@ -305,7 +306,8 @@ plug_ins_init (Gimp *gimp,
if (plug_in_def->has_init)
{
if (gimp->be_verbose)
g_print (_("Initializing plug-in: '%s'\n"), plug_in_def->prog);
g_print (_("Initializing plug-in: '%s'\n"),
gimp_filename_to_utf8 (plug_in_def->prog));
plug_in_call_init (gimp, plug_in_def);
}
@ -561,7 +563,8 @@ plug_ins_def_add_from_rc (Gimp *gimp,
g_free (basename1);
gimp->write_pluginrc = TRUE;
g_printerr ("executable not found: '%s'\n", plug_in_def->prog);
g_printerr ("executable not found: '%s'\n",
gimp_filename_to_utf8 (plug_in_def->prog));
plug_in_def_free (plug_in_def, FALSE);
}
@ -834,7 +837,9 @@ plug_ins_image_types_parse (gchar *image_types)
}
else
{
g_warning ("image_type contains unrecognizable parts: '%s'", type_spec);
g_warning ("image_type contains unrecognizable parts: '%s'",
type_spec);
while (*image_types &&
((*image_types != ' ') ||
(*image_types != '\t') ||

View File

@ -260,7 +260,8 @@ plug_ins_init (Gimp *gimp,
#ifdef VERBOSE
g_print ("added locale domain \"%s\" for path \"%s\"\n",
def->domain_name ? def->domain_name : "(null)",
def->domain_path ? def->domain_path : "(null)");
def->domain_path ?
gimp_filename_to_utf8 (def->domain_path) : "(null)");
#endif
}
@ -305,7 +306,8 @@ plug_ins_init (Gimp *gimp,
if (plug_in_def->has_init)
{
if (gimp->be_verbose)
g_print (_("Initializing plug-in: '%s'\n"), plug_in_def->prog);
g_print (_("Initializing plug-in: '%s'\n"),
gimp_filename_to_utf8 (plug_in_def->prog));
plug_in_call_init (gimp, plug_in_def);
}
@ -561,7 +563,8 @@ plug_ins_def_add_from_rc (Gimp *gimp,
g_free (basename1);
gimp->write_pluginrc = TRUE;
g_printerr ("executable not found: '%s'\n", plug_in_def->prog);
g_printerr ("executable not found: '%s'\n",
gimp_filename_to_utf8 (plug_in_def->prog));
plug_in_def_free (plug_in_def, FALSE);
}
@ -834,7 +837,9 @@ plug_ins_image_types_parse (gchar *image_types)
}
else
{
g_warning ("image_type contains unrecognizable parts: '%s'", type_spec);
g_warning ("image_type contains unrecognizable parts: '%s'",
type_spec);
while (*image_types &&
((*image_types != ' ') ||
(*image_types != '\t') ||

View File

@ -288,7 +288,8 @@ gimp_vectors_import (GimpImage *image,
else
{
if (filename)
g_set_error (error, 0, 0, _("No paths found in '%s'"), filename);
g_set_error (error, 0, 0, _("No paths found in '%s'"),
gimp_filename_to_utf8 (filename));
else
g_set_error (error, 0, 0, _("No paths found in the buffer"));

View File

@ -1597,7 +1597,8 @@ gimp_config (GPConfig *config)
g_message ("Could not execute plug-in \"%s\"\n(%s)\n"
"because the GIMP is using an older version of the "
"plug-in protocol.",
g_get_prgname (), progname);
gimp_filename_to_utf8 (g_get_prgname ()),
gimp_filename_to_utf8 (progname));
gimp_quit ();
}
else if (config->version > GIMP_PROTOCOL_VERSION)
@ -1605,7 +1606,8 @@ gimp_config (GPConfig *config)
g_message ("Could not execute plug-in \"%s\"\n(%s)\n"
"because it uses an obsolete version of the "
"plug-in protocol.",
g_get_prgname (), progname);
gimp_filename_to_utf8 (g_get_prgname ()),
gimp_filename_to_utf8 (progname));
gimp_quit ();
}

View File

@ -37,6 +37,8 @@
#include <io.h>
#endif
#include "libgimpbase/gimpbase.h"
#include "config-types.h"
#include "gimpconfig-error.h"
@ -103,7 +105,7 @@ gimp_config_writer_new_file (const gchar *filename,
{
g_set_error (error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_WRITE,
_("Could not create temporary file for '%s': %s"),
filename, g_strerror (errno));
gimp_filename_to_utf8 (filename), g_strerror (errno));
g_free (tmpname);
return NULL;
}
@ -116,7 +118,7 @@ gimp_config_writer_new_file (const gchar *filename,
{
g_set_error (error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_WRITE,
_("Could not open '%s' for writing: %s"),
filename, g_strerror (errno));
gimp_filename_to_utf8 (filename), g_strerror (errno));
return NULL;
}
}
@ -565,14 +567,16 @@ gimp_config_writer_close_file (GimpConfigWriter *writer,
g_set_error (error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_WRITE,
_("Error writing to temporary file for '%s': %s\n"
"The original file has not been touched."),
writer->filename, g_strerror (errno));
gimp_filename_to_utf8 (writer->filename),
g_strerror (errno));
}
else
{
g_set_error (error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_WRITE,
_("Error writing to temporary file for '%s': %s\n"
"No file has been created."),
writer->filename, g_strerror (errno));
gimp_filename_to_utf8 (writer->filename),
g_strerror (errno));
}
unlink (writer->tmpname);
@ -581,7 +585,8 @@ gimp_config_writer_close_file (GimpConfigWriter *writer,
{
g_set_error (error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_WRITE,
_("Error writing to '%s': %s"),
writer->filename, g_strerror (errno));
gimp_filename_to_utf8 (writer->filename),
g_strerror (errno));
}
return FALSE;
@ -598,7 +603,8 @@ gimp_config_writer_close_file (GimpConfigWriter *writer,
{
g_set_error (error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_WRITE,
_("Could not create '%s': %s"),
writer->filename, g_strerror (errno));
gimp_filename_to_utf8 (writer->filename),
g_strerror (errno));
unlink (writer->tmpname);
return FALSE;

View File

@ -26,6 +26,8 @@
#include <glib-object.h>
#include "libgimpbase/gimpbase.h"
#include "gimpmodule.h"
#include "libgimp/libgimp-intl.h"
@ -163,7 +165,6 @@ gimp_module_load (GTypeModule *module)
{
GimpModule *gimp_module;
GimpModuleRegisterFunc func;
gchar *module_filename_utf8;
g_return_val_if_fail (GIMP_IS_MODULE (module), FALSE);
@ -172,22 +173,15 @@ gimp_module_load (GTypeModule *module)
g_return_val_if_fail (gimp_module->filename != 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)
g_print (_("Loading module: '%s'\n"), module_filename_utf8);
g_print (_("Loading module: '%s'\n"),
gimp_filename_to_utf8 (gimp_module->filename));
if (! gimp_module_open (gimp_module))
{
g_free (module_filename_utf8);
return FALSE;
}
return FALSE;
if (! gimp_module_query_module (gimp_module))
{
g_free (module_filename_utf8);
return FALSE;
}
return FALSE;
/* find the gimp_module_register symbol */
if (! g_module_symbol (gimp_module->module, "gimp_module_register",
@ -198,14 +192,13 @@ gimp_module_load (GTypeModule *module)
if (gimp_module->verbose)
g_message (_("Module '%s' load error: %s"),
module_filename_utf8, gimp_module->last_module_error);
gimp_filename_to_utf8 (gimp_module->filename),
gimp_module->last_module_error);
gimp_module_close (gimp_module);
gimp_module->state = GIMP_MODULE_STATE_ERROR;
g_free (module_filename_utf8);
return FALSE;
}
@ -218,21 +211,18 @@ gimp_module_load (GTypeModule *module)
if (gimp_module->verbose)
g_message (_("Module '%s' load error: %s"),
module_filename_utf8, gimp_module->last_module_error);
gimp_filename_to_utf8 (gimp_module->filename),
gimp_module->last_module_error);
gimp_module_close (gimp_module);
gimp_module->state = GIMP_MODULE_STATE_LOAD_FAILED;
g_free (module_filename_utf8);
return FALSE;
}
gimp_module->state = GIMP_MODULE_STATE_LOADED;
g_free (module_filename_utf8);
return TRUE;
}
@ -335,13 +325,9 @@ gimp_module_query_module (GimpModule *module)
"Missing gimp_module_query() symbol");
if (module->verbose)
{
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);
}
g_message (_("Module '%s' load error: %s"),
gimp_filename_to_utf8 (module->filename),
module->last_module_error);
gimp_module_close (module);
@ -367,13 +353,9 @@ gimp_module_query_module (GimpModule *module)
"gimp_module_query() returned NULL");
if (module->verbose)
{
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);
}
g_message (_("Module '%s' load error: %s"),
gimp_filename_to_utf8 (module->filename),
module->last_module_error);
gimp_module_close (module);
@ -465,13 +447,10 @@ gimp_module_open (GimpModule *module)
gimp_module_set_last_error (module, g_module_error ());
if (module->verbose)
{
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);
}
g_message (_("Module '%s' load error: %s"),
gimp_filename_to_utf8 (module->filename),
module->last_module_error);
return FALSE;
}

View File

@ -113,9 +113,7 @@ gimp_module_db_get_type (void)
static void
gimp_module_db_class_init (GimpModuleDBClass *klass)
{
GObjectClass *object_class;
object_class = G_OBJECT_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
@ -166,9 +164,7 @@ gimp_module_db_init (GimpModuleDB *db)
static void
gimp_module_db_finalize (GObject *object)
{
GimpModuleDB *db;
db = GIMP_MODULE_DB (object);
GimpModuleDB *db = GIMP_MODULE_DB (object);
if (db->modules)
{
@ -255,8 +251,7 @@ void
gimp_module_db_set_load_inhibit (GimpModuleDB *db,
const gchar *load_inhibit)
{
GimpModule *module;
GList *list;
GList *list;
g_return_if_fail (GIMP_IS_MODULE_DB (db));
@ -267,7 +262,7 @@ gimp_module_db_set_load_inhibit (GimpModuleDB *db,
for (list = db->modules; list; list = g_list_next (list))
{
module = (GimpModule *) list->data;
GimpModule *module = list->data;
gimp_module_set_load_inhibit (module,
is_in_inhibit_list (module->filename,
@ -362,9 +357,7 @@ gimp_module_db_refresh (GimpModuleDB *db,
static gboolean
valid_module_name (const gchar *filename)
{
gchar *basename;
basename = g_path_get_basename (filename);
gchar *basename = g_path_get_basename (filename);
#if !defined(G_OS_WIN32) && !defined(G_WITH_CYGWIN)
if (strncmp (basename, "lib", 3))
@ -423,12 +416,11 @@ static GimpModule *
gimp_module_db_module_find_by_path (GimpModuleDB *db,
const char *fullpath)
{
GimpModule *module;
GList *list;
GList *list;
for (list = db->modules; list; list = g_list_next (list))
{
module = (GimpModule *) list->data;
GimpModule *module = list->data;
if (! strcmp (module->filename, fullpath))
return module;
@ -442,17 +434,17 @@ static void
gimp_module_db_dump_module (gpointer data,
gpointer user_data)
{
GimpModule *i = data;
GimpModule *module = data;
g_print ("\n%s: %s\n",
i->filename,
gimp_module_state_name (i->state));
gimp_filename_to_utf8 (module->filename),
gimp_module_state_name (module->state));
g_print (" module:%p lasterr:%s query:%p register:%p\n",
i->module,
i->last_module_error ? i->last_module_error : "NONE",
i->query_module,
i->register_module);
g_print (" module: %p lasterr: %s query: %p register: %p\n",
module->module,
module->last_module_error ? module->last_module_error : "NONE",
module->query_module,
module->register_module);
if (i->info)
{
@ -461,11 +453,11 @@ gimp_module_db_dump_module (gpointer data,
" version: %s\n"
" copyright: %s\n"
" date: %s\n",
i->info->purpose ? i->info->purpose : "NONE",
i->info->author ? i->info->author : "NONE",
i->info->version ? i->info->version : "NONE",
i->info->copyright ? i->info->copyright : "NONE",
i->info->date ? i->info->date : "NONE");
module->info->purpose ? module->info->purpose : "NONE",
module->info->author ? module->info->author : "NONE",
module->info->version ? module->info->version : "NONE",
module->info->copyright ? module->info->copyright : "NONE",
module->info->date ? module->info->date : "NONE");
}
}
#endif