Added message severities and make sure all messages are routed through a

2006-10-09  Michael Natterer  <mitch@gimp.org>

	Added message severities and make sure all messages are routed
	through a central function, so redirecting to the error console or
	stderr work again:

	* app/core/core-enums.[ch]: added enum GimpMessageSeverity { INFO,
	WARNING, ERROR }.

	* app/core/gimp.[ch] (gimp_message)
	(gimp_message_valist): added severity parameter. Changed
	"GimpProgress *progress" parameter to "GObject *handler", where
	"handler" can be either a GimpProgress, a GtkWidget or NULL.

	* app/core/gimp-gui.[ch] (gimp_show_message): ditto. Honor
	--console-messages again. Always dispatch to the GUI message
	handler first if it exists.

	* app/gui/gui-message.[ch]: pass severity parameters around.

	(gui_message_error_dialog): if "handler" is a progress, dispatch
	the message to it first. If it is a widget (and *not* a progress),
	use a GtkMessageDialog on top of that widget's toplevel. Fall
	back to the usual GimpErrorDialog otherwise.

	* app/core/gimpprogress.[ch] (gimp_progress_message): added
	severity parameter. Also added boolean return value to the virtual
	function so it can decide to fail if it can't handle the message.

	* app/display/gimpdisplay.c: implement GimpProgress::message() and
	redirect the message to GimpDisplayShell.

	* app/display/gimpdisplayshell-progress.c: implement
	GimpProgress::message() and redirect the message to GimpStatusbar
	if it is not an error and if the status bar is visible.

	* app/display/gimpstatusbar.[ch]: implement GimpProgress::message(),
	but fail on messages that contain a newline. Show the right icons
	for the message severities (work in progress).

	* app/display/gimpdisplayshell.[ch]: removed
	gimp_display_shell_message() and its _valist() variant.

	* app/widgets/gimperrorconsole.[ch]: show the right icons for the
	message severities.

	* app/widgets/gimpthumbbox.c (gimp_thumb_box_progress_message):
	return TRUE to swallow all messages.

	* app/widgets/gimpwidgets-utils.[ch]: removed
	gimp_show_message_dialog(). Added gimp_get_message_stock_id().

	* app/errors.c
	* app/actions/edit-commands.c
	* app/actions/error-console-commands.c
	* app/actions/file-commands.c
	* app/actions/select-commands.c
	* app/actions/text-editor-commands.c
	* app/actions/vectors-commands.c
	* app/core/gimpimage-convert.c
	* app/core/gimpimagefile.c
	* app/dialogs/convert-dialog.c
	* app/dialogs/file-open-dialog.c
	* app/dialogs/file-open-location-dialog.c
	* app/dialogs/file-save-dialog.c
	* app/dialogs/palette-import-dialog.c
	* app/dialogs/stroke-dialog.c
	* app/display/gimpdisplayshell-dnd.c
	* app/pdb/gimppdb.c
	* app/plug-in/gimpplugin.c
	* app/tools/gimpimagemaptool.c
	* app/tools/gimptool.c
	* app/tools/gimpvectortool.c
	* app/widgets/gimpactionview.c
	* app/widgets/gimpcontrollerlist.c
	* app/widgets/gimppdbdialog.c
	* app/widgets/gimpvectorstreeview.c
	* app/xcf/xcf-load.c
	* app/xcf/xcf-save.c
	* app/xcf/xcf.c
	* tools/pdbgen/pdb/brush.pdb
	* tools/pdbgen/pdb/gradient.pdb
	* tools/pdbgen/pdb/image.pdb
	* tools/pdbgen/pdb/message.pdb
	* tools/pdbgen/pdb/palette.pdb: added severity parameter to
	gimp_message() calls. Convert all calls to
	gimp_show_message_dialog() and gimp_display_shell_message() to
	gimp_message(). Also converted some more g_message() calls.

	* app/pdb/brush_cmds.c
	* app/pdb/gradient_cmds.c
	* app/pdb/image_cmds.c
	* app/pdb/message_cmds.c
	* app/pdb/palette_cmds.c: regenerated.
This commit is contained in:
Michael Natterer 2006-10-09 08:17:22 +00:00 committed by Michael Natterer
parent a8855ae632
commit f5afb754a5
60 changed files with 712 additions and 416 deletions

View File

@ -1,3 +1,98 @@
2006-10-09 Michael Natterer <mitch@gimp.org>
Added message severities and make sure all messages are routed
through a central function, so redirecting to the error console or
stderr work again:
* app/core/core-enums.[ch]: added enum GimpMessageSeverity { INFO,
WARNING, ERROR }.
* app/core/gimp.[ch] (gimp_message)
(gimp_message_valist): added severity parameter. Changed
"GimpProgress *progress" parameter to "GObject *handler", where
"handler" can be either a GimpProgress, a GtkWidget or NULL.
* app/core/gimp-gui.[ch] (gimp_show_message): ditto. Honor
--console-messages again. Always dispatch to the GUI message
handler first if it exists.
* app/gui/gui-message.[ch]: pass severity parameters around.
(gui_message_error_dialog): if "handler" is a progress, dispatch
the message to it first. If it is a widget (and *not* a progress),
use a GtkMessageDialog on top of that widget's toplevel. Fall
back to the usual GimpErrorDialog otherwise.
* app/core/gimpprogress.[ch] (gimp_progress_message): added
severity parameter. Also added boolean return value to the virtual
function so it can decide to fail if it can't handle the message.
* app/display/gimpdisplay.c: implement GimpProgress::message() and
redirect the message to GimpDisplayShell.
* app/display/gimpdisplayshell-progress.c: implement
GimpProgress::message() and redirect the message to GimpStatusbar
if it is not an error and if the status bar is visible.
* app/display/gimpstatusbar.[ch]: implement GimpProgress::message(),
but fail on messages that contain a newline. Show the right icons
for the message severities (work in progress).
* app/display/gimpdisplayshell.[ch]: removed
gimp_display_shell_message() and its _valist() variant.
* app/widgets/gimperrorconsole.[ch]: show the right icons for the
message severities.
* app/widgets/gimpthumbbox.c (gimp_thumb_box_progress_message):
return TRUE to swallow all messages.
* app/widgets/gimpwidgets-utils.[ch]: removed
gimp_show_message_dialog(). Added gimp_get_message_stock_id().
* app/errors.c
* app/actions/edit-commands.c
* app/actions/error-console-commands.c
* app/actions/file-commands.c
* app/actions/select-commands.c
* app/actions/text-editor-commands.c
* app/actions/vectors-commands.c
* app/core/gimpimage-convert.c
* app/core/gimpimagefile.c
* app/dialogs/convert-dialog.c
* app/dialogs/file-open-dialog.c
* app/dialogs/file-open-location-dialog.c
* app/dialogs/file-save-dialog.c
* app/dialogs/palette-import-dialog.c
* app/dialogs/stroke-dialog.c
* app/display/gimpdisplayshell-dnd.c
* app/pdb/gimppdb.c
* app/plug-in/gimpplugin.c
* app/tools/gimpimagemaptool.c
* app/tools/gimptool.c
* app/tools/gimpvectortool.c
* app/widgets/gimpactionview.c
* app/widgets/gimpcontrollerlist.c
* app/widgets/gimppdbdialog.c
* app/widgets/gimpvectorstreeview.c
* app/xcf/xcf-load.c
* app/xcf/xcf-save.c
* app/xcf/xcf.c
* tools/pdbgen/pdb/brush.pdb
* tools/pdbgen/pdb/gradient.pdb
* tools/pdbgen/pdb/image.pdb
* tools/pdbgen/pdb/message.pdb
* tools/pdbgen/pdb/palette.pdb: added severity parameter to
gimp_message() calls. Convert all calls to
gimp_show_message_dialog() and gimp_display_shell_message() to
gimp_message(). Also converted some more g_message() calls.
* app/pdb/brush_cmds.c
* app/pdb/gradient_cmds.c
* app/pdb/image_cmds.c
* app/pdb/message_cmds.c
* app/pdb/palette_cmds.c: regenerated.
2006-10-07 Manish Singh <yosh@gimp.org>
* plug-ins/pygimp/gimpfu.py: Don't use Python 2.4 specific functions,

View File

