print error messages unconditionally and let "verbose" print module access

2005-11-23  Michael Natterer  <mitch@gimp.org>

	* libgimpmodule/gimpmodule.c: print error messages unconditionally
	and let "verbose" print module access debugging stuff. Misc cleanup.
This commit is contained in:
Michael Natterer 2005-11-23 22:22:23 +00:00 committed by Michael Natterer
parent 855c4efe30
commit 56c2ae4020
2 changed files with 40 additions and 57 deletions

View File

@ -1,3 +1,8 @@
2005-11-23 Michael Natterer <mitch@gimp.org>
* libgimpmodule/gimpmodule.c: print error messages unconditionally
and let "verbose" print module access debugging stuff. Misc cleanup.
2005-11-23 Michael Natterer <mitch@gimp.org>
* app/tools/gimptoolcontrol.[ch]: cleaned up and reordered

View File

@ -90,22 +90,19 @@ gimp_module_get_type (void)
static void
gimp_module_class_init (GimpModuleClass *klass)
{
GObjectClass *object_class;
GTypeModuleClass *module_class;
object_class = G_OBJECT_CLASS (klass);
module_class = G_TYPE_MODULE_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GTypeModuleClass *module_class = G_TYPE_MODULE_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
module_signals[MODIFIED] =
g_signal_new ("modified",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpModuleClass, modified),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpModuleClass, modified),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
object_class->finalize = gimp_module_finalize;
@ -135,9 +132,7 @@ gimp_module_init (GimpModule *module)
static void
gimp_module_finalize (GObject *object)
{
GimpModule *module;
module = GIMP_MODULE (object);
GimpModule *module = GIMP_MODULE (object);
if (module->info)
{
@ -163,23 +158,15 @@ gimp_module_finalize (GObject *object)
static gboolean
gimp_module_load (GTypeModule *module)
{
GimpModule *gimp_module;
GimpModule *gimp_module = GIMP_MODULE (module);
gpointer func;
g_return_val_if_fail (GIMP_IS_MODULE (module), FALSE);
gimp_module = GIMP_MODULE (module);
g_return_val_if_fail (gimp_module->filename != NULL, FALSE);
g_return_val_if_fail (gimp_module->module == NULL, FALSE);
if (gimp_module->verbose)
{
gchar *name = g_filename_display_name (gimp_module->filename);
g_print (_("Loading module: '%s'\n"), name);
g_free (name);
}
g_print ("Loading module '%s'\n",
gimp_filename_to_utf8 (gimp_module->filename));
if (! gimp_module_open (gimp_module))
return FALSE;
@ -193,10 +180,9 @@ gimp_module_load (GTypeModule *module)
gimp_module_set_last_error (gimp_module,
"Missing gimp_module_register() symbol");
if (gimp_module->verbose)
g_message (_("Module '%s' load error: %s"),
gimp_filename_to_utf8 (gimp_module->filename),
gimp_module->last_module_error);
g_message (_("Module '%s' load error: %s"),
gimp_filename_to_utf8 (gimp_module->filename),
gimp_module->last_module_error);
gimp_module_close (gimp_module);
@ -212,10 +198,9 @@ gimp_module_load (GTypeModule *module)
gimp_module_set_last_error (gimp_module,
"gimp_module_register() returned FALSE");
if (gimp_module->verbose)
g_message (_("Module '%s' load error: %s"),
gimp_filename_to_utf8 (gimp_module->filename),
gimp_module->last_module_error);
g_message (_("Module '%s' load error: %s"),
gimp_filename_to_utf8 (gimp_module->filename),
gimp_module->last_module_error);
gimp_module_close (gimp_module);
@ -232,14 +217,14 @@ gimp_module_load (GTypeModule *module)
static void
gimp_module_unload (GTypeModule *module)
{
GimpModule *gimp_module;
g_return_if_fail (GIMP_IS_MODULE (module));
gimp_module = GIMP_MODULE (module);
GimpModule *gimp_module = GIMP_MODULE (module);
g_return_if_fail (gimp_module->module != NULL);
if (gimp_module->verbose)
g_print ("Unloading module '%s'\n",
gimp_filename_to_utf8 (gimp_module->filename));
gimp_module_close (gimp_module);
}
@ -280,12 +265,8 @@ gimp_module_new (const gchar *filename,
else
{
if (verbose)
{
gchar *name = g_filename_display_name (filename);
g_print (_("Skipping module: '%s'\n"), name);
g_free (name);
}
g_print ("Skipping module '%s'\n",
gimp_filename_to_utf8 (filename));
module->state = GIMP_MODULE_STATE_NOT_LOADED;
}
@ -326,10 +307,9 @@ gimp_module_query_module (GimpModule *module)
gimp_module_set_last_error (module,
"Missing gimp_module_query() symbol");
if (module->verbose)
g_message (_("Module '%s' load error: %s"),
gimp_filename_to_utf8 (module->filename),
module->last_module_error);
g_message (_("Module '%s' load error: %s"),
gimp_filename_to_utf8 (module->filename),
module->last_module_error);
gimp_module_close (module);
@ -354,10 +334,9 @@ gimp_module_query_module (GimpModule *module)
"module ABI version does not match" :
"gimp_module_query() returned NULL");
if (module->verbose)
g_message (_("Module '%s' load error: %s"),
gimp_filename_to_utf8 (module->filename),
module->last_module_error);
g_message (_("Module '%s' load error: %s"),
gimp_filename_to_utf8 (module->filename),
module->last_module_error);
gimp_module_close (module);
@ -447,7 +426,7 @@ gimp_module_state_name (GimpModuleState state)
**/
GType
gimp_module_register_enum (GTypeModule *module,
const gchar *name,
const gchar *name,
const GEnumValue *const_static_values)
{
return g_type_module_register_enum (module, name, const_static_values);
@ -466,10 +445,9 @@ gimp_module_open (GimpModule *module)
module->state = GIMP_MODULE_STATE_ERROR;
gimp_module_set_last_error (module, g_module_error ());
if (module->verbose)
g_message (_("Module '%s' load error: %s"),
gimp_filename_to_utf8 (module->filename),
module->last_module_error);
g_message (_("Module '%s' load error: %s"),
gimp_filename_to_utf8 (module->filename),
module->last_module_error);
return FALSE;
}