From e43385126cf6f5187f98f940b8c04c3e99202b0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ball=C3=B3=20Gy=C3=B6rgy?= Date: Thu, 28 Feb 2013 05:45:12 +0100 Subject: [PATCH 1/4] Fix crashing and compatibility with gnome-screensaver's D-Bus interface --- src/cinnamon-screensaver-command.c | 4 ++-- src/gs-listener-dbus.c | 10 ++++++++-- src/gs-manager.c | 14 +++++++++++--- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/cinnamon-screensaver-command.c b/src/cinnamon-screensaver-command.c index 4267bd0..5c90916 100644 --- a/src/cinnamon-screensaver-command.c +++ b/src/cinnamon-screensaver-command.c @@ -311,11 +311,11 @@ if (do_lock) { if (g_strcmp0 (away_message, "DEFAULT") == 0) { - reply = screensaver_send_message_string (connection, "Lock", away_message); + reply = screensaver_send_message_string (connection, "LockMessage", away_message); } else { gchar * custom_message = g_strdup_printf("CUSTOM###%s", away_message); - reply = screensaver_send_message_string (connection, "Lock", custom_message); + reply = screensaver_send_message_string (connection, "LockMessage", custom_message); g_free (custom_message); } if (reply == NULL) { diff --git a/src/gs-listener-dbus.c b/src/gs-listener-dbus.c index 2a98aee..6dbf12d 100644 --- a/src/gs-listener-dbus.c +++ b/src/gs-listener-dbus.c @@ -653,6 +653,8 @@ enum { xml = g_string_append (xml, " \n" " \n" + " \n" + " \n" " \n" " \n" " \n" @@ -744,6 +746,10 @@ enum { g_return_val_if_fail (message != NULL, DBUS_HANDLER_RESULT_NOT_YET_HANDLED); if (dbus_message_is_method_call (message, GS_SERVICE, "Lock")) { + g_signal_emit (listener, signals [LOCK], 0); + return send_success_reply (connection, message); + } + if (dbus_message_is_method_call (message, GS_SERVICE, "LockMessage")) { return listener_lock (listener, connection, message); } if (dbus_message_is_method_call (message, GS_SERVICE, "Quit")) { @@ -906,7 +912,7 @@ enum { } else if (dbus_message_is_signal (message, SYSTEMD_LOGIND_SESSION_INTERFACE, "Lock")) { if (_listener_message_path_is_our_session (listener, message)) { gs_debug ("systemd requested session lock"); - return listener_lock (listener, connection, message); + g_signal_emit (listener, signals [LOCK], 0); } return DBUS_HANDLER_RESULT_HANDLED; @@ -948,7 +954,7 @@ enum { } else if (dbus_message_is_signal (message, CK_SESSION_INTERFACE, "Lock")) { if (_listener_message_path_is_our_session (listener, message)) { gs_debug ("ConsoleKit requested session lock"); - return listener_lock (listener, connection, message); + g_signal_emit (listener, signals [LOCK], 0); } return DBUS_HANDLER_RESULT_HANDLED; diff --git a/src/gs-manager.c b/src/gs-manager.c index 1544921..bc09cb9 100644 --- a/src/gs-manager.c +++ b/src/gs-manager.c @@ -1275,10 +1275,18 @@ enum { gs_manager_set_away_message (GSManager *manager, const char *message) { - g_free (manager->priv->logout_command); - - manager->priv->away_message = g_strdup(message); GSList *l; + + g_return_if_fail (GS_IS_MANAGER (manager)); + + g_free (manager->priv->away_message); + + if (message) { + manager->priv->away_message = g_strdup (message); + } else { + manager->priv->away_message = NULL; + } + for (l = manager->priv->windows; l; l = l->next) { gs_window_set_away_message (l->data, manager->priv->away_message); } -- 1.8.1.6 From 4db01451afbb246213f483805f81a77c4c7371a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ball=C3=B3=20Gy=C3=B6rgy?= Date: Fri, 1 Mar 2013 05:17:46 +0100 Subject: [PATCH 2/4] Update dbus document with the new LockMessage method --- doc/dbus-interface.html | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/dbus-interface.html b/doc/dbus-interface.html index faff26c..c9f95ba 100644 --- a/doc/dbus-interface.html +++ b/doc/dbus-interface.html @@ -2,6 +2,8 @@             
          

Version 1.7.1


Request that the screen be locked. -

+

+ LockMessage +

+ Request that the screen be locked, and set an away message. +

DirectionTypeDescription
instringthe away message

Cycle

Request that the screen saver theme be restarted and, if applicable, -- 1.8.1.6