From 1ddae03ed906264f203ddc253bec27a4c8d49dd5 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Thu, 16 Dec 2010 18:04:52 +0100 Subject: Enable debugging of alarm-notify with ALARMS_DEBUG=1 environment variable --- calendar/gui/alarm-notify/config-data.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'calendar/gui/alarm-notify/config-data.c') diff --git a/calendar/gui/alarm-notify/config-data.c b/calendar/gui/alarm-notify/config-data.c index 65e3e15a87..eea273cf62 100644 --- a/calendar/gui/alarm-notify/config-data.c +++ b/calendar/gui/alarm-notify/config-data.c @@ -391,3 +391,34 @@ config_data_is_blessed_program (const gchar *program) return found; } + +static gboolean can_debug = FALSE; +static GStaticRecMutex rec_mutex = G_STATIC_REC_MUTEX_INIT; + +void +config_data_init_debugging (void) +{ + can_debug = g_getenv ("ALARMS_DEBUG") != NULL; +} + +/* returns whether started debugging; + call config_data_stop_debugging() when started and you are done with it +*/ +gboolean +config_data_start_debugging (void) +{ + g_static_rec_mutex_lock (&rec_mutex); + + if (can_debug) + return TRUE; + + g_static_rec_mutex_unlock (&rec_mutex); + + return FALSE; +} + +void +config_data_stop_debugging (void) +{ + g_static_rec_mutex_unlock (&rec_mutex); +} -- cgit