]> git.street.me.uk Git - andy/viking.git/blobdiff - src/main.c
Fix printing of DEBUG message since glib 2.32
[andy/viking.git] / src / main.c
index af9ea4c5f37bbf8cf8a70b41c21cb3244708166a..a4b2f3ab9237ae27c3be1a6b15985de3541bf726 100644 (file)
@@ -67,6 +67,16 @@ static void open_window ( VikWindow *vw, GSList *files );
 static void destroy( GtkWidget *widget,
                      gpointer   data );
 
+#if GLIB_CHECK_VERSION (2, 32, 0)
+/* Callback to log message */
+static void log_debug(const gchar *log_domain,
+                      GLogLevelFlags log_level,
+                      const gchar *message,
+                      gpointer user_data)
+{
+  g_print("** (viking): DEBUG: %s\n", message);
+}
+#else
 /* Callback to mute log message */
 static void mute_log(const gchar *log_domain,
                      GLogLevelFlags log_level,
@@ -75,6 +85,7 @@ static void mute_log(const gchar *log_domain,
 {
   /* Nothing to do, we just want to mute */
 }
+#endif
 
 /* Another callback */
 static void destroy( GtkWidget *widget,
@@ -178,8 +189,13 @@ int main( int argc, char *argv[] )
     return EXIT_SUCCESS;
   }
 
+#if GLIB_CHECK_VERSION (2, 32, 0)
+  if (vik_debug)
+    g_log_set_handler (NULL, G_LOG_LEVEL_DEBUG, log_debug, NULL);
+#else
   if (!vik_debug)
     g_log_set_handler (NULL, G_LOG_LEVEL_DEBUG, mute_log, NULL);
+#endif
 
   a_preferences_init ();