[gimp] app: when WARNING or CRITICAL debugging are ignored, go to terminal.



commit 37f99069616d3d20939808dbc6eb5af6da505e7e
Author: Jehan <jehan girinstud io>
Date:   Tue Feb 13 13:16:27 2018 +0100

    app: when WARNING or CRITICAL debugging are ignored, go to terminal.
    
    Current code was redirecting WARNING and CRITICAL errors to normal
    messaging when the debugging was deactivated (in Preferences). But if
    you deactivate these on purpose, then it means you don't want to get
    annoyed by small pop-ups either.
    This commit makes them directly displayed in terminal, as they used to
    before, when debugging is deactivated.

 app/errors.c |   21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)
---
diff --git a/app/errors.c b/app/errors.c
index 49b23b7..e6401b4 100644
--- a/app/errors.c
+++ b/app/errors.c
@@ -190,10 +190,11 @@ gimp_message_log_func (const gchar    *log_domain,
                        const gchar    *message,
                        gpointer        data)
 {
-  Gimp                *gimp       = data;
-  GimpCoreConfig      *config     = gimp->config;
-  const gchar         *msg_domain = NULL;
-  GimpMessageSeverity  severity   = GIMP_MESSAGE_WARNING;
+  Gimp                *gimp        = data;
+  GimpCoreConfig      *config      = gimp->config;
+  const gchar         *msg_domain  = NULL;
+  GimpMessageSeverity  severity    = GIMP_MESSAGE_WARNING;
+  gboolean             gui_message = TRUE;
   GimpDebugPolicy      debug_policy;
 
   /* All GIMP messages are processed under the same domain, but
@@ -214,16 +215,18 @@ gimp_message_log_func (const gchar    *log_domain,
   switch (flags & G_LOG_LEVEL_MASK)
     {
     case G_LOG_LEVEL_WARNING:
-      if (debug_policy == GIMP_DEBUG_POLICY_WARNING)
-        severity = GIMP_MESSAGE_BUG_WARNING;
+      severity = GIMP_MESSAGE_BUG_WARNING;
+      if (debug_policy > GIMP_DEBUG_POLICY_WARNING)
+        gui_message = FALSE;
       break;
     case G_LOG_LEVEL_CRITICAL:
-      if (debug_policy <= GIMP_DEBUG_POLICY_CRITICAL)
-        severity = GIMP_MESSAGE_BUG_CRITICAL;
+      severity = GIMP_MESSAGE_BUG_CRITICAL;
+      if (debug_policy > GIMP_DEBUG_POLICY_CRITICAL)
+        gui_message = FALSE;
       break;
     }
 
-  if (gimp)
+  if (gimp && gui_message)
     {
       gimp_show_message (gimp, NULL, severity, msg_domain, message);
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]