[gtk/ebassi/glib-min-version: 1/2] Do not depend on GLib API introduced after 2.66




commit 3a1b2083d61e24a42fc43d952644e184c18a46d5
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Mon Nov 23 12:02:21 2020 +0000

    Do not depend on GLib API introduced after 2.66
    
    To avoid bleeding edge deprecations we use GLIB_VERSION_MIN_REQUIRED and
    GLIB_VERSION_MAX_ALLOWED. Since we depend on GLib 2.66, we cannot use
    API introduced in 2.67, even when conditionally compiled.

 gtk/tools/gtk-builder-tool.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/gtk/tools/gtk-builder-tool.c b/gtk/tools/gtk-builder-tool.c
index e45a52672d..bc89207049 100644
--- a/gtk/tools/gtk-builder-tool.c
+++ b/gtk/tools/gtk-builder-tool.c
@@ -52,16 +52,17 @@ usage (void)
   exit (1);
 }
 
-#if !GLIB_CHECK_VERSION(2,67,0)
+/* A simplified version of g_log_writer_default_would_drop(), to avoid
+ * bumping up the required version of GLib to 2.68
+ */
 static gboolean
-g_log_writer_default_would_drop (GLogLevelFlags  level,
-                                 const char     *domain)
+would_drop (GLogLevelFlags  level,
+            const char     *domain)
 {
   return (level & (G_LOG_LEVEL_ERROR |
                    G_LOG_LEVEL_CRITICAL |
                    G_LOG_LEVEL_WARNING)) == 0;
 }
-#endif
 
 static GLogWriterOutput
 log_writer_func (GLogLevelFlags   level,
@@ -81,7 +82,7 @@ log_writer_func (GLogLevelFlags   level,
         message = fields[i].value;
     }
 
-  if (message != NULL && !g_log_writer_default_would_drop (level, domain))
+  if (message != NULL && !would_drop (level, domain))
     {
       const char *prefix;
       switch (level & G_LOG_LEVEL_MASK)


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