Try to display the GLib warnings in the log window
authorMikael Berthe <mikael@lilotux.net>
Sun, 06 Jul 2014 16:09:27 +0200
changeset 2149 1b3add57c912
parent 2148 7a0df2e5da19
child 2150 392cf37d5966
Try to display the GLib warnings in the log window
mcabber/mcabber/screen.c
--- a/mcabber/mcabber/screen.c	Sun Jul 06 15:48:27 2014 +0200
+++ b/mcabber/mcabber/screen.c	Sun Jul 06 16:09:27 2014 +0200
@@ -86,6 +86,9 @@
 static void scr_insert_text(const char*);
 static void scr_handle_tab(gboolean fwd);
 
+static void scr_glog_print(const gchar *log_domain, GLogLevelFlags log_level,
+                           const gchar *message, gpointer user_data);
+
 #if defined XEP0022 || defined XEP0085
 static gboolean scr_chatstates_timeout();
 #endif
@@ -828,6 +831,8 @@
   ptr_inputline = inputLine;
 
   Curses = TRUE;
+
+  g_log_set_handler("GLib", G_LOG_LEVEL_MASK, scr_glog_print, NULL);
   return;
 }
 
@@ -993,6 +998,13 @@
   g_free(btext);
 }
 
+// This is a GLogFunc for Glib log messages
+static void scr_glog_print(const gchar *log_domain, GLogLevelFlags log_level,
+                           const gchar *message, gpointer user_data)
+{
+  scr_log_print(LPRINT_NORMAL, "[%s] %s", log_domain, message);
+}
+
 static winbuf *scr_search_window(const char *winId, int special)
 {
   char *id;