1 |
commit: 0d5b2a081c7d48464d059494ed889e52c0d185d9 |
2 |
Author: Alexandre Rostovtsev <tetromino <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Mar 19 03:01:51 2012 +0000 |
4 |
Commit: Alexandre Restovtsev <tetromino <AT> gmail <DOT> com> |
5 |
CommitDate: Mon Mar 19 03:01:51 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc-settingsd.git;a=commit;h=0d5b2a08 |
7 |
|
8 |
Respect --debug switch when using >=glib-2.31.2 |
9 |
|
10 |
--- |
11 |
src/main.c | 8 +++++++- |
12 |
1 files changed, 7 insertions(+), 1 deletions(-) |
13 |
|
14 |
diff --git a/src/main.c b/src/main.c |
15 |
index fabb96c..887cccd 100644 |
16 |
--- a/src/main.c |
17 |
+++ b/src/main.c |
18 |
@@ -40,6 +40,7 @@ static GOptionEntry option_entries[] = |
19 |
{ NULL } |
20 |
}; |
21 |
|
22 |
+/* Emulates the new behavior of g_log_default_handler introduced in glib-2.31.2 */ |
23 |
static void |
24 |
log_handler (const gchar *log_domain, |
25 |
GLogLevelFlags log_level, |
26 |
@@ -58,7 +59,6 @@ main (gint argc, gchar *argv[]) |
27 |
GMainLoop *loop = NULL; |
28 |
|
29 |
g_type_init (); |
30 |
- g_log_set_default_handler (log_handler, NULL); |
31 |
|
32 |
option_context = g_option_context_new ("- system settings D-Bus service for OpenRC"); |
33 |
g_option_context_add_main_entries (option_context, option_entries, NULL); |
34 |
@@ -67,6 +67,12 @@ main (gint argc, gchar *argv[]) |
35 |
exit (1); |
36 |
} |
37 |
|
38 |
+ if (glib_check_version (2, 31, 2) == NULL) { |
39 |
+ if (debug) |
40 |
+ g_setenv("G_MESSAGES_DEBUG", "all", TRUE); |
41 |
+ } else |
42 |
+ g_log_set_default_handler (log_handler, NULL); |
43 |
+ |
44 |
shell_utils_init (); |
45 |
hostnamed_init (read_only); |
46 |
localed_init (read_only); |