diff options
-rw-r--r-- | configure.ac | 40 | ||||
-rw-r--r-- | data/org.mate.screensaver.gschema.xml.in | 3 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/gs-listener-dbus.c | 221 | ||||
-rw-r--r-- | src/gs-prefs.c | 130 | ||||
-rw-r--r-- | src/mate-screensaver.c | 10 |
6 files changed, 320 insertions, 86 deletions
diff --git a/configure.ac b/configure.ac index f70ad46..ace76f9 100644 --- a/configure.ac +++ b/configure.ac @@ -485,7 +485,7 @@ fi # if test "$ac_macosx" = yes; then if test "$enable_locking" = yes; then - AC_MSG_RESULT(locking disabled: it doesn't work on MacOS X) + AC_MSG_RESULT(locking disabled: it doesnt work on MacOS X) enable_locking=no AC_DEFINE(NO_LOCKING, 1, [Define if screen locking support is disabled]) fi @@ -893,6 +893,42 @@ fi AC_SUBST(AUTH_SCHEME) dnl --------------------------------------------------------------------------- +dnl ConsoleKit +dnl --------------------------------------------------------------------------- + +AC_ARG_WITH(console-kit, + AS_HELP_STRING([--with-console-kit], + [Add ConsoleKit support]),, + with_console_kit=auto) + +use_console_kit=no +if test "x$with_console_kit" != "xno" ; then + use_console_kit=yes + AC_DEFINE(WITH_CONSOLE_KIT, 1, [ConsoleKit support]) +fi +AM_CONDITIONAL(WITH_CONSOLE_KIT, test x$use_console_kit = xyes) +AC_SUBST(WITH_CONSOLE_KIT) + +dnl --------------------------------------------------------------------------- +dnl systemd +dnl --------------------------------------------------------------------------- + +AC_ARG_WITH(systemd, + AS_HELP_STRING([--with-systemd], + [Add systemd support]),, + with_systemd=auto) + +use_systemd=no +if test "x$with_systemd" != "xno" ; then + use_systemd=yes + AC_DEFINE(WITH_SYSTEMD, 1, [systemd support]) + + PKG_CHECK_MODULES(SYSTEMD, libsystemd-login libsystemd-daemon) +fi +AM_CONDITIONAL(WITH_SYSTEMD, test x$use_systemd = xyes) +AC_SUBST(WITH_SYSTEMD) + +dnl --------------------------------------------------------------------------- dnl libmatekbd dnl --------------------------------------------------------------------------- @@ -1107,6 +1143,8 @@ echo " Screen locking enabled: ${enable_locking} Show keyboard indicator: ${with_kbd_layout_indicator} + systemd support: ${use_systemd} + ConsoleKit support: ${use_console_kit} libmatenotify support: ${have_libmatenotify} PAM support: ${have_pam} Have shadow passwords: ${have_shadow} diff --git a/data/org.mate.screensaver.gschema.xml.in b/data/org.mate.screensaver.gschema.xml.in index d1200cd..d3fd2a4 100644 --- a/data/org.mate.screensaver.gschema.xml.in +++ b/data/org.mate.screensaver.gschema.xml.in @@ -4,7 +4,7 @@ <value nick="random" value="1"/> <value nick="single" value="2"/> </enum> - <schema gettext-domain="@GETTEXT_PACKAGE@" id="org.mate.screensaver" path="/org/mate-screensaver/"> + <schema gettext-domain="@GETTEXT_PACKAGE@" id="org.mate.screensaver" path="/org/mate/screensaver/"> <key name="idle-activation-enabled" type="b"> <default>true</default> <summary>Activate when idle</summary> @@ -87,4 +87,3 @@ </key> </schema> </schemalist> - diff --git a/src/Makefile.am b/src/Makefile.am index 1de819f..272b931 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -31,6 +31,7 @@ INCLUDES = \ $(DBUS_CFLAGS) \ $(LIBMATEKBDUI_CFLAGS) \ $(LIBMATENOTIFY_CFLAGS) \ + $(SYSTEMD_CFLAGS) \ $(NULL) bin_PROGRAMS = \ @@ -213,6 +214,7 @@ mate_screensaver_gl_helper_SOURCES = \ mate_screensaver_LDADD = \ $(MATE_SCREENSAVER_LIBS) \ $(SAVER_LIBS) \ + $(SYSTEMD_LIBS) \ $(NULL) mate_screensaver_LDFLAGS = -export-dynamic diff --git a/src/gs-listener-dbus.c b/src/gs-listener-dbus.c index 601689c..5a4afb4 100644 --- a/src/gs-listener-dbus.c +++ b/src/gs-listener-dbus.c @@ -32,6 +32,11 @@ #include <dbus/dbus-glib.h> #include <dbus/dbus-glib-lowlevel.h> +#ifdef WITH_SYSTEMD +#include <systemd/sd-daemon.h> +#include <systemd/sd-login.h> +#endif + #include "gs-listener-dbus.h" #include "gs-marshal.h" #include "gs-debug.h" @@ -59,6 +64,15 @@ static DBusHandlerResult gs_listener_message_handler (DBusConnection *connec #define HAL_DEVICE_INTERFACE "org.freedesktop.Hal.Device" +/* systemd logind */ +#define SYSTEMD_LOGIND_SERVICE "org.freedesktop.login1" +#define SYSTEMD_LOGIND_PATH "/org/freedesktop/login1" +#define SYSTEMD_LOGIND_INTERFACE "org.freedesktop.login1.Manager" + +#define SYSTEMD_LOGIND_SESSION_INTERFACE "org.freedesktop.login1.Session" +#define SYSTEMD_LOGIND_SESSION_PATH "/org/freedesktop/login1/session" + +/* consolekit */ #define CK_NAME "org.freedesktop.ConsoleKit" #define CK_MANAGER_PATH "/org/freedesktop/ConsoleKit/Manager" #define CK_MANAGER_INTERFACE "org.freedesktop.ConsoleKit.Manager" @@ -87,6 +101,10 @@ struct GSListenerPrivate time_t session_idle_start; char *session_id; +#ifdef WITH_SYSTEMD + gboolean have_systemd; +#endif + guint32 ck_throttle_cookie; }; @@ -1539,20 +1557,101 @@ _listener_message_path_is_our_session (GSListener *listener, DBusMessage *message) { const char *ssid; - gboolean ours; - - ours = FALSE; ssid = dbus_message_get_path (message); - if (ssid != NULL - && listener->priv->session_id != NULL - && strcmp (ssid, listener->priv->session_id) == 0) - { - ours = TRUE; + + if (ssid == NULL) + return FALSE; + + if (listener->priv->session_id == NULL) + return FALSE; + +#ifdef WITH_SYSTEMD + /* The bus object path is simply the actual session ID + * prefixed to make it a bus path */ + if (listener->priv->have_systemd) + return g_str_has_prefix (ssid, SYSTEMD_LOGIND_SESSION_PATH "/") + && strcmp (ssid + sizeof (SYSTEMD_LOGIND_SESSION_PATH), + listener->priv->session_id) == 0; +#endif + +#ifdef WITH_CONSOLE_KIT + if (strcmp (ssid, listener->priv->session_id) == 0) + return TRUE; +#endif + + return FALSE; +} + +#ifdef WITH_SYSTEMD +static gboolean +properties_changed_match (DBusMessage *message, + const char *property) +{ + DBusMessageIter iter, sub, sub2; + + /* Checks whether a certain property is listed in the + * specified PropertiesChanged message */ + + if (!dbus_message_iter_init (message, &iter)) + goto failure; + + /* Jump over interface name */ + if (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_STRING) + goto failure; + + dbus_message_iter_next (&iter); + + /* First, iterate through the changed properties array */ + if (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_ARRAY || + dbus_message_iter_get_element_type (&iter) != DBUS_TYPE_DICT_ENTRY) + goto failure; + + dbus_message_iter_recurse (&iter, &sub); + while (dbus_message_iter_get_arg_type (&sub) != DBUS_TYPE_INVALID) { + const char *name; + + if (dbus_message_iter_get_arg_type (&sub) != DBUS_TYPE_DICT_ENTRY) + goto failure; + + dbus_message_iter_recurse (&sub, &sub2); + dbus_message_iter_get_basic (&sub2, &name); + + if (strcmp (name, property) == 0) + return TRUE; + + dbus_message_iter_next (&sub); } - return ours; + dbus_message_iter_next (&iter); + + /* Second, iterate through the invalidated properties array */ + if (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_ARRAY || + dbus_message_iter_get_element_type (&iter) != DBUS_TYPE_STRING) + goto failure; + + dbus_message_iter_recurse (&iter, &sub); + while (dbus_message_iter_get_arg_type (&sub) != DBUS_TYPE_INVALID) { + const char *name; + + if (dbus_message_iter_get_arg_type (&sub) != DBUS_TYPE_STRING) + goto failure; + + dbus_message_iter_get_basic (&sub, &name); + + if (strcmp (name, property) == 0) + return TRUE; + + dbus_message_iter_next (&sub); + } + + return FALSE; + +failure: + gs_debug ("Failed to decode PropertiesChanged message."); + return FALSE; } +#endif static DBusHandlerResult listener_dbus_handle_system_message (DBusConnection *connection, @@ -1573,6 +1672,52 @@ listener_dbus_handle_system_message (DBusConnection *connection, dbus_message_get_destination (message)); #endif +#ifdef WITH_SYSTEMD + if (listener->priv->have_systemd) { + + if (dbus_message_is_signal (message, SYSTEMD_LOGIND_SESSION_INTERFACE, "Unlock")) { + if (_listener_message_path_is_our_session (listener, message)) { + gs_debug ("Console kit requested session unlock"); + gs_listener_set_active (listener, FALSE); + } + + return DBUS_HANDLER_RESULT_HANDLED; + } else if (dbus_message_is_signal (message, SYSTEMD_LOGIND_SESSION_INTERFACE, "Lock")) { + if (_listener_message_path_is_our_session (listener, message)) { + gs_debug ("ConsoleKit requested session lock"); + g_signal_emit (listener, signals [LOCK], 0); + } + + return DBUS_HANDLER_RESULT_HANDLED; + } else if (dbus_message_is_signal (message, DBUS_INTERFACE_PROPERTIES, "PropertiesChanged")) { + + if (_listener_message_path_is_our_session (listener, message)) { + + if (properties_changed_match (message, "Active")) { + gboolean new_active; + + /* Instead of going via the + * bus to read the new + * property state, let's + * shortcut this and ask + * directly the low-level + * information */ + + new_active = sd_session_is_active (listener->priv->session_id) != 0; + if (new_active) + g_signal_emit (listener, signals [SIMULATE_USER_ACTIVITY], 0); + } + } + + return DBUS_HANDLER_RESULT_HANDLED; + } + + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + } +#endif + +#ifdef WITH_CONSOLE_KIT + if (dbus_message_is_signal (message, HAL_DEVICE_INTERFACE, "Condition")) { DBusError error; @@ -1600,6 +1745,8 @@ listener_dbus_handle_system_message (DBusConnection *connection, return DBUS_HANDLER_RESULT_HANDLED; } + + else if (dbus_message_is_signal (message, CK_SESSION_INTERFACE, "Unlock")) { if (_listener_message_path_is_our_session (listener, message)) @@ -1683,7 +1830,7 @@ listener_dbus_handle_system_message (DBusConnection *connection, return DBUS_HANDLER_RESULT_HANDLED; } - +#endif return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } @@ -2134,7 +2281,32 @@ gs_listener_acquire (GSListener *listener, listener_dbus_system_filter_function, listener, NULL); +#ifdef WITH_SYSTEMD + if (listener->priv->have_systemd) { + dbus_bus_add_match (listener->priv->system_connection, + "type='signal'" + ",sender='"SYSTEMD_LOGIND_SERVICE"'" + ",interface='"SYSTEMD_LOGIND_SESSION_INTERFACE"'" + ",member='Unlock'", + NULL); + dbus_bus_add_match (listener->priv->system_connection, + "type='signal'" + ",sender='"SYSTEMD_LOGIND_SERVICE"'" + ",interface='"SYSTEMD_LOGIND_SESSION_INTERFACE"'" + ",member='Lock'", + NULL); + dbus_bus_add_match (listener->priv->system_connection, + "type='signal'" + ",sender='"SYSTEMD_LOGIND_SERVICE"'" + ",interface='"DBUS_INTERFACE_PROPERTIES"'" + ",member='PropertiesChanged'", + NULL); + + goto finish; + } +#endif +#ifdef WITH_CONSOLE_KIT dbus_bus_add_match (listener->priv->system_connection, "type='signal'" ",interface='"HAL_DEVICE_INTERFACE"'" @@ -2155,8 +2327,10 @@ gs_listener_acquire (GSListener *listener, ",interface='"CK_SESSION_INTERFACE"'" ",member='ActiveChanged'", NULL); +#endif } +finish: return acquired; } @@ -2179,6 +2353,26 @@ query_session_id (GSListener *listener) dbus_error_init (&error); +#ifdef WITH_SYSTEMD + if (listener->priv->have_systemd) { + char *t; + int r; + + r = sd_pid_get_session (0, &t); + if (r < 0) { + gs_debug ("Couldn't determine our own session id: %s", strerror (-r)); + return NULL; + } + + /* t is allocated with malloc(), we need it with g_malloc() */ + ssid = g_strdup(t); + free (t); + + return ssid; + } +#endif + +#ifdef WITH_CONSOLE_KIT message = dbus_message_new_method_call (CK_NAME, CK_MANAGER_PATH, CK_MANAGER_INTERFACE, "GetCurrentSession"); if (message == NULL) { @@ -2205,6 +2399,9 @@ query_session_id (GSListener *listener) dbus_message_unref (reply); return g_strdup (ssid); +#else + return NULL; +#endif } static void @@ -2220,6 +2417,10 @@ gs_listener_init (GSListener *listener) { listener->priv = GS_LISTENER_GET_PRIVATE (listener); +#ifdef WITH_SYSTEMD + listener->priv->have_systemd = sd_booted () > 0; +#endif + gs_listener_dbus_init (listener); init_session_id (listener); diff --git a/src/gs-prefs.c b/src/gs-prefs.c index 1a8a426..af0b95f 100644 --- a/src/gs-prefs.c +++ b/src/gs-prefs.c @@ -60,7 +60,7 @@ static void gs_prefs_finalize (GObject *object); struct GSPrefsPrivate { GSettings *settings; - GSettings *lockdown; + GSettings *lockdown_settings; }; enum @@ -203,7 +203,7 @@ static void _gs_prefs_set_themes (GSPrefs *prefs, gchar **values) { - guint i; + guint i; if (prefs->themes) { g_slist_foreach (prefs->themes, (GFunc)g_free, NULL); @@ -213,7 +213,7 @@ _gs_prefs_set_themes (GSPrefs *prefs, /* take ownership of the list */ prefs->themes = NULL; for (i=0; values[i] != NULL; i++) - prefs->themes = g_slist_append (prefs->themes, g_strdup (values[i])); + prefs->themes = g_slist_append (prefs->themes, g_strdup (values[i])); } static void @@ -320,84 +320,84 @@ _gs_prefs_set_user_switch_enabled (GSPrefs *prefs, static void gs_prefs_load_from_settings (GSPrefs *prefs) { - glong value; - gboolean bvalue; - char *string; + glong value; + gboolean bvalue; + char *string; gchar **strv; gint mode; bvalue = g_settings_get_boolean (prefs->priv->settings, KEY_IDLE_ACTIVATION_ENABLED); - _gs_prefs_set_idle_activation_enabled (prefs, bvalue); + _gs_prefs_set_idle_activation_enabled (prefs, bvalue); bvalue = g_settings_get_boolean (prefs->priv->settings, KEY_LOCK_ENABLED); - _gs_prefs_set_lock_enabled (prefs, bvalue); + _gs_prefs_set_lock_enabled (prefs, bvalue); - bvalue = g_settings_get_boolean (prefs->priv->lockdown, KEY_LOCK_DISABLE); - _gs_prefs_set_lock_disabled (prefs, bvalue); + bvalue = g_settings_get_boolean (prefs->priv->lockdown_settings, KEY_LOCK_DISABLE); + _gs_prefs_set_lock_disabled (prefs, bvalue); - bvalue = g_settings_get_boolean (prefs->priv->lockdown, KEY_USER_SWITCH_DISABLE); - _gs_prefs_set_user_switch_disabled (prefs, bvalue); + bvalue = g_settings_get_boolean (prefs->priv->lockdown_settings, KEY_USER_SWITCH_DISABLE); + _gs_prefs_set_user_switch_disabled (prefs, bvalue); value = g_settings_get_int (prefs->priv->settings, KEY_ACTIVATE_DELAY); - _gs_prefs_set_timeout (prefs, value); + _gs_prefs_set_timeout (prefs, value); value = g_settings_get_int (prefs->priv->settings, KEY_POWER_DELAY); - _gs_prefs_set_power_timeout (prefs, value); + _gs_prefs_set_power_timeout (prefs, value); value = g_settings_get_int (prefs->priv->settings, KEY_LOCK_DELAY); - _gs_prefs_set_lock_timeout (prefs, value); + _gs_prefs_set_lock_timeout (prefs, value); value = g_settings_get_int (prefs->priv->settings, KEY_CYCLE_DELAY); - _gs_prefs_set_cycle_timeout (prefs, value); + _gs_prefs_set_cycle_timeout (prefs, value); mode = g_settings_get_enum (prefs->priv->settings, KEY_MODE); - _gs_prefs_set_mode (prefs, mode); + _gs_prefs_set_mode (prefs, mode); strv = g_settings_get_strv (prefs->priv->settings, KEY_THEMES); - _gs_prefs_set_themes (prefs, strv); - g_strfreev (strv); + _gs_prefs_set_themes (prefs, strv); + g_strfreev (strv); /* Embedded keyboard options */ bvalue = g_settings_get_boolean (prefs->priv->settings, KEY_KEYBOARD_ENABLED); - _gs_prefs_set_keyboard_enabled (prefs, bvalue); + _gs_prefs_set_keyboard_enabled (prefs, bvalue); string = g_settings_get_string (prefs->priv->settings, KEY_KEYBOARD_COMMAND); - _gs_prefs_set_keyboard_command (prefs, string); + _gs_prefs_set_keyboard_command (prefs, string); g_free (string); bvalue = g_settings_get_boolean (prefs->priv->settings, KEY_STATUS_MESSAGE_ENABLED); - _gs_prefs_set_status_message_enabled (prefs, bvalue); + _gs_prefs_set_status_message_enabled (prefs, bvalue); /* Logout options */ bvalue = g_settings_get_boolean (prefs->priv->settings, KEY_LOGOUT_ENABLED); - _gs_prefs_set_logout_enabled (prefs, bvalue); + _gs_prefs_set_logout_enabled (prefs, bvalue); string = g_settings_get_string (prefs->priv->settings, KEY_LOGOUT_COMMAND); - _gs_prefs_set_logout_command (prefs, string); + _gs_prefs_set_logout_command (prefs, string); g_free (string); value = g_settings_get_int (prefs->priv->settings, KEY_LOGOUT_DELAY); - _gs_prefs_set_logout_timeout (prefs, value); + _gs_prefs_set_logout_timeout (prefs, value); /* User switching options */ bvalue = g_settings_get_boolean (prefs->priv->settings, KEY_USER_SWITCH_ENABLED); - _gs_prefs_set_user_switch_enabled (prefs, bvalue); + _gs_prefs_set_user_switch_enabled (prefs, bvalue); } static void key_changed_cb (GSettings *settings, - const gchar *key, - GSPrefs *prefs) + gchar *key, + GSPrefs *prefs) { if (strcmp (key, KEY_MODE) == 0) { gint mode; mode = g_settings_get_enum (settings, key); - _gs_prefs_set_mode (prefs, mode); + _gs_prefs_set_mode (prefs, mode); } else if (strcmp (key, KEY_THEMES) == 0) @@ -405,8 +405,8 @@ key_changed_cb (GSettings *settings, gchar **strv = NULL; strv = g_settings_get_strv (settings, key); - _gs_prefs_set_themes (prefs, strv); - g_strfreev (strv); + _gs_prefs_set_themes (prefs, strv); + g_strfreev (strv); } else if (strcmp (key, KEY_ACTIVATE_DELAY) == 0) @@ -414,7 +414,7 @@ key_changed_cb (GSettings *settings, int delay; delay = g_settings_get_int (settings, key); - _gs_prefs_set_timeout (prefs, delay); + _gs_prefs_set_timeout (prefs, delay); } else if (strcmp (key, KEY_POWER_DELAY) == 0) @@ -422,7 +422,7 @@ key_changed_cb (GSettings *settings, int delay; delay = g_settings_get_int (settings, key); - _gs_prefs_set_power_timeout (prefs, delay); + _gs_prefs_set_power_timeout (prefs, delay); } else if (strcmp (key, KEY_LOCK_DELAY) == 0) @@ -430,22 +430,22 @@ key_changed_cb (GSettings *settings, int delay; delay = g_settings_get_int (settings, key); - _gs_prefs_set_lock_timeout (prefs, delay); + _gs_prefs_set_lock_timeout (prefs, delay); } else if (strcmp (key, KEY_IDLE_ACTIVATION_ENABLED) == 0) { gboolean enabled; enabled = g_settings_get_boolean (settings, key); - _gs_prefs_set_idle_activation_enabled (prefs, enabled); + _gs_prefs_set_idle_activation_enabled (prefs, enabled); } else if (strcmp (key, KEY_LOCK_ENABLED) == 0) { - gboolean enabled; + gboolean enabled; enabled = g_settings_get_boolean (settings, key); - _gs_prefs_set_lock_enabled (prefs, enabled); + _gs_prefs_set_lock_enabled (prefs, enabled); } else if (strcmp (key, KEY_LOCK_DISABLE) == 0) @@ -453,7 +453,7 @@ key_changed_cb (GSettings *settings, gboolean disabled; disabled = g_settings_get_boolean (settings, key); - _gs_prefs_set_lock_disabled (prefs, disabled); + _gs_prefs_set_lock_disabled (prefs, disabled); } else if (strcmp (key, KEY_USER_SWITCH_DISABLE) == 0) @@ -461,7 +461,7 @@ key_changed_cb (GSettings *settings, gboolean disabled; disabled = g_settings_get_boolean (settings, key); - _gs_prefs_set_user_switch_disabled (prefs, disabled); + _gs_prefs_set_user_switch_disabled (prefs, disabled); } else if (strcmp (key, KEY_CYCLE_DELAY) == 0) @@ -469,7 +469,7 @@ key_changed_cb (GSettings *settings, int delay; delay = g_settings_get_int (settings, key); - _gs_prefs_set_cycle_timeout (prefs, delay); + _gs_prefs_set_cycle_timeout (prefs, delay); } else if (strcmp (key, KEY_KEYBOARD_ENABLED) == 0) @@ -477,15 +477,16 @@ key_changed_cb (GSettings *settings, gboolean enabled; enabled = g_settings_get_boolean (settings, key); - _gs_prefs_set_keyboard_enabled (prefs, enabled); + _gs_prefs_set_keyboard_enabled (prefs, enabled); } else if (strcmp (key, KEY_KEYBOARD_COMMAND) == 0) { - const char *command; + char *command; command = g_settings_get_string (settings, key); - _gs_prefs_set_keyboard_command (prefs, command); + _gs_prefs_set_keyboard_command (prefs, command); + g_free (command); } else if (strcmp (key, KEY_STATUS_MESSAGE_ENABLED) == 0) @@ -493,7 +494,7 @@ key_changed_cb (GSettings *settings, gboolean enabled; enabled = g_settings_get_boolean (settings, key); - _gs_prefs_set_status_message_enabled (prefs, enabled); + _gs_prefs_set_status_message_enabled (prefs, enabled); } else if (strcmp (key, KEY_LOGOUT_ENABLED) == 0) @@ -501,7 +502,7 @@ key_changed_cb (GSettings *settings, gboolean enabled; enabled = g_settings_get_boolean (settings, key); - _gs_prefs_set_logout_enabled (prefs, enabled); + _gs_prefs_set_logout_enabled (prefs, enabled); } else if (strcmp (key, KEY_LOGOUT_DELAY) == 0) @@ -509,23 +510,22 @@ key_changed_cb (GSettings *settings, int delay; delay = g_settings_get_int (settings, key); - _gs_prefs_set_logout_timeout (prefs, delay); + _gs_prefs_set_logout_timeout (prefs, delay); } else if (strcmp (key, KEY_LOGOUT_COMMAND) == 0) { - const char *command; - + char *command; command = g_settings_get_string (settings, key); - _gs_prefs_set_logout_command (prefs, command); - + _gs_prefs_set_logout_command (prefs, command); + g_free (command); } else if (strcmp (key, KEY_USER_SWITCH_ENABLED) == 0) { gboolean enabled; enabled = g_settings_get_boolean (settings, key); - _gs_prefs_set_user_switch_enabled (prefs, enabled); + _gs_prefs_set_user_switch_enabled (prefs, enabled); } else @@ -541,16 +541,16 @@ gs_prefs_init (GSPrefs *prefs) { prefs->priv = GS_PREFS_GET_PRIVATE (prefs); - prefs->priv->settings = g_settings_new (GSETTINGS_SCHEMA); - g_signal_connect (prefs->priv->settings, - "changed", - G_CALLBACK (key_changed_cb), - prefs); - prefs->priv->lockdown = g_settings_new (LOCKDOWN_SETTINGS_SCHEMA); - g_signal_connect (prefs->priv->lockdown, - "changed", - G_CALLBACK (key_changed_cb), - prefs); + prefs->priv->settings = g_settings_new (GSETTINGS_SCHEMA); + g_signal_connect (prefs->priv->settings, + "changed", + G_CALLBACK (key_changed_cb), + prefs); + prefs->priv->lockdown_settings = g_settings_new (LOCKDOWN_SETTINGS_SCHEMA); + g_signal_connect (prefs->priv->lockdown_settings, + "changed", + G_CALLBACK (key_changed_cb), + prefs); prefs->idle_activation_enabled = TRUE; prefs->lock_enabled = TRUE; prefs->lock_disabled = FALSE; @@ -586,10 +586,10 @@ gs_prefs_finalize (GObject *object) prefs->priv->settings = NULL; } - if (prefs->priv->lockdown) { - g_object_unref (prefs->priv->lockdown); - prefs->priv->lockdown = NULL; - } + if (prefs->priv->lockdown_settings) { + g_object_unref (prefs->priv->lockdown_settings); + prefs->priv->lockdown_settings = NULL; + } if (prefs->themes) { diff --git a/src/mate-screensaver.c b/src/mate-screensaver.c index cee3a97..34f26c6 100644 --- a/src/mate-screensaver.c +++ b/src/mate-screensaver.c @@ -48,7 +48,7 @@ int main(int argc, char **argv) GError* error = NULL; static gboolean show_version = FALSE; - static gboolean no_daemon = FALSE; + static gboolean no_daemon = TRUE; static gboolean debug = FALSE; static GOptionEntry entries[] = { @@ -88,7 +88,7 @@ int main(int argc, char **argv) } /* debug to a file if in deamon mode */ - gs_debug_init(debug, !no_daemon); + gs_debug_init(debug, FALSE); gs_debug("initializing mate-screensaver %s", VERSION); monitor = gs_monitor_new(); @@ -115,12 +115,6 @@ int main(int argc, char **argv) exit(1); } - /* Don't close stdout and stderr for now */ - if (!no_daemon && daemon(0, 1)) - { - g_error("Could not daemonize: %s", g_strerror (errno)); - } - gtk_main(); g_object_unref(monitor); |