diff options
Diffstat (limited to 'src')
42 files changed, 349 insertions, 143 deletions
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/copy-theme-dialog.c b/src/copy-theme-dialog.c index ed7808d..51c47f2 100644 --- a/src/copy-theme-dialog.c +++ b/src/copy-theme-dialog.c @@ -13,8 +13,8 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301, USA. **/ #include "config.h" diff --git a/src/copy-theme-dialog.h b/src/copy-theme-dialog.h index 6e72017..4f18546 100644 --- a/src/copy-theme-dialog.h +++ b/src/copy-theme-dialog.h @@ -13,8 +13,8 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301, USA. **/ #ifndef __COPY_THEME_DIALOG_H__ diff --git a/src/gs-auth-pam.c b/src/gs-auth-pam.c index 44c8aca..f5c761e 100644 --- a/src/gs-auth-pam.c +++ b/src/gs-auth-pam.c @@ -17,8 +17,8 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301, USA. * */ diff --git a/src/gs-auth-pwent.c b/src/gs-auth-pwent.c index 3fe1b22..0b253c6 100644 --- a/src/gs-auth-pwent.c +++ b/src/gs-auth-pwent.c @@ -15,8 +15,8 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301, USA. * */ diff --git a/src/gs-auth.h b/src/gs-auth.h index 503e92d..480a56a 100644 --- a/src/gs-auth.h +++ b/src/gs-auth.h @@ -14,8 +14,8 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301, USA. * */ diff --git a/src/gs-debug.c b/src/gs-debug.c index 52fbc12..59f71f8 100644 --- a/src/gs-debug.c +++ b/src/gs-debug.c @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * Authors: William Jon McCann <[email protected]> * diff --git a/src/gs-debug.h b/src/gs-debug.h index fdf9fd8..7bddd51 100644 --- a/src/gs-debug.h +++ b/src/gs-debug.h @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * Authors: William Jon McCann <[email protected]> * diff --git a/src/gs-fade.c b/src/gs-fade.c index ba04b67..e894b36 100644 --- a/src/gs-fade.c +++ b/src/gs-fade.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * Authors: William Jon McCann <[email protected]> * diff --git a/src/gs-fade.h b/src/gs-fade.h index 65f3e7f..4d3df66 100644 --- a/src/gs-fade.h +++ b/src/gs-fade.h @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * Authors: William Jon McCann <[email protected]> * diff --git a/src/gs-grab-x11.c b/src/gs-grab-x11.c index 9eca1ec..40650fb 100644 --- a/src/gs-grab-x11.c +++ b/src/gs-grab-x11.c @@ -14,8 +14,8 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301, USA. * * Authors: William Jon McCann <[email protected]> * diff --git a/src/gs-grab.h b/src/gs-grab.h index 4717f49..0cba10c 100644 --- a/src/gs-grab.h +++ b/src/gs-grab.h @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * Authors: William Jon McCann <[email protected]> * diff --git a/src/gs-job.c b/src/gs-job.c index 30d1f34..0a90ba8 100644 --- a/src/gs-job.c +++ b/src/gs-job.c @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * Authors: William Jon McCann <[email protected]> * diff --git a/src/gs-job.h b/src/gs-job.h index ba7084e..b154017 100644 --- a/src/gs-job.h +++ b/src/gs-job.h @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * Authors: William Jon McCann <[email protected]> * diff --git a/src/gs-listener-dbus.c b/src/gs-listener-dbus.c index 601689c..1f759e0 100644 --- a/src/gs-listener-dbus.c +++ b/src/gs-listener-dbus.c @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * Authors: William Jon McCann <[email protected]> * @@ -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; } @@ -2057,7 +2204,7 @@ gboolean gs_listener_acquire (GSListener *listener, GError **error) { - gboolean acquired; + int acquired; DBusError buserror; gboolean is_connected; @@ -2107,7 +2254,8 @@ gs_listener_acquire (GSListener *listener, acquired = dbus_bus_request_name (listener->priv->connection, GS_LISTENER_SERVICE, - 0, &buserror) != -1; + DBUS_NAME_FLAG_DO_NOT_QUEUE, + &buserror); if (dbus_error_is_set (&buserror)) { g_set_error (error, @@ -2116,6 +2264,14 @@ gs_listener_acquire (GSListener *listener, "%s", buserror.message); } + if (acquired == DBUS_REQUEST_NAME_REPLY_EXISTS) { + g_set_error (error, + GS_LISTENER_ERROR, + GS_LISTENER_ERROR_ACQUISITION_FAILURE, + "%s", + _("screensaver already running in this session")); + return FALSE; + } dbus_error_free (&buserror); @@ -2134,7 +2290,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,9 +2336,11 @@ gs_listener_acquire (GSListener *listener, ",interface='"CK_SESSION_INTERFACE"'" ",member='ActiveChanged'", NULL); +#endif } - return acquired; +finish: + return (acquired != -1); } static char * @@ -2179,6 +2362,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 +2408,9 @@ query_session_id (GSListener *listener) dbus_message_unref (reply); return g_strdup (ssid); +#else + return NULL; +#endif } static void @@ -2220,6 +2426,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-listener-dbus.h b/src/gs-listener-dbus.h index a2e298a..a7cd04f 100644 --- a/src/gs-listener-dbus.h +++ b/src/gs-listener-dbus.h @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * Authors: William Jon McCann <[email protected]> * diff --git a/src/gs-lock-plug.c b/src/gs-lock-plug.c index bad85ac..dff9a5a 100644 --- a/src/gs-lock-plug.c +++ b/src/gs-lock-plug.c @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * Authors: William Jon McCann <[email protected]> * diff --git a/src/gs-lock-plug.h b/src/gs-lock-plug.h index 3217bbf..bbbfaf8 100644 --- a/src/gs-lock-plug.h +++ b/src/gs-lock-plug.h @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * Authors: William Jon McCann <[email protected]> * diff --git a/src/gs-manager.c b/src/gs-manager.c index 276b0c3..de8a638 100644 --- a/src/gs-manager.c +++ b/src/gs-manager.c @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * Authors: William Jon McCann <[email protected]> * diff --git a/src/gs-manager.h b/src/gs-manager.h index 61e64b6..4e537fe 100644 --- a/src/gs-manager.h +++ b/src/gs-manager.h @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * Authors: William Jon McCann <[email protected]> * diff --git a/src/gs-monitor.c b/src/gs-monitor.c index c8fdc48..67cf4bb 100644 --- a/src/gs-monitor.c +++ b/src/gs-monitor.c @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * Authors: William Jon McCann <[email protected]> * diff --git a/src/gs-monitor.h b/src/gs-monitor.h index 6acc18c..75c2212 100644 --- a/src/gs-monitor.h +++ b/src/gs-monitor.h @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * Authors: William Jon McCann <[email protected]> * diff --git a/src/gs-prefs.c b/src/gs-prefs.c index 1a8a426..6d7f562 100644 --- a/src/gs-prefs.c +++ b/src/gs-prefs.c @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * Authors: William Jon McCann <[email protected]> * @@ -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/gs-prefs.h b/src/gs-prefs.h index 7a354dd..fd4cf73 100644 --- a/src/gs-prefs.h +++ b/src/gs-prefs.h @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * Authors: William Jon McCann <[email protected]> * diff --git a/src/gs-theme-manager.c b/src/gs-theme-manager.c index 32b086f..350e28c 100644 --- a/src/gs-theme-manager.c +++ b/src/gs-theme-manager.c @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * Authors: William Jon McCann <[email protected]> * diff --git a/src/gs-theme-manager.h b/src/gs-theme-manager.h index 5b79309..aaaf532 100644 --- a/src/gs-theme-manager.h +++ b/src/gs-theme-manager.h @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * Authors: William Jon McCann <[email protected]> * diff --git a/src/gs-visual-gl.c b/src/gs-visual-gl.c index 7a71c79..ac4c535 100644 --- a/src/gs-visual-gl.c +++ b/src/gs-visual-gl.c @@ -15,8 +15,8 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301, USA. * */ diff --git a/src/gs-visual-gl.h b/src/gs-visual-gl.h index fca138c..09cbdd9 100644 --- a/src/gs-visual-gl.h +++ b/src/gs-visual-gl.h @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * */ diff --git a/src/gs-watcher-x11.c b/src/gs-watcher-x11.c index 1e3114e..39c10a6 100644 --- a/src/gs-watcher-x11.c +++ b/src/gs-watcher-x11.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * Authors: William Jon McCann <[email protected]> * diff --git a/src/gs-watcher.h b/src/gs-watcher.h index be06bc7..9c88723 100644 --- a/src/gs-watcher.h +++ b/src/gs-watcher.h @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * Authors: William Jon McCann <[email protected]> * diff --git a/src/gs-window-x11.c b/src/gs-window-x11.c index 2e6f0f7..878893b 100644 --- a/src/gs-window-x11.c +++ b/src/gs-window-x11.c @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * Authors: William Jon McCann <[email protected]> * diff --git a/src/gs-window.h b/src/gs-window.h index 9c8aee3..860118c 100644 --- a/src/gs-window.h +++ b/src/gs-window.h @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * Authors: William Jon McCann <[email protected]> * diff --git a/src/mate-screensaver-command.c b/src/mate-screensaver-command.c index d6f0459..3a08757 100644 --- a/src/mate-screensaver-command.c +++ b/src/mate-screensaver-command.c @@ -14,8 +14,8 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301, USA. * * Authors: William Jon McCann <[email protected]> * diff --git a/src/mate-screensaver-dialog.c b/src/mate-screensaver-dialog.c index 10083aa..7a58e48 100644 --- a/src/mate-screensaver-dialog.c +++ b/src/mate-screensaver-dialog.c @@ -14,8 +14,8 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301, USA. * * Authors: William Jon McCann <[email protected]> * diff --git a/src/mate-screensaver-gl-helper.c b/src/mate-screensaver-gl-helper.c index fd128f5..814c79f 100644 --- a/src/mate-screensaver-gl-helper.c +++ b/src/mate-screensaver-gl-helper.c @@ -14,8 +14,8 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301, USA. * */ diff --git a/src/mate-screensaver-preferences.c b/src/mate-screensaver-preferences.c index 26c30ea..174aea8 100644 --- a/src/mate-screensaver-preferences.c +++ b/src/mate-screensaver-preferences.c @@ -14,8 +14,8 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301, USA. * * Authors: William Jon McCann <[email protected]> * Rodrigo Moya <[email protected]> diff --git a/src/mate-screensaver.c b/src/mate-screensaver.c index cee3a97..04add35 100644 --- a/src/mate-screensaver.c +++ b/src/mate-screensaver.c @@ -14,8 +14,8 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301, USA. * * Authors: William Jon McCann <[email protected]> * @@ -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); diff --git a/src/mate-screensaver.h b/src/mate-screensaver.h index 8934653..8a73d3a 100644 --- a/src/mate-screensaver.h +++ b/src/mate-screensaver.h @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * Authors: William Jon McCann <[email protected]> * diff --git a/src/test-fade.c b/src/test-fade.c index 2bc6c92..3b10a37 100644 --- a/src/test-fade.c +++ b/src/test-fade.c @@ -14,8 +14,8 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301, USA. * * Authors: William Jon McCann <[email protected]> * diff --git a/src/test-passwd.c b/src/test-passwd.c index 3f7a849..2497045 100644 --- a/src/test-passwd.c +++ b/src/test-passwd.c @@ -14,8 +14,8 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301, USA. * * Authors: William Jon McCann <[email protected]> * diff --git a/src/test-watcher.c b/src/test-watcher.c index 5e8ca08..9b56063 100644 --- a/src/test-watcher.c +++ b/src/test-watcher.c @@ -14,8 +14,8 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301, USA. * * Authors: William Jon McCann <[email protected]> * diff --git a/src/test-window.c b/src/test-window.c index 6600411..05883a7 100644 --- a/src/test-window.c +++ b/src/test-window.c @@ -14,8 +14,8 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301, USA. * * Authors: William Jon McCann <[email protected]> * |