[gimp] app: add back helper features to output possible flags for GIMP_DEBUG.



commit 6bd43d73d805208779fa90fc016ba9b4a90317a1
Author: Jehan <jehan girinstud io>
Date:   Sat Dec 23 20:00:53 2017 +0100

    app: add back helper features to output possible flags for GIMP_DEBUG.
    
    Since commit a427213fb8a, the special glib value "help" does not work
    anymore as a helper (listing the list of available flags).
    This means that to use GIMP_DEBUG environment variable, one has to
    either know them all by heart or check the app/gimp-log.c file.
    This commit still leaves "help" as a normal flag for GIMP_LOG_HELP
    domain in GIMP, but creates instead "list-all" as the new helper value.
    
    Moreover as a fallback, setting a random value to GIMP_DEBUG with no
    valid flags in it will also output the list of available flags. This
    way, one doesn't even have to remember a specific string to obtain the
    list.

 app/gimp-log.c |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)
---
diff --git a/app/gimp-log.c b/app/gimp-log.c
index 614f481..7840ff9 100644
--- a/app/gimp-log.c
+++ b/app/gimp-log.c
@@ -66,9 +66,14 @@ gimp_log_init (void)
   if (env_log_val)
     {
       /*  g_parse_debug_string() has special treatment of the string 'help',
-       *  but we want to use it for the GIMP_LOG_HELP domain
+       *  but we want to use it for the GIMP_LOG_HELP domain. "list-all"
+       *  is a replacement for "help" in GIMP.
        */
-      if (g_ascii_strcasecmp (env_log_val, "help") == 0)
+      if (g_ascii_strcasecmp (env_log_val, "list-all") == 0)
+        gimp_log_flags = g_parse_debug_string ("help",
+                                               log_keys,
+                                               G_N_ELEMENTS (log_keys));
+      else if (g_ascii_strcasecmp (env_log_val, "help") == 0)
         gimp_log_flags = GIMP_LOG_HELP;
       else
         gimp_log_flags = g_parse_debug_string (env_log_val,
@@ -76,7 +81,19 @@ gimp_log_init (void)
                                                G_N_ELEMENTS (log_keys));
 
       if (gimp_log_flags & GIMP_LOG_INSTANCES)
-        gimp_debug_enable_instances ();
+        {
+          gimp_debug_enable_instances ();
+        }
+      else if (! gimp_log_flags)
+        {
+          /* If the environment variable was set but no log flags are
+           * set as a result, let's assume one is not sure how to use
+           * the log flags and output the list of keys as a helper.
+           */
+          gimp_log_flags = g_parse_debug_string ("help",
+                                                 log_keys,
+                                                 G_N_ELEMENTS (log_keys));
+        }
     }
 }
 


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