[gtk-vnc] Ensure debugging works on GLib >= 2.32



commit 1435c6c8d117ebd06abfacc842ee4dd2ac94d71d
Author: Daniel P. Berrange <berrange redhat com>
Date:   Wed Apr 25 10:16:36 2012 +0100

    Ensure debugging works on GLib >= 2.32
    
    Signed-off-by: Daniel P. Berrange <berrange redhat com>

 src/Makefile.am |    4 ++--
 src/vncutil.c   |   15 +++++++++++++++
 2 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 7d3e284..8d2cbb5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -48,7 +48,7 @@ libgvnc_1_0_la_CFLAGS = \
 			$(WARN_CFLAGS) \
 			-DSYSCONFDIR=\""$(sysconfdir)"\" \
 			-DPACKAGE_LOCALE_DIR=\""$(datadir)/locale"\" \
-			-DG_LOG_DOMAIN=\"gvnc\"
+			-DG_LOG_DOMAIN=\"gtk-vnc\"
 libgvnc_1_0_la_LDFLAGS = \
 			$(VERSION_SCRIPT_FLAGS)$(GVNC_VERSION_FILE) \
 			-version-info 0:1:0 $(NO_UNDEFINED_FLAGS)
@@ -114,7 +114,7 @@ libgvncpulse_1_0_la_CFLAGS = \
                        $(WARN_CFLAGS) \
                        -DSYSCONFDIR=\""$(sysconfdir)"\" \
                        -DPACKAGE_LOCALE_DIR=\""$(datadir)/locale"\" \
-                       -DG_LOG_DOMAIN=\"pulse-vnc\"
+                       -DG_LOG_DOMAIN=\"gtk-vnc\"
 libgvncpulse_1_0_la_LDFLAGS = \
                        $(VERSION_SCRIPT_FLAGS)$(GVNCPULSE_VERSION_FILE) \
                        -version-info 0:1:0 $(NO_UNDEFINED_FLAGS)
diff --git a/src/vncutil.c b/src/vncutil.c
index 52f9979..a18b526 100644
--- a/src/vncutil.c
+++ b/src/vncutil.c
@@ -20,6 +20,9 @@
 
 #include <config.h>
 
+#include <stdlib.h>
+#include <string.h>
+
 #include "vncutil.h"
 
 
@@ -27,6 +30,18 @@ static gboolean debugFlag = FALSE;
 
 void vnc_util_set_debug(gboolean enabled)
 {
+#if GLIB_CHECK_VERSION(2, 31, 0)
+    if (enabled) {
+        gchar *doms = getenv("G_MESSAGES_DEBUG");
+        if (!doms) {
+            setenv("G_MESSAGES_DEBUG", G_LOG_DOMAIN, 1);
+        } else if (!strstr(doms, G_LOG_DOMAIN)) {
+            gchar *newdoms = g_strdup_printf("%s %s", doms, G_LOG_DOMAIN);
+            setenv("G_MESSAGES_DEBUG", newdoms, 1);
+            g_free(newdoms);
+        }
+    }
+#endif
     debugFlag = enabled;
 }
 



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