From 1ed8dd4f53f32130dcd25e33f8a9b359757b1d8d Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Mon, 9 Oct 2006 18:49:15 +0000 Subject: [PATCH] app/actions/data-commands.c app/actions/documents-commands.c 2006-10-09 Michael Natterer * app/actions/data-commands.c * app/actions/documents-commands.c * app/actions/drawable-commands.c * app/actions/gradients-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/palettes-commands.c * app/actions/select-commands.c * app/actions/vectors-commands.c * app/core/gimp-contexts.c * app/core/gimp-documents.c * app/core/gimp-edit.c * app/core/gimp-modules.c * app/core/gimp-parasites.c * app/core/gimp-templates.c * app/core/gimp-units.c * app/core/gimpchannel.c * app/core/gimpdatafactory.[ch] * app/core/gimpdrawable-bucket-fill.c * app/core/gimpimage-merge.c * app/core/gimpimagefile.c * app/core/gimplayer-floating-sel.c * app/core/gimppdbprogress.c * app/core/gimpselection.c * app/dialogs/palette-import-dialog.c * app/display/gimpdisplayshell-dnd.c * app/gui/session.c * app/gui/themes.c * app/pdb/gimpprocedure.c * app/plug-in/gimpplugin-message.c * app/plug-in/gimpplugin.c * app/plug-in/gimppluginmanager-file.c * app/plug-in/gimppluginmanager.c * app/text/gimptextlayer-xcf.c * app/text/gimptextlayer.c * app/widgets/gimpcontrollers.c * app/widgets/gimpdataeditor.c * app/widgets/gimpdevices.c * app/widgets/gimpdnd-xds.c * app/widgets/gimplayertreeview.c * app/widgets/gimptoolbox-dnd.c * app/widgets/gimptoolbox.c * app/widgets/gimpuimanager.c * app/widgets/gimpvectorstreeview.c * tools/pdbgen/pdb/brush.pdb * tools/pdbgen/pdb/gradient.pdb * tools/pdbgen/pdb/palette.pdb: convert lots of g_message() to gimp_message(). Make sure we never pass unknown strings (like error->message) to printf-like functions directly; run them thorugh "%s" instead. Don't translate some messages which should never happen. * app/pdb/brush_cmds.c * app/pdb/gradient_cmds.c * app/pdb/palette_cmds.c: regenerated. --- ChangeLog | 58 ++++++++ app/actions/data-commands.c | 20 +-- app/actions/documents-commands.c | 4 +- app/actions/drawable-commands.c | 18 ++- app/actions/gradients-commands.c | 9 +- app/actions/image-commands.c | 5 +- app/actions/layers-commands.c | 14 +- app/actions/palettes-commands.c | 4 +- app/actions/select-commands.c | 6 +- app/actions/vectors-commands.c | 29 ++-- app/core/gimp-contexts.c | 4 +- app/core/gimp-documents.c | 4 +- app/core/gimp-edit.c | 5 +- app/core/gimp-modules.c | 4 +- app/core/gimp-parasites.c | 5 +- app/core/gimp-templates.c | 15 ++- app/core/gimp-units.c | 9 +- app/core/gimpchannel.c | 4 +- app/core/gimpdatafactory.c | 33 +++-- app/core/gimpdatafactory.h | 3 +- app/core/gimpdrawable-bucket-fill.c | 3 +- app/core/gimpimage-merge.c | 6 +- app/core/gimpimagefile.c | 17 ++- app/core/gimplayer-floating-sel.c | 11 +- app/core/gimppdbprogress.c | 8 +- app/core/gimpselection.c | 15 ++- app/dialogs/palette-import-dialog.c | 2 +- app/display/gimpdisplayshell-dnd.c | 2 +- app/gui/session.c | 9 +- app/gui/themes.c | 5 +- app/pdb/brush_cmds.c | 2 +- app/pdb/gimpprocedure.c | 34 ++--- app/pdb/gradient_cmds.c | 2 +- app/pdb/palette_cmds.c | 2 +- app/plug-in/gimpplugin-message.c | 193 +++++++++++++++------------ app/plug-in/gimpplugin.c | 59 ++++---- app/plug-in/gimppluginmanager-file.c | 20 +-- app/plug-in/gimppluginmanager.c | 4 +- app/text/gimptextlayer-xcf.c | 19 +-- app/text/gimptextlayer.c | 5 +- app/widgets/gimpcontrollers.c | 7 +- app/widgets/gimpdataeditor.c | 13 +- app/widgets/gimpdevices.c | 4 +- app/widgets/gimpdnd-xds.c | 10 +- app/widgets/gimplayertreeview.c | 4 +- app/widgets/gimptoolbox-dnd.c | 5 +- app/widgets/gimptoolbox.c | 5 +- app/widgets/gimpuimanager.c | 20 +-- app/widgets/gimpvectorstreeview.c | 2 +- tools/pdbgen/pdb/brush.pdb | 2 +- tools/pdbgen/pdb/gradient.pdb | 2 +- tools/pdbgen/pdb/palette.pdb | 2 +- 52 files changed, 475 insertions(+), 272 deletions(-) diff --git a/ChangeLog b/ChangeLog index 49019fc0ac..ba9a0cd7f6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,61 @@ +2006-10-09 Michael Natterer + + * app/actions/data-commands.c + * app/actions/documents-commands.c + * app/actions/drawable-commands.c + * app/actions/gradients-commands.c + * app/actions/image-commands.c + * app/actions/layers-commands.c + * app/actions/palettes-commands.c + * app/actions/select-commands.c + * app/actions/vectors-commands.c + * app/core/gimp-contexts.c + * app/core/gimp-documents.c + * app/core/gimp-edit.c + * app/core/gimp-modules.c + * app/core/gimp-parasites.c + * app/core/gimp-templates.c + * app/core/gimp-units.c + * app/core/gimpchannel.c + * app/core/gimpdatafactory.[ch] + * app/core/gimpdrawable-bucket-fill.c + * app/core/gimpimage-merge.c + * app/core/gimpimagefile.c + * app/core/gimplayer-floating-sel.c + * app/core/gimppdbprogress.c + * app/core/gimpselection.c + * app/dialogs/palette-import-dialog.c + * app/display/gimpdisplayshell-dnd.c + * app/gui/session.c + * app/gui/themes.c + * app/pdb/gimpprocedure.c + * app/plug-in/gimpplugin-message.c + * app/plug-in/gimpplugin.c + * app/plug-in/gimppluginmanager-file.c + * app/plug-in/gimppluginmanager.c + * app/text/gimptextlayer-xcf.c + * app/text/gimptextlayer.c + * app/widgets/gimpcontrollers.c + * app/widgets/gimpdataeditor.c + * app/widgets/gimpdevices.c + * app/widgets/gimpdnd-xds.c + * app/widgets/gimplayertreeview.c + * app/widgets/gimptoolbox-dnd.c + * app/widgets/gimptoolbox.c + * app/widgets/gimpuimanager.c + * app/widgets/gimpvectorstreeview.c + * tools/pdbgen/pdb/brush.pdb + * tools/pdbgen/pdb/gradient.pdb + * tools/pdbgen/pdb/palette.pdb: convert lots of g_message() to + gimp_message(). Make sure we never pass unknown strings (like + error->message) to printf-like functions directly; run them + thorugh "%s" instead. Don't translate some messages which should + never happen. + + * app/pdb/brush_cmds.c + * app/pdb/gradient_cmds.c + * app/pdb/palette_cmds.c: regenerated. + 2006-10-09 Sven Neumann * app/dialogs/tips-parser.[ch]: accept printf-style format strings. diff --git a/app/actions/data-commands.c b/app/actions/data-commands.c index d84b23ffa7..f99853132c 100644 --- a/app/actions/data-commands.c +++ b/app/actions/data-commands.c @@ -53,8 +53,8 @@ typedef struct _GimpDataDeleteData GimpDataDeleteData; struct _GimpDataDeleteData { - GimpDataFactory *factory; - GimpData *data; + GimpDataFactoryView *view; + GimpData *data; }; @@ -99,8 +99,10 @@ data_open_as_image_cmd_callback (GtkAction *action, { gchar *filename = file_utils_uri_display_name (uri); - g_message (_("Opening '%s' failed:\n\n%s"), - filename, error->message); + gimp_message (context->gimp, G_OBJECT (view), + GIMP_MESSAGE_ERROR, + _("Opening '%s' failed:\n\n%s"), + filename, error->message); g_clear_error (&error); g_free (filename); @@ -218,8 +220,8 @@ data_delete_cmd_callback (GtkAction *action, delete_data = g_new0 (GimpDataDeleteData, 1); - delete_data->factory = view->factory; - delete_data->data = data; + delete_data->view = view; + delete_data->data = data; dialog = gimp_message_dialog_new (_("Delete Object"), GIMP_STOCK_QUESTION, GTK_WIDGET (view), 0, @@ -307,11 +309,13 @@ data_delete_confirm_response (GtkWidget *dialog, { GError *error = NULL; - if (! gimp_data_factory_data_delete (delete_data->factory, + if (! gimp_data_factory_data_delete (delete_data->view->factory, delete_data->data, TRUE, &error)) { - g_message (error->message); + gimp_message (delete_data->view->factory->gimp, + G_OBJECT (delete_data->view), GIMP_MESSAGE_ERROR, + "%s", error->message); g_clear_error (&error); } } diff --git a/app/actions/documents-commands.c b/app/actions/documents-commands.c index 51e2c7be7f..e04b7df06b 100644 --- a/app/actions/documents-commands.c +++ b/app/actions/documents-commands.c @@ -316,7 +316,9 @@ documents_open_image (GimpContext *context, { gchar *filename = file_utils_uri_display_name (uri); - g_message (_("Opening '%s' failed:\n\n%s"), filename, error->message); + gimp_message (context->gimp, NULL, GIMP_MESSAGE_ERROR, + _("Opening '%s' failed:\n\n%s"), + filename, error->message); g_clear_error (&error); g_free (filename); diff --git a/app/actions/drawable-commands.c b/app/actions/drawable-commands.c index 63e42955e9..a672a400aa 100644 --- a/app/actions/drawable-commands.c +++ b/app/actions/drawable-commands.c @@ -71,7 +71,8 @@ drawable_desaturate_cmd_callback (GtkAction *action, if (! gimp_drawable_is_rgb (drawable)) { - g_message (_("Desaturate operates only on RGB color layers.")); + gimp_message (image->gimp, G_OBJECT (widget), GIMP_MESSAGE_WARNING, + _("Desaturate operates only on RGB color layers.")); return; } @@ -92,11 +93,14 @@ drawable_equalize_cmd_callback (GtkAction *action, { GimpImage *image; GimpDrawable *drawable; + GtkWidget *widget; return_if_no_drawable (image, drawable, data); + return_if_no_widget (widget, data); if (gimp_drawable_is_indexed (drawable)) { - g_message (_("Equalize does not operate on indexed layers.")); + gimp_message (image->gimp, G_OBJECT (widget), GIMP_MESSAGE_WARNING, + _("Equalize does not operate on indexed layers.")); return; } @@ -110,11 +114,14 @@ drawable_invert_cmd_callback (GtkAction *action, { GimpImage *image; GimpDrawable *drawable; + GtkWidget *widget; return_if_no_drawable (image, drawable, data); + return_if_no_widget (widget, data); if (gimp_drawable_is_indexed (drawable)) { - g_message (_("Invert does not operate on indexed layers.")); + gimp_message (image->gimp, G_OBJECT (widget), GIMP_MESSAGE_WARNING, + _("Invert does not operate on indexed layers.")); return; } @@ -129,12 +136,15 @@ drawable_levels_stretch_cmd_callback (GtkAction *action, GimpImage *image; GimpDrawable *drawable; GimpContext *context; + GtkWidget *widget; return_if_no_drawable (image, drawable, data); return_if_no_context (context, data); + return_if_no_widget (widget, data); if (! gimp_drawable_is_rgb (drawable)) { - g_message (_("White Balance operates only on RGB color layers.")); + gimp_message (image->gimp, G_OBJECT (widget), GIMP_MESSAGE_WARNING, + _("White Balance operates only on RGB color layers.")); return; } diff --git a/app/actions/gradients-commands.c b/app/actions/gradients-commands.c index 9fe74b2b11..2264ba8e95 100644 --- a/app/actions/gradients-commands.c +++ b/app/actions/gradients-commands.c @@ -24,6 +24,7 @@ #include "actions-types.h" +#include "core/gimp.h" #include "core/gimpgradient-save.h" #include "core/gimpcontext.h" @@ -79,6 +80,8 @@ gradients_save_as_pov_ray_cmd_callback (GtkAction *action, GTK_RESPONSE_CANCEL, -1); + g_object_set_data (G_OBJECT (chooser), "gimp", context->gimp); + g_free (title); gtk_window_set_screen (GTK_WINDOW (chooser), @@ -124,8 +127,12 @@ gradients_save_as_pov_ray_response (GtkWidget *dialog, if (! gimp_gradient_save_pov (gradient, filename, &error)) { - g_message (error->message); + gimp_message (g_object_get_data (G_OBJECT (dialog), "gimp"), + G_OBJECT (dialog), + GIMP_MESSAGE_ERROR, + "%s", error->message); g_clear_error (&error); + return; } } diff --git a/app/actions/image-commands.c b/app/actions/image-commands.c index 820c3e4fe4..e82f6c601f 100644 --- a/app/actions/image-commands.c +++ b/app/actions/image-commands.c @@ -366,13 +366,16 @@ image_crop_cmd_callback (GtkAction *action, gpointer data) { GimpImage *image; + GtkWidget *widget; gint x1, y1, x2, y2; return_if_no_image (image, data); + return_if_no_widget (widget, data); if (! gimp_channel_bounds (gimp_image_get_mask (image), &x1, &y1, &x2, &y2)) { - g_message (_("Cannot crop because the current selection is empty.")); + gimp_message (image->gimp, G_OBJECT (widget), GIMP_MESSAGE_WARNING, + _("Cannot crop because the current selection is empty.")); return; } diff --git a/app/actions/layers-commands.c b/app/actions/layers-commands.c index 02837baa84..33db70d2c0 100644 --- a/app/actions/layers-commands.c +++ b/app/actions/layers-commands.c @@ -591,14 +591,17 @@ layers_crop_cmd_callback (GtkAction *action, { GimpImage *image; GimpLayer *layer; + GtkWidget *widget; gint x1, y1, x2, y2; gint off_x, off_y; return_if_no_layer (image, layer, data); + return_if_no_widget (widget, data); if (! gimp_channel_bounds (gimp_image_get_mask (image), &x1, &y1, &x2, &y2)) { - g_message (_("Cannot crop because the current selection is empty.")); + gimp_message (image->gimp, G_OBJECT (widget), GIMP_MESSAGE_WARNING, + _("Cannot crop because the current selection is empty.")); return; } @@ -981,7 +984,8 @@ layers_add_mask_response (GtkWidget *widget, if (dialog->add_mask_type == GIMP_ADD_CHANNEL_MASK && ! dialog->channel) { - g_message (_("Please select a channel first")); + gimp_message (image->gimp, G_OBJECT (widget), GIMP_MESSAGE_WARNING, + _("Please select a channel first")); return; } @@ -1065,7 +1069,8 @@ layers_scale_layer_callback (GtkWidget *dialog, } else { - g_message (_("Invalid width or height. Both must be positive.")); + gimp_message (display->image->gimp, NULL, GIMP_MESSAGE_ERROR, + "Invalid width or height. Both must be positive."); } } @@ -1103,7 +1108,8 @@ layers_resize_layer_callback (GtkWidget *dialog, } else { - g_message (_("Invalid width or height. Both must be positive.")); + gimp_message (context->gimp, NULL, GIMP_MESSAGE_ERROR, + "Invalid width or height. Both must be positive."); } } diff --git a/app/actions/palettes-commands.c b/app/actions/palettes-commands.c index 184f832a1c..3b55bb1510 100644 --- a/app/actions/palettes-commands.c +++ b/app/actions/palettes-commands.c @@ -107,7 +107,9 @@ palettes_merge_callback (GtkWidget *widget, if (! sel_list) { - g_message ("Can't merge palettes because there are no palettes selected."); + gimp_message (gimp, G_OBJECT (widget), GIMP_MESSAGE_WARNING, + "Can't merge palettes because " + "there are no palettes selected."); return; } diff --git a/app/actions/select-commands.c b/app/actions/select-commands.c index 59c96bdb0e..3d53ecaa2b 100644 --- a/app/actions/select-commands.c +++ b/app/actions/select-commands.c @@ -286,7 +286,7 @@ select_stroke_cmd_callback (GtkAction *action, if (! drawable) { - gimp_message (image->gimp, NULL, GIMP_MESSAGE_WARNING, + gimp_message (image->gimp, G_OBJECT (widget), GIMP_MESSAGE_WARNING, _("There is no active layer or channel to stroke to.")); return; } @@ -307,15 +307,17 @@ select_stroke_last_vals_cmd_callback (GtkAction *action, GimpImage *image; GimpDrawable *drawable; GimpContext *context; + GtkWidget *widget; GimpStrokeDesc *desc; return_if_no_image (image, data); return_if_no_context (context, data); + return_if_no_widget (widget, data); drawable = gimp_image_active_drawable (image); if (! drawable) { - gimp_message (image->gimp, NULL, GIMP_MESSAGE_WARNING, + gimp_message (image->gimp, G_OBJECT (widget), GIMP_MESSAGE_WARNING, _("There is no active layer or channel to stroke to.")); return; } diff --git a/app/actions/vectors-commands.c b/app/actions/vectors-commands.c index 9316f38002..ce8ea987fb 100644 --- a/app/actions/vectors-commands.c +++ b/app/actions/vectors-commands.c @@ -306,10 +306,12 @@ vectors_selection_to_vectors_cmd_callback (GtkAction *action, gpointer data) { GimpImage *image; + GtkWidget *widget; GimpProcedure *procedure; GValueArray *args; GimpDisplay *display; return_if_no_image (image, data); + return_if_no_widget (widget, data); if (value) procedure = gimp_pdb_lookup_procedure (image->gimp->pdb, @@ -320,7 +322,8 @@ vectors_selection_to_vectors_cmd_callback (GtkAction *action, if (! procedure) { - g_message ("Selection to path procedure lookup failed."); + gimp_message (image->gimp, G_OBJECT (widget), GIMP_MESSAGE_ERROR, + "Selection to path procedure lookup failed."); return; } @@ -356,7 +359,7 @@ vectors_stroke_cmd_callback (GtkAction *action, if (! drawable) { - gimp_message (image->gimp, NULL, GIMP_MESSAGE_WARNING, + gimp_message (image->gimp, G_OBJECT (widget), GIMP_MESSAGE_WARNING, _("There is no active layer or channel to stroke to.")); return; } @@ -378,15 +381,17 @@ vectors_stroke_last_vals_cmd_callback (GtkAction *action, GimpVectors *vectors; GimpDrawable *drawable; GimpContext *context; + GtkWidget *widget; GimpStrokeDesc *desc; return_if_no_vectors (image, vectors, data); return_if_no_context (context, data); + return_if_no_widget (widget, data); drawable = gimp_image_active_drawable (image); if (! drawable) { - gimp_message (image->gimp, NULL, GIMP_MESSAGE_WARNING, + gimp_message (image->gimp, G_OBJECT (widget), GIMP_MESSAGE_WARNING, _("There is no active layer or channel to stroke to.")); return; } @@ -429,9 +434,11 @@ vectors_paste_cmd_callback (GtkAction *action, gpointer data) { GimpImage *image; + GtkWidget *widget; gchar *svg; gsize svg_size; return_if_no_image (image, data); + return_if_no_widget (widget, data); svg = gimp_clipboard_get_svg (image->gimp, &svg_size); @@ -442,8 +449,8 @@ vectors_paste_cmd_callback (GtkAction *action, if (! gimp_vectors_import_buffer (image, svg, svg_size, TRUE, TRUE, -1, &error)) { - gimp_message (image->gimp, NULL, GIMP_MESSAGE_ERROR, - error->message); + gimp_message (image->gimp, G_OBJECT (widget), GIMP_MESSAGE_ERROR, + "%s", error->message); g_clear_error (&error); } else @@ -624,9 +631,11 @@ vectors_import_response (GtkWidget *widget, } else { - gimp_message (dialog->image->gimp, NULL, GIMP_MESSAGE_ERROR, - error->message); + gimp_message (dialog->image->gimp, G_OBJECT (widget), + GIMP_MESSAGE_ERROR, + "%s", error->message); g_error_free (error); + return; } g_free (filename); @@ -655,9 +664,11 @@ vectors_export_response (GtkWidget *widget, if (! gimp_vectors_export_file (dialog->image, vectors, filename, &error)) { - gimp_message (dialog->image->gimp, NULL, GIMP_MESSAGE_ERROR, - error->message); + gimp_message (dialog->image->gimp, G_OBJECT (widget), + GIMP_MESSAGE_ERROR, + "%s", error->message); g_error_free (error); + return; } g_free (filename); diff --git a/app/core/gimp-contexts.c b/app/core/gimp-contexts.c index 060e815c2f..94a6a73421 100644 --- a/app/core/gimp-contexts.c +++ b/app/core/gimp-contexts.c @@ -92,7 +92,7 @@ gimp_contexts_load (Gimp *gimp) NULL, &error)) { if (error->code != GIMP_CONFIG_ERROR_OPEN_ENOENT) - g_message (error->message); + gimp_message (gimp, NULL, GIMP_MESSAGE_ERROR, "%s", error->message); g_error_free (error); } @@ -118,7 +118,7 @@ gimp_contexts_save (Gimp *gimp) "end of user context", NULL, &error)) { - g_message (error->message); + gimp_message (gimp, NULL, GIMP_MESSAGE_ERROR, "%s", error->message); g_error_free (error); } diff --git a/app/core/gimp-documents.c b/app/core/gimp-documents.c index 41b5302da0..31c644f40d 100644 --- a/app/core/gimp-documents.c +++ b/app/core/gimp-documents.c @@ -54,7 +54,7 @@ gimp_documents_load (Gimp *gimp) &error)) { if (error->code != GIMP_CONFIG_ERROR_OPEN_ENOENT) - g_message (error->message); + gimp_message (gimp, NULL, GIMP_MESSAGE_ERROR, "%s", error->message); g_error_free (error); } @@ -87,7 +87,7 @@ gimp_documents_save (Gimp *gimp) header, footer, NULL, &error)) { - g_message (error->message); + gimp_message (gimp, NULL, GIMP_MESSAGE_ERROR, "%s", error->message); g_error_free (error); } diff --git a/app/core/gimp-edit.c b/app/core/gimp-edit.c index 18894baa48..fb9d120fcf 100644 --- a/app/core/gimp-edit.c +++ b/app/core/gimp-edit.c @@ -511,8 +511,9 @@ gimp_edit_extract_visible (GimpImage *image, if ((x1 == x2) || (y1 == y2)) { - g_message (_("Unable to cut or copy because the " - "selected region is empty.")); + gimp_message (image->gimp, NULL, GIMP_MESSAGE_WARNING, + _("Unable to cut or copy because the " + "selected region is empty.")); return NULL; } diff --git a/app/core/gimp-modules.c b/app/core/gimp-modules.c index 5e66d455ad..c9c4a9839a 100644 --- a/app/core/gimp-modules.c +++ b/app/core/gimp-modules.c @@ -138,7 +138,7 @@ gimp_modules_load (Gimp *gimp) if (error) { - g_message (error->message); + gimp_message (gimp, NULL, GIMP_MESSAGE_ERROR, "%s", error->message); g_clear_error (&error); } @@ -214,7 +214,7 @@ gimp_modules_unload (Gimp *gimp) if (error) { - g_message (error->message); + gimp_message (gimp, NULL, GIMP_MESSAGE_ERROR, "%s", error->message); g_clear_error (&error); } } diff --git a/app/core/gimp-parasites.c b/app/core/gimp-parasites.c index 0183967e44..3753bf6ae4 100644 --- a/app/core/gimp-parasites.c +++ b/app/core/gimp-parasites.c @@ -117,7 +117,8 @@ gimp_parasiterc_load (Gimp *gimp) filename, NULL, &error)) { if (error->code != GIMP_CONFIG_ERROR_OPEN_ENOENT) - g_message (error->message); + gimp_message (gimp, NULL, GIMP_MESSAGE_ERROR, "%s", error->message); + g_error_free (error); } @@ -150,7 +151,7 @@ gimp_parasiterc_save (Gimp *gimp) header, footer, NULL, &error)) { - g_message (error->message); + gimp_message (gimp, NULL, GIMP_MESSAGE_ERROR, "%s", error->message); g_error_free (error); } diff --git a/app/core/gimp-templates.c b/app/core/gimp-templates.c index 9ef2919f6c..c420f6fa1b 100644 --- a/app/core/gimp-templates.c +++ b/app/core/gimp-templates.c @@ -49,8 +49,8 @@ gimp_templates_load (Gimp *gimp) if (gimp->be_verbose) g_print ("Parsing '%s'\n", gimp_filename_to_utf8 (filename)); - if (!gimp_config_deserialize_file (GIMP_CONFIG (gimp->templates), - filename, NULL, &error)) + if (! gimp_config_deserialize_file (GIMP_CONFIG (gimp->templates), + filename, NULL, &error)) { if (error->code == GIMP_CONFIG_ERROR_OPEN_ENOENT) { @@ -60,15 +60,16 @@ gimp_templates_load (Gimp *gimp) filename = g_build_filename (gimp_sysconf_directory (), "templaterc", NULL); - if (!gimp_config_deserialize_file (GIMP_CONFIG (gimp->templates), - filename, NULL, &error)) + if (! gimp_config_deserialize_file (GIMP_CONFIG (gimp->templates), + filename, NULL, &error)) { - g_message (error->message); + gimp_message (gimp, NULL, GIMP_MESSAGE_ERROR, + "%s", error->message); } } else { - g_message (error->message); + gimp_message (gimp, NULL, GIMP_MESSAGE_ERROR, "%s", error->message); } g_clear_error (&error); @@ -105,7 +106,7 @@ gimp_templates_save (Gimp *gimp) header, footer, NULL, &error)) { - g_message (error->message); + gimp_message (gimp, NULL, GIMP_MESSAGE_ERROR, "%s", error->message); g_error_free (error); } diff --git a/app/core/gimp-units.c b/app/core/gimp-units.c index ce88ac4f16..fce1509385 100644 --- a/app/core/gimp-units.c +++ b/app/core/gimp-units.c @@ -163,7 +163,7 @@ gimp_unitrc_load (Gimp *gimp) g_scanner_unexp_token (scanner, token, NULL, NULL, NULL, _("fatal parse error"), TRUE); - g_message (error->message); + gimp_message (gimp, NULL, GIMP_MESSAGE_ERROR, "%s", error->message); g_clear_error (&error); gimp_config_file_backup_on_error (filename, "unitrc", NULL); @@ -179,6 +179,7 @@ gimp_unitrc_save (Gimp *gimp) GimpConfigWriter *writer; gchar *filename; gint i; + GError *error = NULL; g_return_if_fail (GIMP_IS_GIMP (gimp)); @@ -253,7 +254,11 @@ gimp_unitrc_save (Gimp *gimp) } } - gimp_config_writer_finish (writer, "end of units", NULL); + if (! gimp_config_writer_finish (writer, "end of units", &error)) + { + gimp_message (gimp, NULL, GIMP_MESSAGE_ERROR, "%s", error->message); + g_clear_error (&error); + } } diff --git a/app/core/gimpchannel.c b/app/core/gimpchannel.c index 22cf7b7fdf..c97956f553 100644 --- a/app/core/gimpchannel.c +++ b/app/core/gimpchannel.c @@ -684,7 +684,9 @@ gimp_channel_stroke (GimpItem *item, &n_segs_in, &n_segs_out, 0, 0, 0, 0)) { - g_message (_("Cannot stroke empty channel.")); + gimp_message (gimp_item_get_image (item)->gimp, NULL, + GIMP_MESSAGE_WARNING, + _("Cannot stroke empty channel.")); return FALSE; } diff --git a/app/core/gimpdatafactory.c b/app/core/gimpdatafactory.c index c0e8ba3294..edc733f665 100644 --- a/app/core/gimpdatafactory.c +++ b/app/core/gimpdatafactory.c @@ -403,7 +403,9 @@ gimp_data_factory_data_save (GimpDataFactory *factory) */ if (error) { - g_message (_("Failed to save data:\n\n%s"), error->message); + gimp_message (factory->gimp, NULL, GIMP_MESSAGE_ERROR, + _("Failed to save data:\n\n%s"), + error->message); g_clear_error (&error); } } @@ -542,13 +544,13 @@ gimp_data_factory_data_get_standard (GimpDataFactory *factory) } gboolean -gimp_data_factory_data_save_single (GimpDataFactory *factory, - GimpData *data) +gimp_data_factory_data_save_single (GimpDataFactory *factory, + GimpData *data, + GError **error) { - GError *error = NULL; - g_return_val_if_fail (GIMP_IS_DATA_FACTORY (factory), FALSE); g_return_val_if_fail (GIMP_IS_DATA (data), FALSE); + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); if (! data->dirty) return TRUE; @@ -558,7 +560,12 @@ gimp_data_factory_data_save_single (GimpDataFactory *factory, gchar *writable_dir = gimp_data_factory_get_save_dir (factory); if (! writable_dir) - return FALSE; + { + g_set_error (error, GIMP_DATA_ERROR, 0, + _("Failed to save data:\n\n%s"), + _("You don't have a writable data folder configured.")); + return FALSE; + } gimp_data_create_filename (data, writable_dir); @@ -568,16 +575,15 @@ gimp_data_factory_data_save_single (GimpDataFactory *factory, if (! data->writable) return FALSE; - if (! gimp_data_save (data, &error)) + if (! gimp_data_save (data, error)) { /* check if there actually was an error (no error * means the data class does not implement save) */ - if (error) - { - g_message (_("Failed to save data:\n\n%s"), error->message); - g_clear_error (&error); - } + if (! error) + g_set_error (error, GIMP_DATA_ERROR, 0, + _("Failed to save data:\n\n%s"), + "Data class does not implement saving"); return FALSE; } @@ -716,7 +722,8 @@ gimp_data_factory_load_data (const GimpDatafileData *file_data, } else { - g_message (_("Failed to load data:\n\n%s"), error->message); + gimp_message (factory->gimp, NULL, GIMP_MESSAGE_ERROR, + _("Failed to load data:\n\n%s"), error->message); g_clear_error (&error); } } diff --git a/app/core/gimpdatafactory.h b/app/core/gimpdatafactory.h index 1834ec89a7..183a49508c 100644 --- a/app/core/gimpdatafactory.h +++ b/app/core/gimpdatafactory.h @@ -102,7 +102,8 @@ gboolean gimp_data_factory_data_delete (GimpDataFactory *factory, GError **error); GimpData * gimp_data_factory_data_get_standard (GimpDataFactory *factory); gboolean gimp_data_factory_data_save_single (GimpDataFactory *factory, - GimpData *data); + GimpData *data, + GError **error); #endif /* __GIMP_DATA_FACTORY_H__ */ diff --git a/app/core/gimpdrawable-bucket-fill.c b/app/core/gimpdrawable-bucket-fill.c index cad3847d93..603645b82a 100644 --- a/app/core/gimpdrawable-bucket-fill.c +++ b/app/core/gimpdrawable-bucket-fill.c @@ -83,7 +83,8 @@ gimp_drawable_bucket_fill (GimpDrawable *drawable, if (! pattern) { - g_message (_("No patterns available for this operation.")); + gimp_message (image->gimp, NULL, GIMP_MESSAGE_WARNING, + _("No patterns available for this operation.")); return; } } diff --git a/app/core/gimpimage-merge.c b/app/core/gimpimage-merge.c index 9edc96c1ca..05b8ff1c6c 100644 --- a/app/core/gimpimage-merge.c +++ b/app/core/gimpimage-merge.c @@ -285,9 +285,9 @@ gimp_image_merge_visible_vectors (GimpImage *image) } else { - g_message (_("Not enough visible paths for a merge. " - "There must be at least two.")); - + gimp_message (image->gimp, NULL, GIMP_MESSAGE_WARNING, + _("Not enough visible paths for a merge. " + "There must be at least two.")); return NULL; } } diff --git a/app/core/gimpimagefile.c b/app/core/gimpimagefile.c index f22f4139ba..2165321587 100644 --- a/app/core/gimpimagefile.c +++ b/app/core/gimpimagefile.c @@ -291,8 +291,9 @@ gimp_imagefile_create_thumbnail (GimpImagefile *imagefile, if (! success) { gimp_message (imagefile->gimp, G_OBJECT (progress), - GIMP_MESSAGE_ERROR, error->message); - g_error_free (error); + GIMP_MESSAGE_ERROR, + "%s", error->message); + g_clear_error (&error); } } } @@ -392,8 +393,9 @@ gimp_imagefile_save_thumbnail (GimpImagefile *imagefile, &error); if (! success) { - g_message (error->message); - g_error_free (error); + gimp_message (imagefile->gimp, NULL, GIMP_MESSAGE_ERROR, + "%s", error->message); + g_clear_error (&error); } } @@ -673,9 +675,10 @@ gimp_imagefile_load_thumb (GimpImagefile *imagefile, { if (error) { - g_message (_("Could not open thumbnail '%s': %s"), - thumbnail->thumb_filename, error->message); - g_error_free (error); + gimp_message (imagefile->gimp, NULL, GIMP_MESSAGE_ERROR, + _("Could not open thumbnail '%s': %s"), + thumbnail->thumb_filename, error->message); + g_clear_error (&error); } return NULL; diff --git a/app/core/gimplayer-floating-sel.c b/app/core/gimplayer-floating-sel.c index ee45ac8787..addefe8154 100644 --- a/app/core/gimplayer-floating-sel.c +++ b/app/core/gimplayer-floating-sel.c @@ -30,6 +30,7 @@ #include "paint-funcs/paint-funcs.h" +#include "gimp.h" #include "gimpimage.h" #include "gimpimage-undo.h" #include "gimpimage-undo-push.h" @@ -126,8 +127,9 @@ floating_sel_anchor (GimpLayer *layer) if (! gimp_layer_is_floating_sel (layer)) { - g_message (_("Cannot anchor this layer because " - "it is not a floating selection.")); + gimp_message (image->gimp, NULL, GIMP_MESSAGE_WARNING, + _("Cannot anchor this layer because " + "it is not a floating selection.")); return; } @@ -206,8 +208,9 @@ floating_sel_to_layer (GimpLayer *layer) /* Check if the floating layer belongs to a channel... */ if (GIMP_IS_CHANNEL (layer->fs.drawable)) { - g_message (_("Cannot create a new layer from the floating selection " - "because it belongs to a layer mask or channel.")); + gimp_message (image->gimp, NULL, GIMP_MESSAGE_WARNING, + _("Cannot create a new layer from the floating selection " + "because it belongs to a layer mask or channel.")); return; } diff --git a/app/core/gimppdbprogress.c b/app/core/gimppdbprogress.c index c343543f04..94a2c8a1ae 100644 --- a/app/core/gimppdbprogress.c +++ b/app/core/gimppdbprogress.c @@ -31,6 +31,7 @@ #include "pdb/gimppdb.h" +#include "gimp.h" #include "gimpparamspecs.h" #include "gimppdbprogress.h" #include "gimpprogress.h" @@ -283,9 +284,10 @@ gimp_pdb_progress_run_callback (GimpPdbProgress *progress, if (g_value_get_enum (&return_vals->values[0]) != GIMP_PDB_SUCCESS) { - g_message (_("Unable to run %s callback. " - "The corresponding plug-in may have crashed."), - g_type_name (G_TYPE_FROM_INSTANCE (progress))); + gimp_message (progress->context->gimp, NULL, GIMP_MESSAGE_ERROR, + _("Unable to run %s callback. " + "The corresponding plug-in may have crashed."), + g_type_name (G_TYPE_FROM_INSTANCE (progress))); } else if (return_vals->n_values >= 2 && G_VALUE_HOLDS_DOUBLE (&return_vals->values[1])) diff --git a/app/core/gimpselection.c b/app/core/gimpselection.c index 6cf90285b4..a114db6597 100644 --- a/app/core/gimpselection.c +++ b/app/core/gimpselection.c @@ -30,6 +30,7 @@ #include "base/tile.h" #include "base/tile-manager.h" +#include "gimp.h" #include "gimpcontext.h" #include "gimpimage.h" #include "gimpimage-undo.h" @@ -268,7 +269,9 @@ gimp_selection_stroke (GimpItem *item, &num_dummy_in, &num_dummy_out, 0, 0, 0, 0)) { - g_message (_("No selection to stroke.")); + gimp_message (gimp_item_get_image (item)->gimp, NULL, + GIMP_MESSAGE_WARNING, + _("There is no selection to stroke.")); return FALSE; } @@ -624,8 +627,9 @@ gimp_selection_extract (GimpChannel *selection, non_empty = gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2); if (non_empty && ((x1 == x2) || (y1 == y2))) { - g_message (_("Unable to cut or copy because the " - "selected region is empty.")); + gimp_message (image->gimp, NULL, GIMP_MESSAGE_WARNING, + _("Unable to cut or copy because the " + "selected region is empty.")); return NULL; } @@ -777,8 +781,9 @@ gimp_selection_float (GimpChannel *selection, non_empty = gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2); if (! non_empty || (x1 == x2) || (y1 == y2)) { - g_message (_("Cannot float selection because the " - "selected region is empty.")); + gimp_message (image->gimp, NULL, GIMP_MESSAGE_WARNING, + _("Cannot float selection because the " + "selected region is empty.")); return NULL; } diff --git a/app/dialogs/palette-import-dialog.c b/app/dialogs/palette-import-dialog.c index f895514b64..69f48cab60 100644 --- a/app/dialogs/palette-import-dialog.c +++ b/app/dialogs/palette-import-dialog.c @@ -848,7 +848,7 @@ palette_import_make_palette (ImportDialog *dialog) { gimp_message (dialog->context->gimp, G_OBJECT (dialog->dialog), GIMP_MESSAGE_ERROR, - error->message); + "%s", error->message); g_error_free (error); } } diff --git a/app/display/gimpdisplayshell-dnd.c b/app/display/gimpdisplayshell-dnd.c index 583bda9385..ab077c8aa2 100644 --- a/app/display/gimpdisplayshell-dnd.c +++ b/app/display/gimpdisplayshell-dnd.c @@ -278,7 +278,7 @@ gimp_display_shell_drop_svg (GtkWidget *widget, TRUE, TRUE, -1, &error)) { gimp_message (image->gimp, G_OBJECT (shell->display), GIMP_MESSAGE_ERROR, - error->message); + "%s", error->message); g_clear_error (&error); } else diff --git a/app/gui/session.c b/app/gui/session.c index e41b97d264..aa10fad17a 100644 --- a/app/gui/session.c +++ b/app/gui/session.c @@ -162,7 +162,7 @@ session_init (Gimp *gimp) if (error) { - g_message (error->message); + gimp_message (gimp, NULL, GIMP_MESSAGE_ERROR, "%s", error->message); g_clear_error (&error); gimp_config_file_backup_on_error (filename, "sessionrc", NULL); @@ -192,6 +192,7 @@ session_save (Gimp *gimp, { GimpConfigWriter *writer; gchar *filename; + GError *error = NULL; g_return_if_fail (GIMP_IS_GIMP (gimp)); @@ -230,7 +231,11 @@ session_save (Gimp *gimp, GIMP_GUI_CONFIG (gimp->config)->last_tip + 1); gimp_config_writer_close (writer); - gimp_config_writer_finish (writer, "end of sessionrc", NULL); + if (! gimp_config_writer_finish (writer, "end of sessionrc", &error)) + { + gimp_message (gimp, NULL, GIMP_MESSAGE_ERROR, "%s", error->message); + g_clear_error (&error); + } sessionrc_deleted = FALSE; } diff --git a/app/gui/themes.c b/app/gui/themes.c index c672a33201..11a380c29a 100644 --- a/app/gui/themes.c +++ b/app/gui/themes.c @@ -235,8 +235,9 @@ themes_apply_theme (Gimp *gimp, if (! file) { - g_message (_("Could not open '%s' for writing: %s"), - gimp_filename_to_utf8 (themerc), g_strerror (errno)); + gimp_message (gimp, NULL, GIMP_MESSAGE_ERROR, + _("Could not open '%s' for writing: %s"), + gimp_filename_to_utf8 (themerc), g_strerror (errno)); goto cleanup; } diff --git a/app/pdb/brush_cmds.c b/app/pdb/brush_cmds.c index 03f002bd25..038f436c9e 100644 --- a/app/pdb/brush_cmds.c +++ b/app/pdb/brush_cmds.c @@ -216,7 +216,7 @@ brush_delete_invoker (GimpProcedure *procedure, if (! success) { gimp_message (gimp, G_OBJECT (progress), GIMP_MESSAGE_ERROR, - error->message); + "%s", error->message); g_clear_error (&error); } } diff --git a/app/pdb/gimpprocedure.c b/app/pdb/gimpprocedure.c index 154599d916..ede55ecebb 100644 --- a/app/pdb/gimpprocedure.c +++ b/app/pdb/gimpprocedure.c @@ -63,6 +63,7 @@ static void gimp_procedure_real_execute_async (GimpProcedure *procedure, static void gimp_procedure_free_strings (GimpProcedure *procedure); static gboolean gimp_procedure_validate_args (GimpProcedure *procedure, + Gimp *gimp, GValueArray *args); @@ -308,7 +309,7 @@ gimp_procedure_execute (GimpProcedure *procedure, g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL); g_return_val_if_fail (args != NULL, NULL); - if (! gimp_procedure_validate_args (procedure, args)) + if (! gimp_procedure_validate_args (procedure, gimp, args)) { return_vals = gimp_procedure_get_return_values (procedure, FALSE); g_value_set_enum (return_vals->values, GIMP_PDB_CALLING_ERROR); @@ -350,7 +351,7 @@ gimp_procedure_execute_async (GimpProcedure *procedure, g_return_if_fail (args != NULL); g_return_if_fail (display == NULL || GIMP_IS_OBJECT (display)); - if (gimp_procedure_validate_args (procedure, args)) + if (gimp_procedure_validate_args (procedure, gimp, args)) GIMP_PROCEDURE_GET_CLASS (procedure)->execute_async (procedure, gimp, context, progress, args, display); @@ -479,6 +480,7 @@ gimp_procedure_free_strings (GimpProcedure *procedure) static gboolean gimp_procedure_validate_args (GimpProcedure *procedure, + Gimp *gimp, GValueArray *args) { gint i; @@ -495,12 +497,13 @@ gimp_procedure_validate_args (GimpProcedure *procedure, const gchar *type_name = g_type_name (spec_type); const gchar *got = g_type_name (arg_type); - g_message (_("PDB calling error for procedure '%s':\n" - "Argument '%s' (#%d, type %s) type mismatch " - "(got %s)."), - gimp_object_get_name (GIMP_OBJECT (procedure)), - g_param_spec_get_name (pspec), - i + 1, type_name, got); + gimp_message (gimp, NULL, GIMP_MESSAGE_ERROR, + _("PDB calling error for procedure '%s':\n" + "Argument '%s' (#%d, type %s) type mismatch " + "(got %s)."), + gimp_object_get_name (GIMP_OBJECT (procedure)), + g_param_spec_get_name (pspec), + i + 1, type_name, got); return FALSE; } @@ -533,13 +536,14 @@ gimp_procedure_validate_args (GimpProcedure *procedure, new_value = g_value_dup_string (&string_value); g_value_unset (&string_value); - g_message (_("PDB calling error for procedure '%s':\n" - "Argument '%s' (#%d, type %s) out of bounds " - "(validation changed '%s' to '%s')"), - gimp_object_get_name (GIMP_OBJECT (procedure)), - g_param_spec_get_name (pspec), - i + 1, type_name, - old_value, new_value); + gimp_message (gimp, NULL, GIMP_MESSAGE_ERROR, + _("PDB calling error for procedure '%s':\n" + "Argument '%s' (#%d, type %s) out of bounds " + "(validation changed '%s' to '%s')"), + gimp_object_get_name (GIMP_OBJECT (procedure)), + g_param_spec_get_name (pspec), + i + 1, type_name, + old_value, new_value); g_free (old_value); g_free (new_value); diff --git a/app/pdb/gradient_cmds.c b/app/pdb/gradient_cmds.c index 487385a410..4033825433 100644 --- a/app/pdb/gradient_cmds.c +++ b/app/pdb/gradient_cmds.c @@ -265,7 +265,7 @@ gradient_delete_invoker (GimpProcedure *procedure, if (! success) { gimp_message (gimp, G_OBJECT (progress), GIMP_MESSAGE_ERROR, - error->message); + "%s", error->message); g_clear_error (&error); } } diff --git a/app/pdb/palette_cmds.c b/app/pdb/palette_cmds.c index a9d2fb5564..5eaa76d7fc 100644 --- a/app/pdb/palette_cmds.c +++ b/app/pdb/palette_cmds.c @@ -183,7 +183,7 @@ palette_delete_invoker (GimpProcedure *procedure, if (! success) { gimp_message (gimp, G_OBJECT (progress), GIMP_MESSAGE_ERROR, - error->message); + "%s", error->message); g_clear_error (&error); } } diff --git a/app/plug-in/gimpplugin-message.c b/app/plug-in/gimpplugin-message.c index 6ea3a8d9e6..d3c35c979e 100644 --- a/app/plug-in/gimpplugin-message.c +++ b/app/plug-in/gimpplugin-message.c @@ -84,10 +84,11 @@ gimp_plug_in_handle_message (GimpPlugIn *plug_in, break; case GP_CONFIG: - g_message ("Plug-In \"%s\"\n(%s)\n\n" - "sent a CONFIG message. This should not happen.", - gimp_object_get_name (GIMP_OBJECT (plug_in)), - gimp_filename_to_utf8 (plug_in->prog)); + gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR, + "Plug-In \"%s\"\n(%s)\n\n" + "sent a CONFIG message. This should not happen.", + gimp_object_get_name (GIMP_OBJECT (plug_in)), + gimp_filename_to_utf8 (plug_in->prog)); gimp_plug_in_close (plug_in, TRUE); break; @@ -96,18 +97,20 @@ gimp_plug_in_handle_message (GimpPlugIn *plug_in, break; case GP_TILE_ACK: - g_message ("Plug-In \"%s\"\n(%s)\n\n" - "sent a TILE_ACK message. This should not happen.", - gimp_object_get_name (GIMP_OBJECT (plug_in)), - gimp_filename_to_utf8 (plug_in->prog)); + gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR, + "Plug-In \"%s\"\n(%s)\n\n" + "sent a TILE_ACK message. This should not happen.", + gimp_object_get_name (GIMP_OBJECT (plug_in)), + gimp_filename_to_utf8 (plug_in->prog)); gimp_plug_in_close (plug_in, TRUE); break; case GP_TILE_DATA: - g_message ("Plug-In \"%s\"\n(%s)\n\n" - "sent a TILE_DATA message. This should not happen.", - gimp_object_get_name (GIMP_OBJECT (plug_in)), - gimp_filename_to_utf8 (plug_in->prog)); + gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR, + "Plug-In \"%s\"\n(%s)\n\n" + "sent a TILE_DATA message. This should not happen.", + gimp_object_get_name (GIMP_OBJECT (plug_in)), + gimp_filename_to_utf8 (plug_in->prog)); gimp_plug_in_close (plug_in, TRUE); break; @@ -120,10 +123,11 @@ gimp_plug_in_handle_message (GimpPlugIn *plug_in, break; case GP_TEMP_PROC_RUN: - g_message ("Plug-In \"%s\"\n(%s)\n\n" - "sent a TEMP_PROC_RUN message. This should not happen.", - gimp_object_get_name (GIMP_OBJECT (plug_in)), - gimp_filename_to_utf8 (plug_in->prog)); + gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR, + "Plug-In \"%s\"\n(%s)\n\n" + "sent a TEMP_PROC_RUN message. This should not happen.", + gimp_object_get_name (GIMP_OBJECT (plug_in)), + gimp_filename_to_utf8 (plug_in->prog)); gimp_plug_in_close (plug_in, TRUE); break; @@ -184,21 +188,24 @@ gimp_plug_in_handle_tile_req (GimpPlugIn *plug_in, if (! gp_tile_data_write (plug_in->my_write, &tile_data, plug_in)) { - g_warning ("plug_in_handle_tile_req: ERROR"); + gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR, + "plug_in_handle_tile_req: ERROR"); gimp_plug_in_close (plug_in, TRUE); return; } if (! gimp_wire_read_msg (plug_in->my_read, &msg, plug_in)) { - g_warning ("plug_in_handle_tile_req: ERROR"); + gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR, + "plug_in_handle_tile_req: ERROR"); gimp_plug_in_close (plug_in, TRUE); return; } if (msg.type != GP_TILE_DATA) { - g_warning ("expected tile data and received: %d", msg.type); + gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR, + "expected tile data and received: %d", msg.type); gimp_plug_in_close (plug_in, TRUE); return; } @@ -210,10 +217,11 @@ gimp_plug_in_handle_tile_req (GimpPlugIn *plug_in, if (! GIMP_IS_DRAWABLE (drawable)) { - g_message ("Plug-In \"%s\"\n(%s)\n\n" - "requested invalid drawable (killing)", - gimp_object_get_name (GIMP_OBJECT (plug_in)), - gimp_filename_to_utf8 (plug_in->prog)); + gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR, + "Plug-In \"%s\"\n(%s)\n\n" + "requested invalid drawable (killing)", + gimp_object_get_name (GIMP_OBJECT (plug_in)), + gimp_filename_to_utf8 (plug_in->prog)); gimp_plug_in_close (plug_in, TRUE); return; } @@ -227,10 +235,11 @@ gimp_plug_in_handle_tile_req (GimpPlugIn *plug_in, if (! tile) { - g_message ("Plug-In \"%s\"\n(%s)\n\n" - "requested invalid tile (killing)", - gimp_object_get_name (GIMP_OBJECT (plug_in)), - gimp_filename_to_utf8 (plug_in->prog)); + gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR, + "Plug-In \"%s\"\n(%s)\n\n" + "requested invalid tile (killing)", + gimp_object_get_name (GIMP_OBJECT (plug_in)), + gimp_filename_to_utf8 (plug_in->prog)); gimp_plug_in_close (plug_in, TRUE); return; } @@ -249,7 +258,8 @@ gimp_plug_in_handle_tile_req (GimpPlugIn *plug_in, if (! gp_tile_ack_write (plug_in->my_write, plug_in)) { - g_warning ("plug_in_handle_tile_req: ERROR"); + gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR, + "plug_in_handle_tile_req: ERROR"); gimp_plug_in_close (plug_in, TRUE); return; } @@ -263,10 +273,11 @@ gimp_plug_in_handle_tile_req (GimpPlugIn *plug_in, if (! GIMP_IS_DRAWABLE (drawable)) { - g_message ("Plug-In \"%s\"\n(%s)\n\n" - "requested invalid drawable (killing)", - gimp_object_get_name (GIMP_OBJECT (plug_in)), - gimp_filename_to_utf8 (plug_in->prog)); + gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR, + "Plug-In \"%s\"\n(%s)\n\n" + "requested invalid drawable (killing)", + gimp_object_get_name (GIMP_OBJECT (plug_in)), + gimp_filename_to_utf8 (plug_in->prog)); gimp_plug_in_close (plug_in, TRUE); return; } @@ -280,10 +291,11 @@ gimp_plug_in_handle_tile_req (GimpPlugIn *plug_in, if (! tile) { - g_message ("Plug-In \"%s\"\n(%s)\n\n" - "requested invalid tile (killing)", - gimp_object_get_name (GIMP_OBJECT (plug_in)), - gimp_filename_to_utf8 (plug_in->prog)); + gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR, + "Plug-In \"%s\"\n(%s)\n\n" + "requested invalid tile (killing)", + gimp_object_get_name (GIMP_OBJECT (plug_in)), + gimp_filename_to_utf8 (plug_in->prog)); gimp_plug_in_close (plug_in, TRUE); return; } @@ -305,7 +317,8 @@ gimp_plug_in_handle_tile_req (GimpPlugIn *plug_in, if (! gp_tile_data_write (plug_in->my_write, &tile_data, plug_in)) { - g_message ("plug_in_handle_tile_req: ERROR"); + gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR, + "plug_in_handle_tile_req: ERROR"); gimp_plug_in_close (plug_in, TRUE); return; } @@ -314,14 +327,16 @@ gimp_plug_in_handle_tile_req (GimpPlugIn *plug_in, if (! gimp_wire_read_msg (plug_in->my_read, &msg, plug_in)) { - g_message ("plug_in_handle_tile_req: ERROR"); + gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR, + "plug_in_handle_tile_req: ERROR"); gimp_plug_in_close (plug_in, TRUE); return; } if (msg.type != GP_TILE_ACK) { - g_warning ("expected tile ack and received: %d", msg.type); + gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR, + "expected tile ack and received: %d", msg.type); gimp_plug_in_close (plug_in, TRUE); return; } @@ -361,12 +376,13 @@ gimp_plug_in_handle_proc_run (GimpPlugIn *plug_in, if (plug_in->manager->gimp->pdb_compat_mode == GIMP_PDB_COMPAT_WARN) { - g_message ("WARNING: Plug-In \"%s\"\n(%s)\n" - "called deprecated procedure '%s'.\n" - "It should call '%s' instead!", - gimp_object_get_name (GIMP_OBJECT (plug_in)), - gimp_filename_to_utf8 (plug_in->prog), - canonical, proc_name); + gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_WARNING, + "Plug-In \"%s\"\n(%s)\n" + "called deprecated procedure '%s'.\n" + "It should call '%s' instead!", + gimp_object_get_name (GIMP_OBJECT (plug_in)), + gimp_filename_to_utf8 (plug_in->prog), + canonical, proc_name); } } } @@ -376,20 +392,22 @@ gimp_plug_in_handle_proc_run (GimpPlugIn *plug_in, { if (! strcmp (procedure->deprecated, "NONE")) { - g_message ("WARNING: Plug-In \"%s\"\n(%s)\n" - "called deprecated procedure '%s'.", - gimp_object_get_name (GIMP_OBJECT (plug_in)), - gimp_filename_to_utf8 (plug_in->prog), - canonical); + gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_WARNING, + "Plug-In \"%s\"\n(%s)\n" + "called deprecated procedure '%s'.", + gimp_object_get_name (GIMP_OBJECT (plug_in)), + gimp_filename_to_utf8 (plug_in->prog), + canonical); } else { - g_message ("WARNING: Plug-In \"%s\"\n(%s)\n" - "called deprecated procedure '%s'.\n" - "It should call '%s' instead!", - gimp_object_get_name (GIMP_OBJECT (plug_in)), - gimp_filename_to_utf8 (plug_in->prog), - canonical, procedure->deprecated); + gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_WARNING, + "WARNING: Plug-In \"%s\"\n(%s)\n" + "called deprecated procedure '%s'.\n" + "It should call '%s' instead!", + gimp_object_get_name (GIMP_OBJECT (plug_in)), + gimp_filename_to_utf8 (plug_in->prog), + canonical, procedure->deprecated); } } } @@ -428,7 +446,8 @@ gimp_plug_in_handle_proc_run (GimpPlugIn *plug_in, if (! gp_proc_return_write (plug_in->my_write, &proc_return, plug_in)) { - g_warning ("plug_in_handle_proc_run: ERROR"); + gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR, + "plug_in_handle_proc_run: ERROR"); gimp_plug_in_close (plug_in, TRUE); } @@ -478,11 +497,12 @@ gimp_plug_in_handle_temp_proc_return (GimpPlugIn *plug_in, } else { - g_message ("Plug-In \"%s\"\n(%s)\n\n" - "sent a TEMP_PROC_RETURN message while not running " - "a temporary procedure. This should not happen.", - gimp_object_get_name (GIMP_OBJECT (plug_in)), - gimp_filename_to_utf8 (plug_in->prog)); + gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR, + "Plug-In \"%s\"\n(%s)\n\n" + "sent a TEMP_PROC_RETURN message while not running " + "a temporary procedure. This should not happen.", + gimp_object_get_name (GIMP_OBJECT (plug_in)), + gimp_filename_to_utf8 (plug_in->prog)); gimp_plug_in_close (plug_in, TRUE); } } @@ -510,13 +530,14 @@ gimp_plug_in_handle_proc_install (GimpPlugIn *plug_in, && proc_install->params[i - 1].type != GIMP_PDB_INT32) { - g_message ("Plug-In \"%s\"\n(%s)\n\n" - "attempted to install procedure \"%s\" " - "which fails to comply with the array parameter " - "passing standard. Argument %d is noncompliant.", - gimp_object_get_name (GIMP_OBJECT (plug_in)), - gimp_filename_to_utf8 (plug_in->prog), - canonical, i); + gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR, + "Plug-In \"%s\"\n(%s)\n\n" + "attempted to install procedure \"%s\" " + "which fails to comply with the array parameter " + "passing standard. Argument %d is noncompliant.", + gimp_object_get_name (GIMP_OBJECT (plug_in)), + gimp_filename_to_utf8 (plug_in->prog), + canonical, i); g_free (canonical); return; } @@ -559,10 +580,11 @@ gimp_plug_in_handle_proc_install (GimpPlugIn *plug_in, if (! valid_utf8) { - g_message ("Plug-In \"%s\"\n(%s)\n\n" - "attempted to install a procedure with invalid UTF-8 strings.", - gimp_object_get_name (GIMP_OBJECT (plug_in)), - gimp_filename_to_utf8 (plug_in->prog)); + gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR, + "Plug-In \"%s\"\n(%s)\n\n" + "attempted to install a procedure with invalid UTF-8 strings.", + gimp_object_get_name (GIMP_OBJECT (plug_in)), + gimp_filename_to_utf8 (plug_in->prog)); g_free (canonical); return; } @@ -644,7 +666,8 @@ gimp_plug_in_handle_proc_install (GimpPlugIn *plug_in, proc_install->menu_path, &error)) { - g_message (error->message); + gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_WARNING, + "%s", error->message); g_clear_error (&error); } } @@ -697,11 +720,12 @@ gimp_plug_in_handle_extension_ack (GimpPlugIn *plug_in) } else { - g_message ("Plug-In \"%s\"\n(%s)\n\n" - "sent an EXTENSION_ACK message while not being started " - "as an extension. This should not happen.", - gimp_object_get_name (GIMP_OBJECT (plug_in)), - gimp_filename_to_utf8 (plug_in->prog)); + gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR, + "Plug-In \"%s\"\n(%s)\n\n" + "sent an EXTENSION_ACK message while not being started " + "as an extension. This should not happen.", + gimp_object_get_name (GIMP_OBJECT (plug_in)), + gimp_filename_to_utf8 (plug_in->prog)); gimp_plug_in_close (plug_in, TRUE); } } @@ -715,11 +739,12 @@ gimp_plug_in_handle_has_init (GimpPlugIn *plug_in) } else { - g_message ("Plug-In \"%s\"\n(%s)\n\n" - "sent an HAS_INIT message while not in query(). " - "This should not happen.", - gimp_object_get_name (GIMP_OBJECT (plug_in)), - gimp_filename_to_utf8 (plug_in->prog)); + gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR, + "Plug-In \"%s\"\n(%s)\n\n" + "sent an HAS_INIT message while not in query(). " + "This should not happen.", + gimp_object_get_name (GIMP_OBJECT (plug_in)), + gimp_filename_to_utf8 (plug_in->prog)); gimp_plug_in_close (plug_in, TRUE); } } diff --git a/app/plug-in/gimpplugin.c b/app/plug-in/gimpplugin.c index 066106efd3..e921e25c31 100644 --- a/app/plug-in/gimpplugin.c +++ b/app/plug-in/gimpplugin.c @@ -229,10 +229,11 @@ gimp_plug_in_open (GimpPlugIn *plug_in, */ if ((pipe (my_read) == -1) || (pipe (my_write) == -1)) { - g_message ("Unable to run plug-in \"%s\"\n(%s)\n\npipe() failed: %s", - gimp_object_get_name (GIMP_OBJECT (plug_in)), - gimp_filename_to_utf8 (plug_in->prog), - g_strerror (errno)); + gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR, + "Unable to run plug-in \"%s\"\n(%s)\n\npipe() failed: %s", + gimp_object_get_name (GIMP_OBJECT (plug_in)), + gimp_filename_to_utf8 (plug_in->prog), + g_strerror (errno)); return FALSE; } @@ -343,10 +344,11 @@ gimp_plug_in_open (GimpPlugIn *plug_in, &plug_in->pid, &error)) { - g_message ("Unable to run plug-in \"%s\"\n(%s)\n\n%s", - gimp_object_get_name (GIMP_OBJECT (plug_in)), - gimp_filename_to_utf8 (plug_in->prog), - error->message); + gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR, + "Unable to run plug-in \"%s\"\n(%s)\n\n%s", + gimp_object_get_name (GIMP_OBJECT (plug_in)), + gimp_filename_to_utf8 (plug_in->prog), + error->message); g_error_free (error); goto cleanup; } @@ -865,14 +867,15 @@ gimp_plug_in_menu_register (GimpPlugIn *plug_in, if (! proc) { - g_message ("Plug-in \"%s\"\n(%s)\n" - "attempted to register the menu item \"%s\" " - "for the procedure \"%s\".\n" - "It has however not installed that procedure. This " - "is not allowed.", - gimp_object_get_name (GIMP_OBJECT (plug_in)), - gimp_filename_to_utf8 (plug_in->prog), - menu_path, proc_name); + gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR, + "Plug-in \"%s\"\n(%s)\n" + "attempted to register the menu item \"%s\" " + "for the procedure \"%s\".\n" + "It has however not installed that procedure. This " + "is not allowed.", + gimp_object_get_name (GIMP_OBJECT (plug_in)), + gimp_filename_to_utf8 (plug_in->prog), + menu_path, proc_name); return FALSE; } @@ -894,23 +897,25 @@ gimp_plug_in_menu_register (GimpPlugIn *plug_in, if (! proc->menu_label) { - g_message ("Plug-in \"%s\"\n(%s)\n" - "attempted to register the menu item \"%s\" " - "for procedure \"%s\".\n" - "The menu label given in gimp_install_procedure() " - "already contained a path. To make this work, " - "pass just the menu's label to " - "gimp_install_procedure().", - gimp_object_get_name (GIMP_OBJECT (plug_in)), - gimp_filename_to_utf8 (plug_in->prog), - menu_path, proc_name); + gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR, + "Plug-in \"%s\"\n(%s)\n" + "attempted to register the menu item \"%s\" " + "for procedure \"%s\".\n" + "The menu label given in gimp_install_procedure() " + "already contained a path. To make this work, " + "pass just the menu's label to " + "gimp_install_procedure().", + gimp_object_get_name (GIMP_OBJECT (plug_in)), + gimp_filename_to_utf8 (plug_in->prog), + menu_path, proc_name); return FALSE; } if (! gimp_plug_in_procedure_add_menu_path (proc, menu_path, &error)) { - g_message (error->message); + gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR, + "%s", error->message); g_clear_error (&error); return FALSE; diff --git a/app/plug-in/gimppluginmanager-file.c b/app/plug-in/gimppluginmanager-file.c index 08a623c928..c3d09dc8d8 100644 --- a/app/plug-in/gimppluginmanager-file.c +++ b/app/plug-in/gimppluginmanager-file.c @@ -59,8 +59,9 @@ gimp_plug_in_manager_register_load_handler (GimpPlugInManager *manager, if (! file_proc) { - g_message ("attempt to register nonexistent load handler \"%s\"", - name); + gimp_message (manager->gimp, NULL, GIMP_MESSAGE_ERROR, + "attempt to register nonexistent load handler \"%s\"", + name); return FALSE; } @@ -73,8 +74,9 @@ gimp_plug_in_manager_register_load_handler (GimpPlugInManager *manager, ! G_IS_PARAM_SPEC_STRING (procedure->args[2]) || ! GIMP_IS_PARAM_SPEC_IMAGE_ID (procedure->values[0])) { - g_message ("load handler \"%s\" does not take the standard " - "load handler args", name); + gimp_message (manager->gimp, NULL, GIMP_MESSAGE_ERROR, + "load handler \"%s\" does not take the standard " + "load handler args", name); return FALSE; } @@ -109,8 +111,9 @@ gimp_plug_in_manager_register_save_handler (GimpPlugInManager *manager, if (! file_proc) { - g_message ("attempt to register nonexistent save handler \"%s\"", - name); + gimp_message (manager->gimp, NULL, GIMP_MESSAGE_ERROR, + "attempt to register nonexistent save handler \"%s\"", + name); return FALSE; } @@ -123,8 +126,9 @@ gimp_plug_in_manager_register_save_handler (GimpPlugInManager *manager, ! G_IS_PARAM_SPEC_STRING (procedure->args[3]) || ! G_IS_PARAM_SPEC_STRING (procedure->args[4])) { - g_message ("save handler \"%s\" does not take the standard " - "save handler args", name); + gimp_message (manager->gimp, NULL, GIMP_MESSAGE_ERROR, + "save handler \"%s\" does not take the standard " + "save handler args", name); return FALSE; } diff --git a/app/plug-in/gimppluginmanager.c b/app/plug-in/gimppluginmanager.c index 7107477d28..23aba4555b 100644 --- a/app/plug-in/gimppluginmanager.c +++ b/app/plug-in/gimppluginmanager.c @@ -385,7 +385,7 @@ gimp_plug_in_manager_restore (GimpPlugInManager *manager, else { if (error->code != GIMP_CONFIG_ERROR_OPEN_ENOENT) - g_message (error->message); + gimp_message (gimp, NULL, GIMP_MESSAGE_ERROR, "%s", error->message); g_clear_error (&error); } @@ -486,7 +486,7 @@ gimp_plug_in_manager_restore (GimpPlugInManager *manager, if (! plug_in_rc_write (manager->plug_in_defs, pluginrc, &error)) { - g_message ("%s", error->message); + gimp_message (gimp, NULL, GIMP_MESSAGE_ERROR, "%s", error->message); g_clear_error (&error); } diff --git a/app/text/gimptextlayer-xcf.c b/app/text/gimptextlayer-xcf.c index 3f3abeb5f2..fdd6b06ed5 100644 --- a/app/text/gimptextlayer-xcf.c +++ b/app/text/gimptextlayer-xcf.c @@ -70,15 +70,16 @@ gimp_text_layer_xcf_load_hack (GimpLayer **layer) if (error) { - g_message (_("Problems parsing the text parasite for layer '%s':\n" - "%s\n\n" - "Some text properties may be wrong. " - "Unless you want to edit the text layer, " - "you don't need to worry about this."), - gimp_object_get_name (GIMP_OBJECT (*layer)), - error->message); - - g_error_free (error); + gimp_message (gimp_item_get_image (GIMP_ITEM (*layer))->gimp, NULL, + GIMP_MESSAGE_ERROR, + _("Problems parsing the text parasite for layer '%s':\n" + "%s\n\n" + "Some text properties may be wrong. " + "Unless you want to edit the text layer, " + "you don't need to worry about this."), + gimp_object_get_name (GIMP_OBJECT (*layer)), + error->message); + g_clear_error (&error); } } else diff --git a/app/text/gimptextlayer.c b/app/text/gimptextlayer.c index 397e531535..d7c81d38a2 100644 --- a/app/text/gimptextlayer.c +++ b/app/text/gimptextlayer.c @@ -544,8 +544,9 @@ gimp_text_layer_render (GimpTextLayer *layer) if (gimp_container_is_empty (image->gimp->fonts)) { - g_message (_("Due to lack of any fonts, " - "text functionality is not available.")); + gimp_message (image->gimp, NULL, GIMP_MESSAGE_ERROR, + _("Due to lack of any fonts, " + "text functionality is not available.")); return FALSE; } diff --git a/app/widgets/gimpcontrollers.c b/app/widgets/gimpcontrollers.c index 9dd7183ce3..41b861f4cb 100644 --- a/app/widgets/gimpcontrollers.c +++ b/app/widgets/gimpcontrollers.c @@ -159,12 +159,13 @@ gimp_controllers_restore (Gimp *gimp, if (! gimp_config_deserialize_file (GIMP_CONFIG (manager->controllers), filename, NULL, &error)) { - g_message (error->message); + gimp_message (gimp, NULL, GIMP_MESSAGE_ERROR, + "%s", error->message); } } else { - g_message (error->message); + gimp_message (gimp, NULL, GIMP_MESSAGE_ERROR, "%s", error->message); } g_clear_error (&error); @@ -205,7 +206,7 @@ gimp_controllers_save (Gimp *gimp) header, footer, NULL, &error)) { - g_message (error->message); + gimp_message (gimp, NULL, GIMP_MESSAGE_ERROR, "%s", error->message); g_error_free (error); } diff --git a/app/widgets/gimpdataeditor.c b/app/widgets/gimpdataeditor.c index 5e33884baa..0549535e12 100644 --- a/app/widgets/gimpdataeditor.c +++ b/app/widgets/gimpdataeditor.c @@ -605,5 +605,16 @@ gimp_data_editor_save_dirty (GimpDataEditor *editor) GimpData *data = editor->data; if (data && data->dirty && data->writable) - gimp_data_factory_data_save_single (editor->data_factory, data); + { + GError *error = NULL; + + if (! gimp_data_factory_data_save_single (editor->data_factory, data, + &error)) + { + gimp_message (editor->data_factory->gimp, G_OBJECT (editor), + GIMP_MESSAGE_ERROR, + "%s", error->message); + g_clear_error (&error); + } + } } diff --git a/app/widgets/gimpdevices.c b/app/widgets/gimpdevices.c index 0d7e3c0aa8..7f757abdc5 100644 --- a/app/widgets/gimpdevices.c +++ b/app/widgets/gimpdevices.c @@ -180,7 +180,7 @@ gimp_devices_restore (Gimp *gimp) &error)) { if (error->code != GIMP_CONFIG_ERROR_OPEN_ENOENT) - g_message (error->message); + gimp_message (gimp, NULL, GIMP_MESSAGE_ERROR, "%s", error->message); g_error_free (error); /* don't bail out here */ @@ -228,7 +228,7 @@ gimp_devices_save (Gimp *gimp, NULL, &error)) { - g_message (error->message); + gimp_message (gimp, NULL, GIMP_MESSAGE_ERROR, "%s", error->message); g_error_free (error); } diff --git a/app/widgets/gimpdnd-xds.c b/app/widgets/gimpdnd-xds.c index ad9c931db1..ec73b2d050 100644 --- a/app/widgets/gimpdnd-xds.c +++ b/app/widgets/gimpdnd-xds.c @@ -170,8 +170,9 @@ gimp_dnd_xds_save_image (GdkDragContext *context, { gchar *filename = file_utils_uri_display_name (uri); - g_message (_("Saving '%s' failed:\n\n%s"), - filename, error->message); + gimp_message (image->gimp, NULL, GIMP_MESSAGE_ERROR, + _("Saving '%s' failed:\n\n%s"), + filename, error->message); g_free (filename); g_error_free (error); @@ -186,8 +187,9 @@ gimp_dnd_xds_save_image (GdkDragContext *context, gtk_selection_data_set (selection, selection->target, 8, (const guchar *) "E", 1); - g_message (_("The given filename does not have any known " - "file extension.")); + gimp_message (image->gimp, NULL, GIMP_MESSAGE_ERROR, + _("The given filename does not have any known " + "file extension.")); } g_free (uri); diff --git a/app/widgets/gimplayertreeview.c b/app/widgets/gimplayertreeview.c index 93906d7bcd..212f602d17 100644 --- a/app/widgets/gimplayertreeview.c +++ b/app/widgets/gimplayertreeview.c @@ -760,7 +760,9 @@ gimp_layer_tree_view_drop_uri_list (GimpContainerTreeView *view, { gchar *filename = file_utils_uri_display_name (uri); - g_message (_("Opening '%s' failed:\n\n%s"), filename, error->message); + gimp_message (image->gimp, NULL, GIMP_MESSAGE_ERROR, + _("Opening '%s' failed:\n\n%s"), + filename, error->message); g_clear_error (&error); g_free (filename); diff --git a/app/widgets/gimptoolbox-dnd.c b/app/widgets/gimptoolbox-dnd.c index 99cadb627b..dbb8ec947f 100644 --- a/app/widgets/gimptoolbox-dnd.c +++ b/app/widgets/gimptoolbox-dnd.c @@ -154,8 +154,9 @@ gimp_toolbox_drop_uri_list (GtkWidget *widget, { gchar *filename = file_utils_uri_display_name (uri); - g_message (_("Opening '%s' failed:\n\n%s"), - filename, error->message); + gimp_message (context->gimp, NULL, GIMP_MESSAGE_ERROR, + _("Opening '%s' failed:\n\n%s"), + filename, error->message); g_clear_error (&error); g_free (filename); diff --git a/app/widgets/gimptoolbox.c b/app/widgets/gimptoolbox.c index 942bd2eb86..bf72c74dc2 100644 --- a/app/widgets/gimptoolbox.c +++ b/app/widgets/gimptoolbox.c @@ -912,8 +912,9 @@ toolbox_paste_received (GtkClipboard *clipboard, { gchar *filename = file_utils_uri_display_name (copy); - g_message (_("Opening '%s' failed:\n\n%s"), - filename, error->message); + gimp_message (context->gimp, NULL, GIMP_MESSAGE_ERROR, + _("Opening '%s' failed:\n\n%s"), + filename, error->message); g_clear_error (&error); g_free (filename); diff --git a/app/widgets/gimpuimanager.c b/app/widgets/gimpuimanager.c index c1f2fdda6f..f4e59ff26f 100644 --- a/app/widgets/gimpuimanager.c +++ b/app/widgets/gimpuimanager.c @@ -692,18 +692,20 @@ gimp_ui_manager_entry_ensure (GimpUIManager *manager, if (error->domain == G_FILE_ERROR && error->code == G_FILE_ERROR_EXIST) { - g_message ("%s\n\n%s\n\n%s", - _("Your GIMP installation is incomplete:"), - error->message, - _("Plase make sure the menu XML files are correctly " - "installed.")); + gimp_message (manager->gimp, NULL, GIMP_MESSAGE_ERROR, + "%s\n\n%s\n\n%s", + _("Your GIMP installation is incomplete:"), + error->message, + _("Plase make sure the menu XML files are correctly " + "installed.")); } else { - g_message (_("There was an error parsing the menu definition " - "from %s: %s"), - gimp_filename_to_utf8 (entry->basename), - error->message); + gimp_message (manager->gimp, NULL, GIMP_MESSAGE_ERROR, + _("There was an error parsing the menu definition " + "from %s: %s"), + gimp_filename_to_utf8 (entry->basename), + error->message); } g_clear_error (&error); diff --git a/app/widgets/gimpvectorstreeview.c b/app/widgets/gimpvectorstreeview.c index 5618b01ae3..4d52a86d4c 100644 --- a/app/widgets/gimpvectorstreeview.c +++ b/app/widgets/gimpvectorstreeview.c @@ -236,7 +236,7 @@ gimp_vectors_tree_view_drop_svg (GimpContainerTreeView *tree_view, TRUE, TRUE, index, &error)) { gimp_message (image->gimp, G_OBJECT (tree_view), GIMP_MESSAGE_ERROR, - error->message); + "%s", error->message); g_clear_error (&error); } else diff --git a/tools/pdbgen/pdb/brush.pdb b/tools/pdbgen/pdb/brush.pdb index 3fbe52940d..17c60d61c1 100644 --- a/tools/pdbgen/pdb/brush.pdb +++ b/tools/pdbgen/pdb/brush.pdb @@ -218,7 +218,7 @@ sub brush_delete { if (! success) { gimp_message (gimp, G_OBJECT (progress), GIMP_MESSAGE_ERROR, - error->message); + "%s", error->message); g_clear_error (&error); } } diff --git a/tools/pdbgen/pdb/gradient.pdb b/tools/pdbgen/pdb/gradient.pdb index a05e7d5150..e1a2d7229a 100644 --- a/tools/pdbgen/pdb/gradient.pdb +++ b/tools/pdbgen/pdb/gradient.pdb @@ -185,7 +185,7 @@ sub gradient_delete { if (! success) { gimp_message (gimp, G_OBJECT (progress), GIMP_MESSAGE_ERROR, - error->message); + "%s", error->message); g_clear_error (&error); } } diff --git a/tools/pdbgen/pdb/palette.pdb b/tools/pdbgen/pdb/palette.pdb index a25625722b..4d95ebbd8f 100644 --- a/tools/pdbgen/pdb/palette.pdb +++ b/tools/pdbgen/pdb/palette.pdb @@ -187,7 +187,7 @@ sub palette_delete { if (! success) { gimp_message (gimp, G_OBJECT (progress), GIMP_MESSAGE_ERROR, - error->message); + "%s", error->message); g_clear_error (&error); } }