Commit 77ed4761 authored by Jehan's avatar Jehan

app: add GIMP_MESSAGE_BUG_WARNING + GIMP_MESSAGE_BUG_CRITICAL severity.

Since a few commits, I don't generate the traces anymore in errors.c but
delay this to gui-message.c and rely on the message severity to decide
whether or not generating traces.
Unfortunately none of the current severities are properly describing
this new type of messages. Even GIMP_MESSAGE_ERROR is used everywhere in
our code NOT for actual programming bug, but often for data errors
(which are not bugs but proper messages and should obviously not prompt
a debug trace).
parent 3dff485d
......@@ -1066,6 +1066,8 @@ gimp_message_severity_get_type (void)
{ GIMP_MESSAGE_INFO, "GIMP_MESSAGE_INFO", "info" },
{ GIMP_MESSAGE_WARNING, "GIMP_MESSAGE_WARNING", "warning" },
{ GIMP_MESSAGE_ERROR, "GIMP_MESSAGE_ERROR", "error" },
{ GIMP_MESSAGE_BUG_WARNING, "GIMP_MESSAGE_BUG_WARNING", "bug-warning" },
{ GIMP_MESSAGE_BUG_CRITICAL, "GIMP_MESSAGE_BUG_CRITICAL", "bug-critical" },
{ 0, NULL, NULL }
};
......@@ -1074,6 +1076,8 @@ gimp_message_severity_get_type (void)
{ GIMP_MESSAGE_INFO, NC_("message-severity", "Message"), NULL },
{ GIMP_MESSAGE_WARNING, NC_("message-severity", "Warning"), NULL },
{ GIMP_MESSAGE_ERROR, NC_("message-severity", "Error"), NULL },
{ GIMP_MESSAGE_BUG_WARNING, NC_("message-severity", "WARNING"), NULL },
{ GIMP_MESSAGE_BUG_CRITICAL, NC_("message-severity", "CRITICAL"), NULL },
{ 0, NULL, NULL }
};
......
......@@ -495,9 +495,11 @@ 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" >*/
GIMP_MESSAGE_INFO, /*< desc="Message" >*/
GIMP_MESSAGE_WARNING, /*< desc="Warning" >*/
GIMP_MESSAGE_ERROR, /*< desc="Error" >*/
GIMP_MESSAGE_BUG_WARNING, /*< desc="WARNING" >*/
GIMP_MESSAGE_BUG_CRITICAL /*< desc="CRITICAL" >*/
} GimpMessageSeverity;
......
......@@ -123,6 +123,8 @@ gimp_display_shell_progress_message (GimpProgress *progress,
switch (severity)
{
case GIMP_MESSAGE_ERROR:
case GIMP_MESSAGE_BUG_WARNING:
case GIMP_MESSAGE_BUG_CRITICAL:
/* error messages are never handled here */
break;
......
......@@ -171,8 +171,10 @@ gimp_message_log_func (const gchar *log_domain,
gpointer data)
{
Gimp *gimp = data;
GimpCoreConfig *config = gimp->config;
const gchar *msg_domain = NULL;
GimpMessageSeverity severity = GIMP_MESSAGE_WARNING;
GimpDebugPolicy debug_policy;
/* All GIMP messages are processed under the same domain, but
* we need to keep the log domain information for third party
......@@ -182,21 +184,23 @@ gimp_message_log_func (const gchar *log_domain,
! g_str_has_prefix (log_domain, "LibGimp"))
msg_domain = log_domain;
if (flags & (G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING))
{
GimpCoreConfig *config = gimp->config;
GimpDebugPolicy debug_policy;
g_object_get (G_OBJECT (config),
"debug-policy", &debug_policy,
NULL);
/* If debug policy requires it, WARNING and CRITICAL errors must be
* routed for appropriate debugging.
*/
g_object_get (G_OBJECT (config),
"debug-policy", &debug_policy,
NULL);
if ((debug_policy == GIMP_DEBUG_POLICY_CRITICAL &&
(flags & G_LOG_LEVEL_CRITICAL)) ||
debug_policy == GIMP_DEBUG_POLICY_WARNING)
{
severity = GIMP_MESSAGE_ERROR;
}
switch (flags & G_LOG_LEVEL_MASK)
{
case G_LOG_LEVEL_WARNING:
if (debug_policy == GIMP_DEBUG_POLICY_WARNING)
severity = GIMP_MESSAGE_BUG_WARNING;
break;
case G_LOG_LEVEL_CRITICAL:
if (debug_policy <= GIMP_DEBUG_POLICY_CRITICAL)
severity = GIMP_MESSAGE_BUG_CRITICAL;
break;
}
if (gimp)
......
......@@ -113,7 +113,7 @@ gui_message (Gimp *gimp,
/* fallthru */
case GIMP_MESSAGE_BOX:
if (severity == GIMP_MESSAGE_ERROR)
if (severity >= GIMP_MESSAGE_BUG_WARNING)
{
g_mutex_lock (&mutex);
/* Trace creation can be time consuming so don't block the
......@@ -305,18 +305,28 @@ gui_message_error_dialog (Gimp *gimp,
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;
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;
case GIMP_MESSAGE_BUG_WARNING:
case GIMP_MESSAGE_BUG_CRITICAL:
type = GTK_MESSAGE_OTHER;
break;
}
if (severity == GIMP_MESSAGE_ERROR)
if (severity >= GIMP_MESSAGE_BUG_WARNING)
{
/* Process differently errors.
* The reason is that this will take significant place, and cannot
* be processed as a progress message or in the global dialog. It
* will require its own dedicated dialog which will encourage
* people to report the bug.
/* Process differently programming errors.
* The reason is that we will generate traces, which will take
* significant place, and cannot be processed as a progress
* message or in the global dialog. It will require its own
* dedicated dialog which will encourage people to report the bug.
*/
gboolean gui_error = FALSE;
......
......@@ -1154,6 +1154,10 @@ gimp_get_message_icon_name (GimpMessageSeverity severity)
case GIMP_MESSAGE_ERROR:
return GIMP_ICON_DIALOG_ERROR;
case GIMP_MESSAGE_BUG_WARNING:
case GIMP_MESSAGE_BUG_CRITICAL:
return GIMP_ICON_WILBER_EEK;
}
g_return_val_if_reached (GIMP_ICON_DIALOG_WARNING);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment