From 56c2ae4020e8e2c0c6b6f5021d265b2933d09cdb Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Wed, 23 Nov 2005 22:22:23 +0000 Subject: [PATCH] print error messages unconditionally and let "verbose" print module access 2005-11-23 Michael Natterer * libgimpmodule/gimpmodule.c: print error messages unconditionally and let "verbose" print module access debugging stuff. Misc cleanup. --- ChangeLog | 5 +++ libgimpmodule/gimpmodule.c | 92 +++++++++++++++----------------------- 2 files changed, 40 insertions(+), 57 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3f34d7158c..aef082fbd1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-11-23 Michael Natterer + + * libgimpmodule/gimpmodule.c: print error messages unconditionally + and let "verbose" print module access debugging stuff. Misc cleanup. + 2005-11-23 Michael Natterer * app/tools/gimptoolcontrol.[ch]: cleaned up and reordered diff --git a/libgimpmodule/gimpmodule.c b/libgimpmodule/gimpmodule.c index 4fa062e50a..ae995e36ee 100644 --- a/libgimpmodule/gimpmodule.c +++ b/libgimpmodule/gimpmodule.c @@ -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; }