From 0d5b2a081c7d48464d059494ed889e52c0d185d9 Mon Sep 17 00:00:00 2001 From: Alexandre Rostovtsev Date: Sun, 18 Mar 2012 23:01:51 -0400 Subject: Respect --debug switch when using >=glib-2.31.2 --- src/main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index fabb96c..887cccd 100644 --- a/src/main.c +++ b/src/main.c @@ -40,6 +40,7 @@ static GOptionEntry option_entries[] = { NULL } }; +/* Emulates the new behavior of g_log_default_handler introduced in glib-2.31.2 */ static void log_handler (const gchar *log_domain, GLogLevelFlags log_level, @@ -58,7 +59,6 @@ main (gint argc, gchar *argv[]) GMainLoop *loop = NULL; g_type_init (); - g_log_set_default_handler (log_handler, NULL); option_context = g_option_context_new ("- system settings D-Bus service for OpenRC"); g_option_context_add_main_entries (option_context, option_entries, NULL); @@ -67,6 +67,12 @@ main (gint argc, gchar *argv[]) exit (1); } + if (glib_check_version (2, 31, 2) == NULL) { + if (debug) + g_setenv("G_MESSAGES_DEBUG", "all", TRUE); + } else + g_log_set_default_handler (log_handler, NULL); + shell_utils_init (); hostnamed_init (read_only); localed_init (read_only); -- cgit v1.2.3-65-gdbad