summaryrefslogtreecommitdiff
path: root/mate-settings-daemon/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'mate-settings-daemon/main.c')
-rw-r--r--mate-settings-daemon/main.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/mate-settings-daemon/main.c b/mate-settings-daemon/main.c
index f2a0bb8..0ecfb13 100644
--- a/mate-settings-daemon/main.c
+++ b/mate-settings-daemon/main.c
@@ -42,8 +42,13 @@
#include "mate-settings-manager.h"
#include "mate-settings-profile.h"
+#include <libmate-desktop/mate-gsettings.h>
+
#define MSD_DBUS_NAME "org.mate.SettingsDaemon"
+#define DEBUG_KEY "mate-settings-daemon"
+#define DEBUG_SCHEMA "org.mate.debug"
+
#define MATE_SESSION_DBUS_NAME "org.mate.SessionManager"
#define MATE_SESSION_DBUS_OBJECT "/org/mate/SessionManager"
#define MATE_SESSION_DBUS_INTERFACE "org.mate.SessionManager"
@@ -443,6 +448,18 @@ parse_args (int *argc, char ***argv)
g_setenv ("G_MESSAGES_DEBUG", "all", FALSE);
}
+static void debug_changed (GSettings *settings, gchar *key, gpointer user_data)
+{
+ debug = g_settings_get_boolean (settings, DEBUG_KEY);
+ if (debug) {
+ g_debug ("Enable DEBUG");
+ g_setenv ("G_MESSAGES_DEBUG", "all", FALSE);
+ } else {
+ g_debug ("Disable DEBUG");
+ g_unsetenv ("G_MESSAGES_DEBUG");
+ }
+}
+
int
main (int argc, char *argv[])
{
@@ -450,6 +467,7 @@ main (int argc, char *argv[])
DBusGConnection *bus;
gboolean res;
GError *error;
+ GSettings *debug_settings = NULL;
manager = NULL;
@@ -462,6 +480,19 @@ main (int argc, char *argv[])
parse_args (&argc, &argv);
+ /* Allows to enable/disable debug from GSettings only if it is not set from argument */
+ if (mate_gsettings_schema_exists (DEBUG_SCHEMA))
+ {
+ debug_settings = g_settings_new (DEBUG_SCHEMA);
+ debug = g_settings_get_boolean (debug_settings, DEBUG_KEY);
+
+ if (debug) {
+ g_setenv ("G_MESSAGES_DEBUG", "all", FALSE);
+ }
+
+ g_signal_connect (debug_settings, "changed::" DEBUG_KEY, G_CALLBACK (debug_changed), NULL);
+ }
+
mate_settings_profile_start ("opening gtk display");
if (! gtk_init_check (NULL, NULL)) {
g_warning ("Unable to initialize GTK+");
@@ -523,6 +554,10 @@ main (int argc, char *argv[])
g_object_unref (manager);
}
+ if (debug_settings != NULL) {
+ g_object_unref (debug_settings);
+ }
+
#ifdef HAVE_LIBNOTIFY
if (notify_is_initted ())
notify_uninit ();