@ -265,7 +265,8 @@ edit_paste_as_new_cmd_callback (GtkAction *action,
}
else
{
g_message (_("There is no image data in the clipboard to paste."));
gimp_message (gimp, NULL, GIMP_MESSAGE_WARNING,
_("There is no image data in the clipboard to paste."));
}
}
@ -418,9 +419,9 @@ edit_paste (GimpDisplay *display,
}
else
{
gimp_display_shell_message (GIMP_DISPLAY_SHELL (display->shell),
_("There is no image data in "
"the clipboard to paste."));
gimp_message (display->image->gimp, G_OBJECT (display),
GIMP_MESSAGE_WARNING,
_("There is no image data in the clipboard to paste."));
}
}
}
@ -437,7 +438,8 @@ cut_named_buffer_callback (GtkWidget *widget,
if (! drawable)
{
g_message (_("There is no active layer or channel to cut from."));
gimp_message (image->gimp, NULL, GIMP_MESSAGE_WARNING,
_("There is no active layer or channel to cut from."));
return;
}
@ -463,7 +465,8 @@ copy_named_buffer_callback (GtkWidget *widget,
if (! drawable)
{
g_message (_("There is no active layer or channel to copy from."));
gimp_message (image->gimp, NULL, GIMP_MESSAGE_WARNING,
_("There is no active layer or channel to copy from."));
return;
}

View File

@ -25,6 +25,8 @@
#include "actions-types.h"
#include "core/gimp.h"
#include "widgets/gimperrorconsole.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpwidgets-utils.h"
@ -78,8 +80,8 @@ error_console_save_cmd_callback (GtkAction *action,
if (value && ! gtk_text_buffer_get_selection_bounds (console->text_buffer,
NULL, NULL))
{
gimp_show_message_dialog (GTK_WIDGET (console), GTK_MESSAGE_WARNING,
_("Cannot save. Nothing is selected."));
gimp_message (console->gimp, G_OBJECT (console), GIMP_MESSAGE_WARNING,
_("Cannot save. Nothing is selected."));
return;
}
@ -147,10 +149,10 @@ error_console_save_response (GtkWidget *dialog,
if (! gimp_text_buffer_save (console->text_buffer, filename,
console->save_selection, &error))
{
gimp_show_message_dialog (dialog, GTK_MESSAGE_ERROR,
_("Error writing file '%s':\n%s"),
gimp_filename_to_utf8 (filename),
error->message);
gimp_message (console->gimp, G_OBJECT (dialog), GIMP_MESSAGE_ERROR,
_("Error writing file '%s':\n%s"),
gimp_filename_to_utf8 (filename),
error->message);
g_clear_error (&error);
g_free (filename);
return;

View File

@ -173,8 +173,9 @@ file_last_opened_cmd_callback (GtkAction *action,
gchar *filename =
file_utils_uri_display_name (GIMP_OBJECT (imagefile)->name);
g_message (_("Opening '%s' failed:\n\n%s"),
filename, error->message);
gimp_message (gimp, NULL, GIMP_MESSAGE_ERROR,
_("Opening '%s' failed:\n\n%s"),
filename, error->message);
g_clear_error (&error);
g_free (filename);
@ -219,6 +220,7 @@ file_save_cmd_callback (GtkAction *action,
GimpPDBStatusType status;
GError *error = NULL;
GList *list;
gchar *filename;
for (list = gimp_action_groups_from_name ("file");
list;
@ -233,19 +235,31 @@ file_save_cmd_callback (GtkAction *action,
uri, save_proc,
GIMP_RUN_WITH_LAST_VALS, FALSE, &error);
if (status != GIMP_PDB_SUCCESS &&
status != GIMP_PDB_CANCEL)
{
gchar *filename = file_utils_uri_display_name (uri);
filename = file_utils_uri_display_name (uri);
gimp_message (image->gimp, GIMP_PROGRESS (display),
switch (status)
{
case GIMP_PDB_SUCCESS:
gimp_message (image->gimp, G_OBJECT (display), GIMP_MESSAGE_INFO,
_("Image saved to '%s'"),
filename);
break;
case GIMP_PDB_CANCEL:
gimp_message (image->gimp, G_OBJECT (display), GIMP_MESSAGE_INFO,
_("Saving canceled"));
break;
default:
gimp_message (image->gimp, G_OBJECT (display), GIMP_MESSAGE_ERROR,
_("Saving '%s' failed:\n\n%s"),
filename, error->message);
g_clear_error (&error);
g_free (filename);
break;
}
g_free (filename);
for (list = gimp_action_groups_from_name ("file");
list;
list = g_list_next (list))
@ -326,7 +340,7 @@ file_revert_cmd_callback (GtkAction *action,
if (! uri)
{
gimp_message (image->gimp, GIMP_PROGRESS (display),
gimp_message (image->gimp, G_OBJECT (display), GIMP_MESSAGE_ERROR,
_("Revert failed. "
"No file name associated with this image."));
}
@ -567,7 +581,7 @@ file_revert_confirm_response (GtkWidget *dialog,
{
gchar *filename = file_utils_uri_display_name (uri);
gimp_message (gimp, GIMP_PROGRESS (display),
gimp_message (gimp, G_OBJECT (display), GIMP_MESSAGE_ERROR,
_("Reverting to '%s' failed:\n\n%s"),
filename, error->message);
g_clear_error (&error);

View File

@ -286,7 +286,8 @@ select_stroke_cmd_callback (GtkAction *action,
if (! drawable)
{
g_message (_("There is no active layer or channel to stroke to."));
gimp_message (image->gimp, NULL, GIMP_MESSAGE_WARNING,
_("There is no active layer or channel to stroke to."));
return;
}
@ -314,7 +315,8 @@ select_stroke_last_vals_cmd_callback (GtkAction *action,
if (! drawable)
{
g_message (_("There is no active layer or channel to stroke to."));
gimp_message (image->gimp, NULL, GIMP_MESSAGE_WARNING,
_("There is no active layer or channel to stroke to."));
return;
}

View File

@ -25,8 +25,11 @@
#include "actions-types.h"
#include "core/gimp.h"
#include "widgets/gimptexteditor.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpuimanager.h"
#include "widgets/gimpwidgets-utils.h"
#include "text-editor-commands.h"
@ -134,10 +137,11 @@ text_editor_load_response (GtkWidget *dialog,
if (! gimp_text_buffer_load (buffer, filename, &error))
{
gimp_show_message_dialog (dialog, GTK_MESSAGE_ERROR,
_("Could not open '%s' for reading: %s"),
gimp_filename_to_utf8 (filename),
error->message);
gimp_message (editor->ui_manager->gimp, G_OBJECT (dialog),
GIMP_MESSAGE_ERROR,
_("Could not open '%s' for reading: %s"),
gimp_filename_to_utf8 (filename),
error->message);
g_clear_error (&error);
g_free (filename);
return;

View File

@ -356,7 +356,8 @@ vectors_stroke_cmd_callback (GtkAction *action,
if (! drawable)
{
g_message (_("There is no active layer or channel to stroke to."));
gimp_message (image->gimp, NULL, GIMP_MESSAGE_WARNING,
_("There is no active layer or channel to stroke to."));
return;
}
@ -385,7 +386,8 @@ vectors_stroke_last_vals_cmd_callback (GtkAction *action,
if (! drawable)
{
g_message (_("There is no active layer or channel to stroke to."));
gimp_message (image->gimp, NULL, GIMP_MESSAGE_WARNING,
_("There is no active layer or channel to stroke to."));
return;
}
@ -440,7 +442,8 @@ vectors_paste_cmd_callback (GtkAction *action,
if (! gimp_vectors_import_buffer (image, svg, svg_size,
TRUE, TRUE, -1, &error))
{
g_message (error->message);
gimp_message (image->gimp, NULL, GIMP_MESSAGE_ERROR,
error->message);
g_clear_error (&error);
}
else
@ -621,7 +624,8 @@ vectors_import_response (GtkWidget *widget,
}
else
{
g_message (error->message);
gimp_message (dialog->image->gimp, NULL, GIMP_MESSAGE_ERROR,
error->message);
g_error_free (error);
}
@ -651,7 +655,8 @@ vectors_export_response (GtkWidget *widget,
if (! gimp_vectors_export_file (dialog->image, vectors, filename, &error))
{
g_message (error->message);
gimp_message (dialog->image->gimp, NULL, GIMP_MESSAGE_ERROR,
error->message);
g_error_free (error);
}

View File

@ -1210,6 +1210,36 @@ gimp_select_criterion_get_type (void)
return type;
}
GType
gimp_message_severity_get_type (void)
{
static const GEnumValue values[] =
{
{ GIMP_MESSAGE_INFO, "GIMP_MESSAGE_INFO", "info" },
{ GIMP_MESSAGE_WARNING, "GIMP_MESSAGE_WARNING", "warning" },
{ GIMP_MESSAGE_ERROR, "GIMP_MESSAGE_ERROR", "error" },
{ 0, NULL, NULL }
};
static const GimpEnumDesc descs[] =
{
{ GIMP_MESSAGE_INFO, N_("Message"), NULL },
{ GIMP_MESSAGE_WARNING, N_("Warning"), NULL },
{ GIMP_MESSAGE_ERROR, N_("Error"), NULL },
{ 0, NULL, NULL }
};
static GType type = 0;
if (! type)
{
type = g_enum_register_static ("GimpMessageSeverity", values);
gimp_enum_set_value_descriptions (type, descs);
}
return type;
}
/* Generated data ends here */

View File

@ -549,7 +549,7 @@ typedef enum
GType gimp_select_criterion_get_type (void) G_GNUC_CONST;
typedef enum
typedef enum
{
GIMP_SELECT_CRITERION_COMPOSITE, /*< desc="Composite" >*/
GIMP_SELECT_CRITERION_R, /*< desc="Red" >*/
@ -561,6 +561,18 @@ typedef enum
} GimpSelectCriterion;
#define GIMP_TYPE_MESSAGE_SEVERITY (gimp_message_severity_get_type ())
GType gimp_message_severity_get_type (void) G_GNUC_CONST;
typedef enum /*< pdb-skip >*/
{
GIMP_MESSAGE_INFO, /*< desc="Message" >*/
GIMP_MESSAGE_WARNING, /*< desc="Warning" >*/
GIMP_MESSAGE_ERROR /*< desc="Error" >*/
} GimpMessageSeverity;
/*
* non-registered enums; register them if needed
*/

View File

@ -149,31 +149,41 @@ gimp_unset_busy (Gimp *gimp)
}
void
gimp_show_message (Gimp *gimp,
GimpProgress *progress,
const gchar *domain,
const gchar *message)
gimp_show_message (Gimp *gimp,
GObject *handler,
GimpMessageSeverity severity,
const gchar *domain,
const gchar *message)
{
const gchar *desc = "Message";
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress));
g_return_if_fail (handler == NULL || G_IS_OBJECT (handler));
g_return_if_fail (message != NULL);
if (! domain)
domain = GIMP_ACRONYM;
if (progress &&
gimp_progress_message (progress, gimp, domain, message))
if (! gimp->console_messages)
{
/* message has already been handled by GimpProgress */
}
else if (gimp->gui.show_message && ! gimp->console_messages)
{
gimp->gui.show_message (gimp, progress, domain, message);
}
else
{
g_printerr ("%s: %s\n\n", domain, message);
if (gimp->gui.show_message)
{
gimp->gui.show_message (gimp, handler,
severity, domain, message);
return;
}
else if (GIMP_IS_PROGRESS (handler) &&
gimp_progress_message (GIMP_PROGRESS (handler), gimp,
severity, domain, message))
{
/* message has been handled by GimpProgress */
return;
}
}
gimp_enum_get_value (GIMP_TYPE_MESSAGE_SEVERITY, severity,
NULL, NULL, &desc, NULL);
g_printerr ("%s-%s: %s\n\n", domain, desc, message);
}
void

View File

@ -33,7 +33,8 @@ struct _GimpGui
void (* unset_busy) (Gimp *gimp);
void (* show_message) (Gimp *gimp,
GimpProgress *progress,
GObject *handler,
GimpMessageSeverity severity,
const gchar *domain,
const gchar *message);
void (* help) (Gimp *gimp,
@ -110,7 +111,8 @@ void gimp_set_busy_until_idle (Gimp *gimp);
void gimp_unset_busy (Gimp *gimp);
void gimp_show_message (Gimp *gimp,
GimpProgress *progress,
GObject *handler,
GimpMessageSeverity severity,
const gchar *domain,
const gchar *message);
void gimp_help (Gimp *gimp,

View File

@ -994,34 +994,37 @@ gimp_get_tool_info (Gimp *gimp,
}
void
gimp_message (Gimp *gimp,
GimpProgress *progress,
const gchar *format,
gimp_message (Gimp *gimp,
GObject *handler,
GimpMessageSeverity severity,
const gchar *format,
...)
{
va_list args;
va_start (args, format);
gimp_message_valist (gimp, progress, format, args);
gimp_message_valist (gimp, handler, severity, format, args);
va_end (args);
}
void
gimp_message_valist (Gimp *gimp,
GimpProgress *progress,
const gchar *format,
va_list args)
gimp_message_valist (Gimp *gimp,
GObject *handler,
GimpMessageSeverity severity,
const gchar *format,
va_list args)
{
gchar *message;
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress));
g_return_if_fail (handler == NULL || G_IS_OBJECT (handler));
g_return_if_fail (format != NULL);
message = g_strdup_vprintf (format, args);
gimp_show_message (gimp, progress, NULL, message);
gimp_show_message (gimp, handler, severity, NULL, message);
g_free (message);
}

View File

@ -175,11 +175,13 @@ GimpToolInfo * gimp_get_tool_info (Gimp *gimp,
const gchar *tool_name);
void gimp_message (Gimp *gimp,
GimpProgress *progress,
GObject *handler,
GimpMessageSeverity severity,
const gchar *format,
...) G_GNUC_PRINTF(3,4);
...) G_GNUC_PRINTF(4,5);
void gimp_message_valist (Gimp *gimp,
GimpProgress *progress,
GObject *handler,
GimpMessageSeverity severity,
const gchar *format,
va_list args);

View File

@ -789,7 +789,7 @@ gimp_image_convert (GimpImage *image,
if (custom_palette->n_colors < 1)
{
gimp_message (image->gimp, progress,
gimp_message (image->gimp, G_OBJECT (progress), GIMP_MESSAGE_ERROR,
_("Cannot convert image: palette is empty."));
return;
}

View File

@ -290,7 +290,8 @@ gimp_imagefile_create_thumbnail (GimpImagefile *imagefile,
if (! success)
{
gimp_message (imagefile->gimp, progress, error->message);
gimp_message (imagefile->gimp, G_OBJECT (progress),
GIMP_MESSAGE_ERROR, error->message);
g_error_free (error);
}
}

View File

@ -219,23 +219,23 @@ gimp_progress_get_window (GimpProgress *progress)
}
gboolean
gimp_progress_message (GimpProgress *progress,
Gimp *gimp,
const gchar *domain,
const gchar *message)
gimp_progress_message (GimpProgress *progress,
Gimp *gimp,
GimpMessageSeverity severity,
const gchar *domain,
const gchar *message)
{
GimpProgressInterface *progress_iface;
g_return_val_if_fail (GIMP_IS_PROGRESS (progress), FALSE);
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
g_return_val_if_fail (domain != NULL, FALSE);
g_return_val_if_fail (message != NULL, FALSE);
progress_iface = GIMP_PROGRESS_GET_INTERFACE (progress);
if (progress_iface->message)
{
progress_iface->message (progress, gimp, domain, message);
return TRUE;
}
return progress_iface->message (progress, gimp, severity, domain, message);
return FALSE;
}

View File

@ -36,59 +36,61 @@ struct _GimpProgressInterface
GTypeInterface base_iface;
/* virtual functions */
GimpProgress * (* start) (GimpProgress *progress,
const gchar *message,
gboolean cancelable);
void (* end) (GimpProgress *progress);
gboolean (* is_active) (GimpProgress *progress);
GimpProgress * (* start) (GimpProgress *progress,
const gchar *message,
gboolean cancelable);
void (* end) (GimpProgress *progress);
gboolean (* is_active) (GimpProgress *progress);
void (* set_text) (GimpProgress *progress,
const gchar *message);
void (* set_value) (GimpProgress *progress,
gdouble percentage);
gdouble (* get_value) (GimpProgress *progress);
void (* pulse) (GimpProgress *progress);
void (* set_text) (GimpProgress *progress,
const gchar *message);
void (* set_value) (GimpProgress *progress,
gdouble percentage);
gdouble (* get_value) (GimpProgress *progress);
void (* pulse) (GimpProgress *progress);
guint32 (* get_window) (GimpProgress *progress);
guint32 (* get_window) (GimpProgress *progress);
void (* message) (GimpProgress *progress,
Gimp *gimp,
const gchar *domain,
const gchar *message);
gboolean (* message) (GimpProgress *progress,
Gimp *gimp,
GimpMessageSeverity severity,
const gchar *domain,
const gchar *message);
/* signals */
void (* cancel) (GimpProgress *progress);
void (* cancel) (GimpProgress *progress);
};
GType gimp_progress_interface_get_type (void) G_GNUC_CONST;
GimpProgress * gimp_progress_start (GimpProgress *progress,
const gchar *message,
gboolean cancelable);
void gimp_progress_end (GimpProgress *progress);
gboolean gimp_progress_is_active (GimpProgress *progress);
GimpProgress * gimp_progress_start (GimpProgress *progress,
const gchar *message,
gboolean cancelable);
void gimp_progress_end (GimpProgress *progress);
gboolean gimp_progress_is_active (GimpProgress *progress);
void gimp_progress_set_text (GimpProgress *progress,
const gchar *message);
void gimp_progress_set_value (GimpProgress *progress,
gdouble percentage);
gdouble gimp_progress_get_value (GimpProgress *progress);
void gimp_progress_pulse (GimpProgress *progress);
void gimp_progress_set_text (GimpProgress *progress,
const gchar *message);
void gimp_progress_set_value (GimpProgress *progress,
gdouble percentage);
gdouble gimp_progress_get_value (GimpProgress *progress);
void gimp_progress_pulse (GimpProgress *progress);
guint32 gimp_progress_get_window (GimpProgress *progress);
guint32 gimp_progress_get_window (GimpProgress *progress);
gboolean gimp_progress_message (GimpProgress *progress,
Gimp *gimp,
const gchar *domain,
const gchar *message);
gboolean gimp_progress_message (GimpProgress *progress,
Gimp *gimp,
GimpMessageSeverity severity,
const gchar *domain,
const gchar *message);
void gimp_progress_cancel (GimpProgress *progress);
void gimp_progress_cancel (GimpProgress *progress);
void gimp_progress_update_and_flush (gint min,
gint max,
gint current,
gpointer data);
void gimp_progress_update_and_flush (gint min,
gint max,
gint current,
gpointer data);
#endif /* __GIMP_PROGRESS_H__ */

View File

@ -394,9 +394,10 @@ convert_dialog_palette_changed (GimpContext *context,
if (palette->n_colors > 256)
{
gimp_show_message_dialog (dialog->dialog, GTK_MESSAGE_WARNING,
_("Cannot convert to a palette "
"with more than 256 colors."));
gimp_message (dialog->image->gimp, G_OBJECT (dialog->dialog),
GIMP_MESSAGE_WARNING,
_("Cannot convert to a palette "
"with more than 256 colors."));
}
else
{

View File

@ -200,7 +200,7 @@ file_open_dialog_open_image (GtkWidget *open_dialog,
{
gchar *filename = file_utils_uri_display_name (uri);
gimp_message (gimp, GIMP_PROGRESS (open_dialog),
gimp_message (gimp, G_OBJECT (open_dialog), GIMP_MESSAGE_ERROR,
_("Opening '%s' failed:\n\n%s"), filename, error->message);
g_clear_error (&error);
@ -251,7 +251,7 @@ file_open_dialog_open_layer (GtkWidget *open_dialog,
{
gchar *filename = file_utils_uri_display_name (uri);
gimp_message (image->gimp, GIMP_PROGRESS (open_dialog),
gimp_message (image->gimp, G_OBJECT (open_dialog), GIMP_MESSAGE_ERROR,
_("Opening '%s' failed:\n\n%s"), filename, error->message);
g_clear_error (&error);

View File

@ -212,7 +212,7 @@ file_open_location_response (GtkDialog *dialog,
{
gchar *filename = file_utils_uri_display_name (uri);
gimp_message (gimp, GIMP_PROGRESS (box),
gimp_message (gimp, G_OBJECT (box), GIMP_MESSAGE_ERROR,
_("Opening '%s' failed:\n\n%s"),
filename, error->message);
g_clear_error (&error);
@ -224,7 +224,7 @@ file_open_location_response (GtkDialog *dialog,
}
else
{
gimp_message (gimp, GIMP_PROGRESS (box),
gimp_message (gimp, G_OBJECT (box), GIMP_MESSAGE_ERROR,
_("Opening '%s' failed:\n\n%s"),
text, error->message);
g_clear_error (&error);

View File

@ -282,7 +282,7 @@ file_save_dialog_check_uri (GtkWidget *save_dialog,
G_STRFUNC);
#endif
gimp_message (gimp, GIMP_PROGRESS (save_dialog),
gimp_message (gimp, G_OBJECT (save_dialog), GIMP_MESSAGE_WARNING,
_("The given filename does not have any known "
"file extension. Please enter a known file "
"extension or select a file format from the "
@ -325,7 +325,7 @@ file_save_dialog_check_uri (GtkWidget *save_dialog,
G_STRFUNC);
#endif
gimp_message (gimp, GIMP_PROGRESS (save_dialog),
gimp_message (gimp, G_OBJECT (save_dialog), GIMP_MESSAGE_WARNING,
_("The given filename does not have any known "
"file extension. Please enter a known file "
"extension or select a file format from the "
@ -367,7 +367,7 @@ file_save_dialog_check_uri (GtkWidget *save_dialog,
/* remote URI */
gimp_message (gimp, GIMP_PROGRESS (save_dialog),
gimp_message (gimp, G_OBJECT (save_dialog), GIMP_MESSAGE_WARNING,
_("Saving remote files needs to determine the "
"file format from the file extension. "
"Please enter a file extension that matches "
@ -504,7 +504,7 @@ file_save_dialog_save_image (GtkWidget *save_dialog,
{
gchar *filename = file_utils_uri_display_name (uri);
gimp_message (image->gimp, GIMP_PROGRESS (save_dialog),
gimp_message (image->gimp, G_OBJECT (save_dialog), GIMP_MESSAGE_ERROR,
_("Saving '%s' failed:\n\n%s"), filename, error->message);
g_clear_error (&error);

View File

@ -846,8 +846,9 @@ palette_import_make_palette (ImportDialog *dialog)
if (! palette)
{
gimp_show_message_dialog (dialog->dialog, GTK_MESSAGE_ERROR,
error->message);
gimp_message (dialog->context->gimp, G_OBJECT (dialog->dialog),
GIMP_MESSAGE_ERROR,
error->message);
g_error_free (error);
}
}

View File

@ -39,7 +39,6 @@
#include "widgets/gimpcontainerview.h"
#include "widgets/gimpviewabledialog.h"
#include "widgets/gimpstrokeeditor.h"
#include "widgets/gimpwidgets-utils.h"
#include "stroke-dialog.h"
@ -279,9 +278,10 @@ stroke_dialog_response (GtkWidget *widget,
if (! drawable)
{
gimp_show_message_dialog (widget, GTK_MESSAGE_WARNING,
_("There is no active layer or channel "
"to stroke to."));
gimp_message (context->gimp, G_OBJECT (widget),
GIMP_MESSAGE_WARNING,
_("There is no active layer or channel "
"to stroke to."));
return;
}

View File

@ -54,38 +54,43 @@ enum
static void gimp_display_progress_iface_init (GimpProgressInterface *iface);
static void gimp_display_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_display_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_display_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_display_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static GimpProgress *
gimp_display_progress_start (GimpProgress *progress,
const gchar *message,
gboolean cancelable);
static void gimp_display_progress_end (GimpProgress *progress);
static gboolean gimp_display_progress_is_active (GimpProgress *progress);
static void gimp_display_progress_set_text (GimpProgress *progress,
const gchar *message);
static void gimp_display_progress_set_value (GimpProgress *progress,
gdouble percentage);
static gdouble gimp_display_progress_get_value (GimpProgress *progress);
static void gimp_display_progress_pulse (GimpProgress *progress);
static guint32 gimp_display_progress_get_window (GimpProgress *progress);
static void gimp_display_progress_canceled (GimpProgress *progress,
GimpDisplay *display);
gimp_display_progress_start (GimpProgress *progress,
const gchar *message,
gboolean cancelable);
static void gimp_display_progress_end (GimpProgress *progress);
static gboolean gimp_display_progress_is_active (GimpProgress *progress);
static void gimp_display_progress_set_text (GimpProgress *progress,
const gchar *message);
static void gimp_display_progress_set_value (GimpProgress *progress,
gdouble percentage);
static gdouble gimp_display_progress_get_value (GimpProgress *progress);
static void gimp_display_progress_pulse (GimpProgress *progress);
static guint32 gimp_display_progress_get_window (GimpProgress *progress);
static gboolean gimp_display_progress_message (GimpProgress *progress,
Gimp *gimp,
GimpMessageSeverity severity,
const gchar *domain,
const gchar *message);
static void gimp_display_progress_canceled (GimpProgress *progress,
GimpDisplay *display);
static void gimp_display_flush_whenever (GimpDisplay *display,
gboolean now);
static void gimp_display_paint_area (GimpDisplay *display,
gint x,
gint y,
gint w,
gint h);
static void gimp_display_flush_whenever (GimpDisplay *display,
gboolean now);
static void gimp_display_paint_area (GimpDisplay *display,
gint x,
gint y,
gint w,
gint h);
G_DEFINE_TYPE_WITH_CODE (GimpDisplay, gimp_display, GIMP_TYPE_OBJECT,
@ -147,6 +152,7 @@ gimp_display_progress_iface_init (GimpProgressInterface *iface)
iface->get_value = gimp_display_progress_get_value;
iface->pulse = gimp_display_progress_pulse;
iface->get_window = gimp_display_progress_get_window;
iface->message = gimp_display_progress_message;
}
static void
@ -204,11 +210,11 @@ gimp_display_progress_start (GimpProgress *progress,
{
GimpDisplay *display = GIMP_DISPLAY (progress);
if (! display->shell)
return NULL;
if (display->shell)
return gimp_progress_start (GIMP_PROGRESS (display->shell),
message, cancelable);
return gimp_progress_start (GIMP_PROGRESS (display->shell),
message, cancelable);
return NULL;
}
static void
@ -225,10 +231,10 @@ gimp_display_progress_is_active (GimpProgress *progress)
{
GimpDisplay *display = GIMP_DISPLAY (progress);
if (! display->shell)
return FALSE;
if (display->shell)
return gimp_progress_is_active (GIMP_PROGRESS (display->shell));
return gimp_progress_is_active (GIMP_PROGRESS (display->shell));
return FALSE;
}
static void
@ -256,10 +262,10 @@ gimp_display_progress_get_value (GimpProgress *progress)
{
GimpDisplay *display = GIMP_DISPLAY (progress);
if (! display->shell)
return 0.0;
if (display->shell)
return gimp_progress_get_value (GIMP_PROGRESS (display->shell));
return gimp_progress_get_value (GIMP_PROGRESS (display->shell));
return 0.0;
}
static void
@ -276,10 +282,26 @@ gimp_display_progress_get_window (GimpProgress *progress)
{
GimpDisplay *display = GIMP_DISPLAY (progress);
if (! display->shell)
return 0;
if (display->shell)
return gimp_progress_get_window (GIMP_PROGRESS (display->shell));
return gimp_progress_get_window (GIMP_PROGRESS (display->shell));
return 0;
}
static gboolean
gimp_display_progress_message (GimpProgress *progress,
Gimp *gimp,
GimpMessageSeverity severity,
const gchar *domain,
const gchar *message)
{
GimpDisplay *display = GIMP_DISPLAY (progress);
if (display->shell)
return gimp_progress_message (GIMP_PROGRESS (display->shell), gimp,
severity, domain, message);
return FALSE;
}
static void

View File

@ -277,7 +277,7 @@ gimp_display_shell_drop_svg (GtkWidget *widget,
(const gchar *) svg_data, svg_data_len,
TRUE, TRUE, -1, &error))
{
gimp_message (image->gimp, GIMP_PROGRESS (shell->display),
gimp_message (image->gimp, G_OBJECT (shell->display), GIMP_MESSAGE_ERROR,
error->message);
g_clear_error (&error);
}
@ -448,7 +448,8 @@ gimp_display_shell_drop_uri_list (GtkWidget *widget,
{
gchar *filename = file_utils_uri_display_name (uri);
gimp_message (image->gimp, GIMP_PROGRESS (shell->display),
gimp_message (image->gimp, G_OBJECT (shell->display),
GIMP_MESSAGE_ERROR,
_("Opening '%s' failed:\n\n%s"),
filename, error->message);

View File

@ -28,6 +28,7 @@
#include "gimpdisplayshell.h"
#include "gimpdisplayshell-progress.h"
#include "gimpstatusbar.h"
static GimpProgress *
@ -99,6 +100,22 @@ gimp_display_shell_progress_get_window (GimpProgress *progress)
return (guint32) gimp_window_get_native (GTK_WINDOW (shell));
}
static gboolean
gimp_display_shell_progress_message (GimpProgress *progress,
Gimp *gimp,
GimpMessageSeverity severity,
const gchar *domain,
const gchar *message)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress);
if (severity != GIMP_MESSAGE_ERROR && GTK_WIDGET_VISIBLE (shell->statusbar))
return gimp_progress_message (GIMP_PROGRESS (shell->statusbar), gimp,
severity, domain, message);
return FALSE;
}
void
gimp_display_shell_progress_iface_init (GimpProgressInterface *iface)
{
@ -110,4 +127,5 @@ gimp_display_shell_progress_iface_init (GimpProgressInterface *iface)
iface->get_value = gimp_display_shell_progress_get_value;
iface->pulse = gimp_display_shell_progress_pulse;
iface->get_window = gimp_display_shell_progress_get_window;
iface->message = gimp_display_shell_progress_message;
}

View File

@ -1636,56 +1636,3 @@ gimp_display_shell_set_mask (GimpDisplayShell *shell,
gimp_display_shell_expose_full (shell);
}
/**
* gimp_display_shell_message:
* @shell: the #GimpDisplayShell
* @format: printf-like format string
* @...: arguments
*
* Display a message in the display shell. If the statusbar is
* visible, the message will appear there, otherwise a dialog window
* is opened.
*/
void
gimp_display_shell_message (GimpDisplayShell *shell,
const gchar *format,
...)
{
va_list args;
va_start (args, format);
gimp_display_shell_message_valist (shell, format, args);
va_end (args);
}
/**
* gimp_display_shell_message_valist:
* @shell: the #GimpDisplayShell
* @format: printf-like format string
* @args: arguments
*
* Display a message in the display shell. See gimp_display_shell_message()
* for details.
*/
void
gimp_display_shell_message_valist (GimpDisplayShell *shell,
const gchar *format,
va_list args)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (format != NULL);
if (GTK_WIDGET_VISIBLE (shell->statusbar))
{
gimp_statusbar_push_temp_valist (GIMP_STATUSBAR (shell->statusbar),
format, args);
}
else
{
gimp_message_valist (shell->display->image->gimp, GIMP_PROGRESS (shell),
format, args);
}
}

View File

@ -243,12 +243,5 @@ void gimp_display_shell_set_mask (GimpDisplayShell *shell,
GimpDrawable *mask,
GimpChannelType color);
void gimp_display_shell_message (GimpDisplayShell *shell,
const gchar *format,
...) G_GNUC_PRINTF(2,3);
void gimp_display_shell_message_valist (GimpDisplayShell *shell,
const gchar *format,
va_list args);
#endif /* __GIMP_DISPLAY_SHELL_H__ */

View File

@ -33,6 +33,7 @@
#include "widgets/gimpuimanager.h"
#include "widgets/gimpunitstore.h"
#include "widgets/gimpunitcombobox.h"
#include "widgets/gimpwidgets-utils.h"
#include "gimpdisplay.h"
#include "gimpdisplayshell.h"
@ -48,6 +49,7 @@ typedef struct _GimpStatusbarMsg GimpStatusbarMsg;
struct _GimpStatusbarMsg
{
guint context_id;
gchar *stock_id;
gchar *text;
};
@ -75,6 +77,11 @@ static void gimp_statusbar_progress_set_value (GimpProgress *progress,
gdouble percentage);
static gdouble gimp_statusbar_progress_get_value (GimpProgress *progress);
static void gimp_statusbar_progress_pulse (GimpProgress *progress);
static gboolean gimp_statusbar_progress_message (GimpProgress *progress,
Gimp *gimp,
GimpMessageSeverity severity,
const gchar *domain,
const gchar *message);
static void gimp_statusbar_progress_canceled (GtkWidget *button,
GimpStatusbar *statusbar);
@ -96,6 +103,8 @@ static guint gimp_statusbar_get_context_id (GimpStatusbar *statusbar,
const gchar *context);
static gboolean gimp_statusbar_temp_timeout (GimpStatusbar *statusbar);
static void gimp_statusbar_msg_free (GimpStatusbarMsg *msg);
G_DEFINE_TYPE_WITH_CODE (GimpStatusbar, gimp_statusbar, GTK_TYPE_HBOX,
G_IMPLEMENT_INTERFACE (GIMP_TYPE_PROGRESS,
@ -134,6 +143,7 @@ gimp_statusbar_progress_iface_init (GimpProgressInterface *iface)
iface->set_value = gimp_statusbar_progress_set_value;
iface->get_value = gimp_statusbar_progress_get_value;
iface->pulse = gimp_statusbar_progress_pulse;
iface->message = gimp_statusbar_progress_message;
}
static void
@ -252,16 +262,8 @@ static void
gimp_statusbar_finalize (GObject *object)
{
GimpStatusbar *statusbar = GIMP_STATUSBAR (object);
GSList *list;
for (list = statusbar->messages; list; list = list->next)
{
GimpStatusbarMsg *msg = list->data;
g_free (msg->text);
g_free (msg);
}
g_slist_foreach (statusbar->messages, (GFunc) gimp_statusbar_msg_free, NULL);
g_slist_free (statusbar->messages);
statusbar->messages = NULL;
@ -404,6 +406,25 @@ gimp_statusbar_progress_pulse (GimpProgress *progress)
}
}
static gboolean
gimp_statusbar_progress_message (GimpProgress *progress,
Gimp *gimp,
GimpMessageSeverity severity,
const gchar *domain,
const gchar *message)
{
GimpStatusbar *statusbar = GIMP_STATUSBAR (progress);
/* we can handle only one-liners */
if (strchr (message, '\n'))
return FALSE;
gimp_statusbar_push_temp (statusbar,
gimp_get_message_stock_id (severity), message);
return TRUE;
}
static void
gimp_statusbar_progress_canceled (GtkWidget *button,
GimpStatusbar *statusbar)
@ -524,8 +545,7 @@ gimp_statusbar_push_valist (GimpStatusbar *statusbar,
if (msg->context_id == context_id)
{
statusbar->messages = g_slist_remove (statusbar->messages, msg);
g_free (msg->text);
g_free (msg);
gimp_statusbar_msg_free (msg);
break;
}
@ -718,8 +738,7 @@ gimp_statusbar_pop (GimpStatusbar *statusbar,
if (msg->context_id == context_id)
{
statusbar->messages = g_slist_remove (statusbar->messages, msg);
g_free (msg->text);
g_free (msg);
gimp_statusbar_msg_free (msg);
break;
}
@ -730,6 +749,7 @@ gimp_statusbar_pop (GimpStatusbar *statusbar,
void
gimp_statusbar_push_temp (GimpStatusbar *statusbar,
const gchar *stock_id,
const gchar *format,
...)
{
@ -739,12 +759,13 @@ gimp_statusbar_push_temp (GimpStatusbar *statusbar,
g_return_if_fail (format != NULL);
va_start (args, format);
gimp_statusbar_push_temp_valist (statusbar, format, args);
gimp_statusbar_push_temp_valist (statusbar, stock_id, format, args);
va_end (args);
}
void
gimp_statusbar_push_temp_valist (GimpStatusbar *statusbar,
const gchar *stock_id,
const gchar *format,
va_list args)
{
@ -774,6 +795,9 @@ gimp_statusbar_push_temp_valist (GimpStatusbar *statusbar,
return;
}
g_free (msg->stock_id);
msg->stock_id = g_strdup (stock_id);
g_free (msg->text);
msg->text = message;
@ -785,6 +809,7 @@ gimp_statusbar_push_temp_valist (GimpStatusbar *statusbar,
msg = g_new0 (GimpStatusbarMsg, 1);
msg->context_id = statusbar->temp_context_id;
msg->stock_id = g_strdup (stock_id);
msg->text = message;
statusbar->messages = g_slist_prepend (statusbar->messages, msg);
@ -810,8 +835,7 @@ gimp_statusbar_pop_temp (GimpStatusbar *statusbar)
if (msg->context_id == statusbar->temp_context_id)
{
statusbar->messages = g_slist_remove (statusbar->messages, msg);
g_free (msg->text);
g_free (msg);
gimp_statusbar_msg_free (msg);
gimp_statusbar_update (statusbar);
}
@ -916,15 +940,23 @@ gimp_statusbar_progress_expose (GtkWidget *widget,
GdkEventExpose *event,
GimpStatusbar *statusbar)
{
GdkPixbuf *pixbuf;
gint text_xalign;
gint text_yalign;
gint x, y;
GdkPixbuf *pixbuf;
const gchar *stock_id = NULL;
gint text_xalign;
gint text_yalign;
gint x, y;
if (! statusbar->temp_timeout_id)
if (statusbar->messages)
{
GimpStatusbarMsg *msg = statusbar->messages->data;
stock_id = msg->stock_id;
}
if (! stock_id)
return FALSE;
pixbuf = gtk_widget_render_icon (widget, GIMP_STOCK_WARNING,
pixbuf = gtk_widget_render_icon (widget, stock_id,
GTK_ICON_SIZE_MENU, NULL);
g_object_get (widget,
@ -1074,3 +1106,11 @@ gimp_statusbar_temp_timeout (GimpStatusbar *statusbar)
return FALSE;
}
static void
gimp_statusbar_msg_free (GimpStatusbarMsg *msg)
{
g_free (msg->stock_id);
g_free (msg->text);
g_free (msg);
}

View File

@ -103,9 +103,11 @@ void gimp_statusbar_pop (GimpStatusbar *statusbar,
const gchar *context);
void gimp_statusbar_push_temp (GimpStatusbar *statusbar,
const gchar *stock_id,
const gchar *format,
...) G_GNUC_PRINTF(2,3);
...) G_GNUC_PRINTF(3,4);
void gimp_statusbar_push_temp_valist (GimpStatusbar *statusbar,
const gchar *stock_id,
const gchar *format,
va_list args);
void gimp_statusbar_pop_temp (GimpStatusbar *statusbar);

View File

@ -169,7 +169,7 @@ gimp_message_log_func (const gchar *log_domain,
if (gimp)
{
gimp_show_message (gimp, NULL, NULL, message);
gimp_show_message (gimp, NULL, GIMP_MESSAGE_WARNING, NULL, message);
}
else
{

View File

@ -22,6 +22,7 @@
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
@ -42,49 +43,57 @@
#include "dialogs/dialogs.h"
#include "gui-message.h"
#include "gimp-intl.h"
static gboolean gui_message_error_console (const gchar *domain,
const gchar *message);
static gboolean gui_message_error_dialog (GimpProgress *progress,
const gchar *domain,
const gchar *message);
static void gui_message_console (const gchar *domain,
const gchar *message);
static gboolean gui_message_error_console (GimpMessageSeverity severity,
const gchar *domain,
const gchar *message);
static gboolean gui_message_error_dialog (Gimp *gimp,
GObject *handler,
GimpMessageSeverity severity,
const gchar *domain,
const gchar *message);
static void gui_message_console (GimpMessageSeverity severity,
const gchar *domain,
const gchar *message);
void
gui_message (Gimp *gimp,
GimpProgress *progress,
const gchar *domain,
const gchar *message)
gui_message (Gimp *gimp,
GObject *handler,
GimpMessageSeverity severity,
const gchar *domain,
const gchar *message)
{
switch (gimp->message_handler)
{
case GIMP_ERROR_CONSOLE:
if (gui_message_error_console (domain, message))
if (gui_message_error_console (severity, domain, message))
return;
gimp->message_handler = GIMP_MESSAGE_BOX;
/* fallthru */
case GIMP_MESSAGE_BOX:
if (gui_message_error_dialog (progress, domain, message))
if (gui_message_error_dialog (gimp, handler, severity, domain, message))
return;
gimp->message_handler = GIMP_CONSOLE;
/* fallthru */
case GIMP_CONSOLE:
gui_message_console (domain, message);
gui_message_console (severity, domain, message);
break;
}
}
static gboolean
gui_message_error_console (const gchar *domain,
const gchar *message)
gui_message_error_console (GimpMessageSeverity severity,
const gchar *domain,
const gchar *message)
{
GtkWidget *dockable;
@ -95,7 +104,7 @@ gui_message_error_console (const gchar *domain,
if (dockable)
{
gimp_error_console_add (GIMP_ERROR_CONSOLE (GTK_BIN (dockable)->child),
GIMP_STOCK_WARNING, domain, message);
severity, domain, message);
return TRUE;
}
@ -158,21 +167,59 @@ global_error_dialog (void)
}
static gboolean
gui_message_error_dialog (GimpProgress *progress,
const gchar *domain,
const gchar *message)
gui_message_error_dialog (Gimp *gimp,
GObject *handler,
GimpMessageSeverity severity,
const gchar *domain,
const gchar *message)
{
GtkWidget *dialog;
if (progress && ! GIMP_IS_PROGRESS_DIALOG (progress))
dialog = progress_error_dialog (progress);
if (GIMP_IS_PROGRESS (handler))
{
if (gimp_progress_message (GIMP_PROGRESS (handler), gimp,
severity, domain, message))
{
return TRUE;
}
}
else if (GTK_IS_WIDGET (handler))
{
GtkWidget *parent = GTK_WIDGET (handler);
GtkMessageType type = GTK_MESSAGE_ERROR;
switch (severity)
{
case GIMP_MESSAGE_INFO: type = GTK_MESSAGE_INFO; break;
case GIMP_MESSAGE_WARNING: type = GTK_MESSAGE_WARNING; break;
case GIMP_MESSAGE_ERROR: type = GTK_MESSAGE_ERROR; break;
}
dialog =
gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (parent)),
GTK_DIALOG_DESTROY_WITH_PARENT,
type, GTK_BUTTONS_OK,
message);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_widget_destroy),
NULL);
gtk_widget_show (dialog);
return TRUE;
}
if (GIMP_IS_PROGRESS (handler) && ! GIMP_IS_PROGRESS_DIALOG (handler))
dialog = progress_error_dialog (GIMP_PROGRESS (handler));
else
dialog = global_error_dialog ();
if (dialog)
{
gimp_error_dialog_add (GIMP_ERROR_DIALOG (dialog),
GIMP_STOCK_WARNING, domain, message);
gimp_get_message_stock_id (severity),
domain, message);
gtk_window_present (GTK_WINDOW (dialog));
return TRUE;
@ -182,8 +229,13 @@ gui_message_error_dialog (GimpProgress *progress,
}
static void
gui_message_console (const gchar *domain,
const gchar *message)
gui_message_console (GimpMessageSeverity severity,
const gchar *domain,
const gchar *message)
{
g_printerr ("%s: %s\n\n", domain, message);
const gchar *desc = "Message";
gimp_enum_get_value (GIMP_TYPE_MESSAGE_SEVERITY, severity,
NULL, NULL, &desc, NULL);
g_printerr ("%s-%s: %s\n\n", domain, desc, message);
}

View File

@ -20,10 +20,11 @@
#define __GUI_MESSAGE_H__
void gui_message (Gimp *gimp,
GimpProgress *progress,
const gchar *domain,
const gchar *message);
void gui_message (Gimp *gimp,
GObject *handler,
GimpMessageSeverity severity,
const gchar *domain,
const gchar *message);
#endif /* __GUI_VTABLE_H__ */

View File

@ -215,7 +215,8 @@ brush_delete_invoker (GimpProcedure *procedure,
if (! success)
{
gimp_message (gimp, progress, error->message);
gimp_message (gimp, G_OBJECT (progress), GIMP_MESSAGE_ERROR,
error->message);
g_clear_error (&error);
}
}

View File

@ -299,9 +299,9 @@ gimp_pdb_execute_procedure_by_name_args (GimpPDB *pdb,
if (list == NULL)
{
gimp_message (pdb->gimp, progress,
gimp_message (pdb->gimp, progress, GIMP_MESSAGE_ERROR,
_("PDB calling error:\n"
"Procedure '%s' not found"), name);
"Procedure '%s' not found"), name);
return_vals = gimp_procedure_get_return_values (NULL, FALSE);
g_value_set_enum (return_vals->values, GIMP_PDB_CALLING_ERROR);
@ -364,7 +364,7 @@ gimp_pdb_execute_procedure_by_name (GimpPDB *pdb,
if (procedure == NULL)
{
gimp_message (pdb->gimp, progress,
gimp_message (pdb->gimp, progress, GIMP_MESSAGE_ERROR,
_("PDB calling error:\n"
"Procedure '%s' not found"), name);
@ -398,7 +398,7 @@ gimp_pdb_execute_procedure_by_name (GimpPDB *pdb,
g_value_array_free (args);
gimp_message (pdb->gimp, progress,
gimp_message (pdb->gimp, progress, GIMP_MESSAGE_ERROR,
_("PDB calling error for procedure '%s':\n"
"Argument #%d type mismatch (expected %s, got %s)"),
gimp_object_get_name (GIMP_OBJECT (procedure)),

View File

@ -264,7 +264,8 @@ gradient_delete_invoker (GimpProcedure *procedure,
if (! success)
{
gimp_message (gimp, progress, error->message);
gimp_message (gimp, G_OBJECT (progress), GIMP_MESSAGE_ERROR,
error->message);
g_clear_error (&error);
}
}

View File

@ -1942,7 +1942,7 @@ image_set_resolution_invoker (GimpProcedure *procedure,
! FINITE (yresolution) ||
yresolution < GIMP_MIN_RESOLUTION || yresolution > GIMP_MAX_RESOLUTION)
{
gimp_message (gimp, progress,
gimp_message (gimp, G_OBJECT (progress), GIMP_MESSAGE_WARNING,
_("Image resolution is out of bounds, "
"using the default resolution instead."));
success = FALSE;

View File

@ -53,7 +53,8 @@ message_invoker (GimpProcedure *procedure,
if (gimp->plug_in_manager->current_plug_in)
domain = gimp_plug_in_get_undo_desc (gimp->plug_in_manager->current_plug_in);
gimp_show_message (gimp, progress, domain, message);
gimp_show_message (gimp, G_OBJECT (progress), GIMP_MESSAGE_WARNING,
domain, message);
g_free (domain);
}

View File

@ -182,7 +182,8 @@ palette_delete_invoker (GimpProcedure *procedure,
if (! success)
{
gimp_message (gimp, progress, error->message);
gimp_message (gimp, G_OBJECT (progress), GIMP_MESSAGE_ERROR,
error->message);
g_clear_error (&error);
}
}

View File

@ -607,7 +607,8 @@ gimp_plug_in_recv_message (GIOChannel *channel,
GimpPlugInProcFrame *frame = gimp_plug_in_get_proc_frame (plug_in);
GimpProgress *progress = frame ? frame->progress : NULL;
gimp_message (plug_in->manager->gimp, progress,
gimp_message (plug_in->manager->gimp, G_OBJECT (progress),
GIMP_MESSAGE_ERROR,
_("Plug-in crashed: \"%s\"\n(%s)\n\n"
"The dying plug-in may have messed up GIMP's internal "
"state. You may want to save your images and restart "

View File

@ -584,10 +584,11 @@ gimp_image_map_tool_load_save (GimpImageMapTool *tool,
_("Could not open '%s' for writing: %s") :
_("Could not open '%s' for reading: %s");
gimp_show_message_dialog (tool->shell, GTK_MESSAGE_ERROR,
format,
gimp_filename_to_utf8 (filename),
g_strerror (errno));
gimp_message (GIMP_TOOL (tool)->tool_info->gimp, G_OBJECT (tool->shell),
GIMP_MESSAGE_ERROR,
format,
gimp_filename_to_utf8 (filename),
g_strerror (errno));
return;
}
@ -601,10 +602,11 @@ gimp_image_map_tool_load_save (GimpImageMapTool *tool,
}
else if (! gimp_image_map_tool_settings_load (tool, file, &error))
{
gimp_show_message_dialog (tool->shell, GTK_MESSAGE_ERROR,
_("Error reading '%s': %s"),
gimp_filename_to_utf8 (filename),
error->message);
gimp_message (GIMP_TOOL (tool)->tool_info->gimp, G_OBJECT (tool->shell),
GIMP_MESSAGE_ERROR,
_("Error reading '%s': %s"),
gimp_filename_to_utf8 (filename),
error->message);
g_error_free (error);
}

View File

@ -24,7 +24,6 @@
#include "core/gimp.h"
#include "core/gimpimage.h"
#include "core/gimpprogress.h"
#include "core/gimptoolinfo.h"
#include "display/gimpdisplay.h"
@ -727,9 +726,11 @@ gimp_tool_push_status (GimpTool *tool,
shell = GIMP_DISPLAY_SHELL (display->shell);
va_start (args, format);
gimp_statusbar_push_valist (GIMP_STATUSBAR (shell->statusbar),
G_OBJECT_TYPE_NAME (tool),
format, args);
va_end (args);
}
@ -788,9 +789,11 @@ gimp_tool_replace_status (GimpTool *tool,
shell = GIMP_DISPLAY_SHELL (display->shell);
va_start (args, format);
gimp_statusbar_replace_valist (GIMP_STATUSBAR (shell->statusbar),
G_OBJECT_TYPE_NAME (tool),
format, args);
va_end (args);
}
@ -819,11 +822,12 @@ gimp_tool_message (GimpTool *tool,
g_return_if_fail (GIMP_IS_TOOL (tool));
g_return_if_fail (GIMP_IS_DISPLAY (display));
g_return_if_fail (format != NULL);
va_start (args, format);
gimp_display_shell_message_valist (GIMP_DISPLAY_SHELL (display->shell),
format, args);
gimp_message_valist (display->image->gimp, G_OBJECT (display),
GIMP_MESSAGE_WARNING, format, args);
va_end (args);
}

View File

@ -1880,9 +1880,9 @@ gimp_vector_tool_stroke_vectors (GimpVectorTool *vector_tool,
if (! active_drawable)
{
gimp_message (image->gimp,
GIMP_PROGRESS (GIMP_TOOL (vector_tool)->display),
_("There is no active layer or channel to stroke to"));
gimp_tool_message (GIMP_TOOL (vector_tool),
GIMP_TOOL (vector_tool)->display,
_("There is no active layer or channel to stroke to"));
return;
}

View File

@ -30,6 +30,8 @@
#include "widgets-types.h"
#include "core/gimp.h"
#include "gimpaction.h"
#include "gimpactiongroup.h"
#include "gimpactionview.h"
@ -462,6 +464,7 @@ gimp_action_view_accel_changed (GtkAccelGroup *accel_group,
typedef struct
{
GimpUIManager *manager;
gchar *accel_path;
guint accel_key;
GdkModifierType accel_mask;
@ -481,8 +484,9 @@ gimp_action_view_conflict_response (GtkWidget *dialog,
confirm_data->accel_mask,
TRUE))
{
gimp_show_message_dialog (dialog, GTK_MESSAGE_ERROR,
_("Changing shortcut failed."));
gimp_message (confirm_data->manager->gimp, G_OBJECT (dialog),
GIMP_MESSAGE_ERROR,
_("Changing shortcut failed."));
}
}
@ -517,6 +521,7 @@ gimp_action_view_conflict_confirm (GimpActionView *view,
confirm_data = g_new0 (ConfirmData, 1);
confirm_data->manager = view->manager;
confirm_data->accel_path = g_strdup (accel_path);
confirm_data->accel_key = accel_key;
confirm_data->accel_mask = accel_mask;
@ -600,14 +605,16 @@ gimp_action_view_accel_edited (GimpCellRendererAccel *accel,
{
if (! gtk_accel_map_change_entry (accel_path, 0, 0, FALSE))
{
gimp_show_message_dialog (GTK_WIDGET (view), GTK_MESSAGE_ERROR,
_("Removing shortcut failed."));
gimp_message (view->manager->gimp, G_OBJECT (view),
GIMP_MESSAGE_ERROR,
_("Removing shortcut failed."));
}
}
else if (! accel_key)
{
gimp_show_message_dialog (GTK_WIDGET (view), GTK_MESSAGE_ERROR,
_("Invalid shortcut."));
gimp_message (view->manager->gimp, G_OBJECT (view),
GIMP_MESSAGE_ERROR,
_("Invalid shortcut."));
}
else if (! gtk_accel_map_change_entry (accel_path,
accel_key, accel_mask, FALSE))
@ -666,9 +673,9 @@ gimp_action_view_accel_edited (GimpCellRendererAccel *accel,
}
else
{
gimp_show_message_dialog (GTK_WIDGET (view),
GTK_MESSAGE_ERROR,
_("Changing shortcut failed."));
gimp_message (view->manager->gimp, G_OBJECT (view),
GIMP_MESSAGE_ERROR,
_("Changing shortcut failed."));
}
}
}

View File

@ -509,21 +509,21 @@ gimp_controller_list_add_clicked (GtkWidget *button,
if (list->src_gtype == GIMP_TYPE_CONTROLLER_KEYBOARD &&
gimp_controllers_get_keyboard (list->gimp) != NULL)
{
gimp_show_message_dialog (button, GTK_MESSAGE_WARNING,
_("There can only be one active keyboard "
"controller.\n\n"
"You already have a keyboard controller in "
"your list of active controllers."));
gimp_message (list->gimp, G_OBJECT (button), GIMP_MESSAGE_WARNING,
_("There can only be one active keyboard "
"controller.\n\n"
"You already have a keyboard controller in "
"your list of active controllers."));
return;
}
else if (list->src_gtype == GIMP_TYPE_CONTROLLER_WHEEL &&
gimp_controllers_get_wheel (list->gimp) != NULL)
{
gimp_show_message_dialog (button, GTK_MESSAGE_WARNING,
_("There can only be one active wheel "
"controller.\n\n"
"You already have a wheel controller in "
"your list of active controllers."));
gimp_message (list->gimp, G_OBJECT (button), GIMP_MESSAGE_WARNING,
_("There can only be one active wheel "
"controller.\n\n"
"You already have a wheel controller in "
"your list of active controllers."));
return;
}

View File

@ -26,6 +26,7 @@
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "widgets-types.h"
@ -34,6 +35,7 @@
#include "gimperrorconsole.h"
#include "gimpmenufactory.h"
#include "gimpwidgets-utils.h"
#include "gimp-intl.h"
@ -177,31 +179,35 @@ gimp_error_console_new (Gimp *gimp,
}
void
gimp_error_console_add (GimpErrorConsole *console,
const gchar *stock_id,
const gchar *domain,
const gchar *message)
gimp_error_console_add (GimpErrorConsole *console,
GimpMessageSeverity severity,
const gchar *domain,
const gchar *message)
{
const gchar *desc;
GtkTextIter end;
GtkTextMark *end_mark;
GdkPixbuf *pixbuf;
gchar *str;
g_return_if_fail (GIMP_IS_ERROR_CONSOLE (console));
g_return_if_fail (stock_id != NULL);
g_return_if_fail (domain != NULL);
g_return_if_fail (message != NULL);
gimp_enum_get_value (GIMP_TYPE_MESSAGE_SEVERITY, severity,
NULL, NULL, &desc, NULL);
gtk_text_buffer_get_end_iter (console->text_buffer, &end);
pixbuf = gtk_widget_render_icon (console->text_view, stock_id,
pixbuf = gtk_widget_render_icon (console->text_view,
gimp_get_message_stock_id (severity),
GTK_ICON_SIZE_MENU, NULL);
gtk_text_buffer_insert_pixbuf (console->text_buffer, &end, pixbuf);
g_object_unref (pixbuf);
gtk_text_buffer_insert (console->text_buffer, &end, " ", -1);
str = g_strdup_printf (_("%s Message"), domain);
str = g_strdup_printf ("%s %s", domain, desc);
gtk_text_buffer_insert_with_tags_by_name (console->text_buffer, &end,
str, -1,
"title",

View File

@ -60,13 +60,13 @@ struct _GimpErrorConsoleClass
GType gimp_error_console_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_error_console_new (Gimp *gimp,
GimpMenuFactory *menu_factory);
GtkWidget * gimp_error_console_new (Gimp *gimp,
GimpMenuFactory *menu_factory);
void gimp_error_console_add (GimpErrorConsole *console,
const gchar *stock_id,
const gchar *domain,
const gchar *message);
void gimp_error_console_add (GimpErrorConsole *console,
GimpMessageSeverity severity,
const gchar *domain,
const gchar *message);
#endif /* __GIMP_ERROR_CONSOLE_H__ */

View File

@ -340,12 +340,12 @@ gimp_pdb_dialog_run_callback (GimpPdbDialog *dialog,
if (g_value_get_enum (&return_vals->values[0]) != GIMP_PDB_SUCCESS)
{
gimp_show_message_dialog (GTK_WIDGET (dialog),
GTK_MESSAGE_ERROR,
_("Unable to run %s callback. "
"The corresponding plug-in may have "
"crashed."),
g_type_name (G_TYPE_FROM_INSTANCE (dialog)));
gimp_message (dialog->context->gimp, G_OBJECT (dialog),
GIMP_MESSAGE_ERROR,
_("Unable to run %s callback. "
"The corresponding plug-in may have "
"crashed."),
g_type_name (G_TYPE_FROM_INSTANCE (dialog)));
}
g_value_array_free (return_vals);

View File

@ -69,8 +69,9 @@ static void gimp_thumb_box_progress_set_value (GimpProgress *progress,
static gdouble gimp_thumb_box_progress_get_value (GimpProgress *progress);
static void gimp_thumb_box_progress_pulse (GimpProgress *progress);
static void gimp_thumb_box_progress_message (GimpProgress *progress,
static gboolean gimp_thumb_box_progress_message (GimpProgress *progress,
Gimp *gimp,
GimpMessageSeverity severity,
const gchar *domain,
const gchar *message);
@ -271,13 +272,16 @@ gimp_thumb_box_progress_pulse (GimpProgress *progress)
}
}
static void
gimp_thumb_box_progress_message (GimpProgress *progress,
Gimp *gimp,
const gchar *domain,
const gchar *message)
static gboolean
gimp_thumb_box_progress_message (GimpProgress *progress,
Gimp *gimp,
GimpMessageSeverity severity,
const gchar *domain,
const gchar *message)
{
/* GimpThumbBox never shows any messages */
return TRUE;
}

View File

@ -235,8 +235,8 @@ gimp_vectors_tree_view_drop_svg (GimpContainerTreeView *tree_view,
if (! gimp_vectors_import_buffer (image, svg_data, svg_data_len,
TRUE, TRUE, index, &error))
{
gimp_show_message_dialog (GTK_WIDGET (tree_view), GTK_MESSAGE_ERROR,
error->message);
gimp_message (image->gimp, G_OBJECT (tree_view), GIMP_MESSAGE_ERROR,
error->message);
g_clear_error (&error);
}
else

View File

@ -1131,33 +1131,20 @@ gimp_widget_set_accel_help (GtkWidget *widget,
}
}
void
gimp_show_message_dialog (GtkWidget *parent,
GtkMessageType type,
const gchar *format,
...)
const gchar *
gimp_get_message_stock_id (GimpMessageSeverity severity)
{
GtkWidget *dialog;
gchar *message;
va_list args;
switch (severity)
{
case GIMP_MESSAGE_INFO:
return GIMP_STOCK_INFO;
g_return_if_fail (GTK_IS_WIDGET (parent));
g_return_if_fail (format != NULL);
case GIMP_MESSAGE_WARNING:
return GIMP_STOCK_WARNING;
va_start (args, format);
message = g_strdup_vprintf (format, args);
va_end (args);
case GIMP_MESSAGE_ERROR:
return GIMP_STOCK_ERROR;
}
dialog =
gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (parent)),
GTK_DIALOG_DESTROY_WITH_PARENT,
type, GTK_BUTTONS_OK,
message);
g_free (message);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_widget_destroy),
NULL);
gtk_widget_show (dialog);
g_return_val_if_reached (GIMP_STOCK_WARNING);
}

View File

@ -93,10 +93,7 @@ void gimp_toggle_button_set_visible (GtkToggleButton *toggle,
void gimp_widget_set_accel_help (GtkWidget *widget,
GtkAction *action);
void gimp_show_message_dialog (GtkWidget *parent,
GtkMessageType type,
const gchar *format,
...) G_GNUC_PRINTF(3,4);
const gchar * gimp_get_message_stock_id (GimpMessageSeverity severity);
#endif /* __GIMP_WIDGETS_UTILS_H__ */

View File

@ -276,7 +276,7 @@ xcf_load_image (Gimp *gimp,
if (num_successful_elements == 0)
goto hard_error;
gimp_message (gimp, info->progress,
gimp_message (gimp, G_OBJECT (info->progress), GIMP_MESSAGE_WARNING,
"XCF: This file is corrupt! I have loaded as much\n"
"of it as I can, but it is incomplete.");
@ -285,7 +285,7 @@ xcf_load_image (Gimp *gimp,
return image;
hard_error:
gimp_message (gimp, info->progress,
gimp_message (gimp, G_OBJECT (info->progress), GIMP_MESSAGE_ERROR,
"XCF: This file is corrupt! I could not even\n"
"salvage any partial image data from it.");
@ -316,7 +316,8 @@ xcf_load_image_props (XcfInfo *info,
{
gint i;
gimp_message (info->gimp, info->progress,
gimp_message (info->gimp, G_OBJECT (info->progress),
GIMP_MESSAGE_WARNING,
_("XCF warning: version 0 of XCF file format\n"
"did not save indexed colormaps correctly.\n"
"Substituting grayscale map."));
@ -366,7 +367,8 @@ xcf_load_image_props (XcfInfo *info,
(compression != COMPRESS_ZLIB) &&
(compression != COMPRESS_FRACTAL))
{
gimp_message (info->gimp, info->progress,
gimp_message (info->gimp, G_OBJECT (info->progress),
GIMP_MESSAGE_ERROR,
"unknown compression type: %d",
(int) compression);
return FALSE;
@ -403,7 +405,8 @@ xcf_load_image_props (XcfInfo *info,
break;
default:
gimp_message (info->gimp, info->progress,
gimp_message (info->gimp, G_OBJECT (info->progress),
GIMP_MESSAGE_WARNING,
"guide orientation out of range in XCF file");
continue;
}
@ -442,7 +445,8 @@ xcf_load_image_props (XcfInfo *info,
if (xres < GIMP_MIN_RESOLUTION || xres > GIMP_MAX_RESOLUTION ||
yres < GIMP_MIN_RESOLUTION || yres > GIMP_MAX_RESOLUTION)
{
gimp_message (info->gimp, info->progress,
gimp_message (info->gimp, G_OBJECT (info->progress),
GIMP_MESSAGE_WARNING,
"Warning, resolution out of range in XCF file");
xres = image->gimp->config->default_image->xresolution;
yres = image->gimp->config->default_image->yresolution;
@ -470,7 +474,8 @@ xcf_load_image_props (XcfInfo *info,
gimp_parasite_free (p);
}
if (info->cp - base != prop_size)
gimp_message (info->gimp, info->progress,
gimp_message (info->gimp, G_OBJECT (info->progress),
GIMP_MESSAGE_WARNING,
"Error while loading an image's parasites");
}
break;
@ -484,7 +489,8 @@ xcf_load_image_props (XcfInfo *info,
if ((unit <= GIMP_UNIT_PIXEL) ||
(unit >= _gimp_unit_get_number_of_built_in_units (image->gimp)))
{
gimp_message (info->gimp, info->progress,
gimp_message (info->gimp, G_OBJECT (info->progress),
GIMP_MESSAGE_WARNING,
"Warning, unit out of range in XCF file, "
"falling back to inches");
unit = GIMP_UNIT_INCH;
@ -714,7 +720,8 @@ xcf_load_layer_props (XcfInfo *info,
gimp_parasite_free (p);
}
if (info->cp - base != prop_size)
gimp_message (info->gimp, info->progress,
gimp_message (info->gimp, G_OBJECT (info->progress),
GIMP_MESSAGE_WARNING,
"Error while loading a layer's parasites");
}
break;
@ -856,7 +863,8 @@ xcf_load_channel_props (XcfInfo *info,
gimp_parasite_free (p);
}
if (info->cp - base != prop_size)
gimp_message (info->gimp, info->progress,
gimp_message (info->gimp, G_OBJECT (info->progress),
GIMP_MESSAGE_WARNING,
"Error while loading a channel's parasites");
}
break;
@ -1218,7 +1226,8 @@ xcf_load_level (XcfInfo *info,
if (offset == 0)
{
gimp_message (info->gimp, info->progress,
gimp_message (info->gimp, G_OBJECT (info->progress),
GIMP_MESSAGE_ERROR,
"not enough tiles found in level");
return FALSE;
}
@ -1305,7 +1314,7 @@ xcf_load_level (XcfInfo *info,
if (offset != 0)
{
gimp_message (info->gimp, info->progress,
gimp_message (info->gimp, G_OBJECT (info->progress), GIMP_MESSAGE_ERROR,
"encountered garbage after reading level: %d", offset);
return FALSE;
}
@ -1616,7 +1625,8 @@ xcf_load_vectors (XcfInfo *info,
if (version != 1)
{
gimp_message (info->gimp, info->progress,
gimp_message (info->gimp, G_OBJECT (info->progress),
GIMP_MESSAGE_WARNING,
"Unknown vectors version: %d (skipping)", version);
return FALSE;
}

View File

@ -158,7 +158,8 @@ static gboolean xcf_save_vectors (XcfInfo *info,
info->cp += xcf_write_int32 (info->fp, data, count, &error); \
if (error) \
{ \
gimp_message (info->gimp, info->progress, \
gimp_message (info->gimp, G_OBJECT (info->progress), \
GIMP_MESSAGE_ERROR, \
_("Error saving XCF file: %s"), \
error->message); \
return FALSE; \
@ -169,7 +170,8 @@ static gboolean xcf_save_vectors (XcfInfo *info,
info->cp += xcf_write_int8 (info->fp, data, count, &error); \
if (error) \
{ \
gimp_message (info->gimp, info->progress, \
gimp_message (info->gimp, G_OBJECT (info->progress), \
GIMP_MESSAGE_ERROR, \
_("Error saving XCF file: %s"), \
error->message); \
return FALSE; \
@ -180,7 +182,8 @@ static gboolean xcf_save_vectors (XcfInfo *info,
info->cp += xcf_write_float (info->fp, data, count, &error); \
if (error) \
{ \
gimp_message (info->gimp, info->progress, \
gimp_message (info->gimp, G_OBJECT (info->progress), \
GIMP_MESSAGE_ERROR, \
_("Error saving XCF file: %s"), \
error->message); \
return FALSE; \
@ -191,7 +194,8 @@ static gboolean xcf_save_vectors (XcfInfo *info,
info->cp += xcf_write_string (info->fp, data, count, &error); \
if (error) \
{ \
gimp_message (info->gimp, info->progress, \
gimp_message (info->gimp, G_OBJECT (info->progress), \
GIMP_MESSAGE_ERROR, \
_("Error saving XCF file: %s"), \
error->message); \
return FALSE; \
@ -216,7 +220,8 @@ static gboolean xcf_save_vectors (XcfInfo *info,
#define xcf_print_error(info, x) G_STMT_START { \
if (! (x)) \
{ \
gimp_message (info->gimp, info->progress, \
gimp_message (info->gimp, G_OBJECT (info->progress), \
GIMP_MESSAGE_ERROR, \
_("Error saving XCF file: %s"), \
error->message); \
return FALSE; \

View File

@ -301,7 +301,7 @@ xcf_load_invoker (GimpProcedure *procedure,
}
else
{
gimp_message (gimp, progress,
gimp_message (gimp, G_OBJECT (progress), GIMP_MESSAGE_ERROR,
_("XCF error: unsupported XCF file version %d "
"encountered"), info.file_version);
success = FALSE;
@ -315,7 +315,7 @@ xcf_load_invoker (GimpProcedure *procedure,
}
else
{
gimp_message (gimp, progress,
gimp_message (gimp, G_OBJECT (progress), GIMP_MESSAGE_ERROR,
_("Could not open '%s' for reading: %s"),
gimp_filename_to_utf8 (filename), g_strerror (errno));
}
@ -382,7 +382,7 @@ xcf_save_invoker (GimpProcedure *procedure,
if (fclose (info.fp) == EOF)
{
gimp_message (gimp, progress,
gimp_message (gimp, G_OBJECT (progress), GIMP_MESSAGE_ERROR,
_("Error saving XCF file: %s"), g_strerror (errno));
success = FALSE;
@ -393,7 +393,7 @@ xcf_save_invoker (GimpProcedure *procedure,
}
else
{
gimp_message (gimp, progress,
gimp_message (gimp, G_OBJECT (progress), GIMP_MESSAGE_ERROR,
_("Could not open '%s' for writing: %s"),
gimp_filename_to_utf8 (filename), g_strerror (errno));
}

View File

@ -217,7 +217,8 @@ sub brush_delete {
if (! success)
{
gimp_message (gimp, progress, error->message);
gimp_message (gimp, G_OBJECT (progress), GIMP_MESSAGE_ERROR,
error->message);
g_clear_error (&error);
}
}

View File

@ -184,7 +184,8 @@ sub gradient_delete {
if (! success)
{
gimp_message (gimp, progress, error->message);
gimp_message (gimp, G_OBJECT (progress), GIMP_MESSAGE_ERROR,
error->message);
g_clear_error (&error);
}
}

View File

@ -2094,7 +2094,7 @@ HELP
! FINITE (yresolution) ||
yresolution < GIMP_MIN_RESOLUTION || yresolution > GIMP_MAX_RESOLUTION)
{
gimp_message (gimp, progress,
gimp_message (gimp, G_OBJECT (progress), GIMP_MESSAGE_WARNING,
_("Image resolution is out of bounds, "
"using the default resolution instead."));
success = FALSE;

View File

@ -39,7 +39,8 @@ HELP
if (gimp->plug_in_manager->current_plug_in)
domain = gimp_plug_in_get_undo_desc (gimp->plug_in_manager->current_plug_in);
gimp_show_message (gimp, progress, domain, message);
gimp_show_message (gimp, G_OBJECT (progress), GIMP_MESSAGE_WARNING,
domain, message);
g_free (domain);
}

View File

@ -186,7 +186,8 @@ sub palette_delete {
if (! success)
{
gimp_message (gimp, progress, error->message);
gimp_message (gimp, G_OBJECT (progress), GIMP_MESSAGE_ERROR,
error->message);
g_clear_error (&error);
}
}