[Xfce4-commits] [apps/xfce4-screensaver] 02/17: Implement lock on suspend

noreply at xfce.org noreply at xfce.org
Sat Mar 9 22:23:37 CET 2019


This is an automated email from the git hooks/post-receive script.

b   l   u   e   s   a   b   r   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/xfce4-screensaver.

commit 9e53bb2866f186b8f0c31198f4e8337040b2ad7c
Author: Alexander Butenko <a.butenka at gmail.com>
Date:   Tue Feb 5 22:48:53 2019 -0400

    Implement lock on suspend
---
 src/gs-listener-dbus.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/src/gs-listener-dbus.c b/src/gs-listener-dbus.c
index 67c1b89..a0aa27d 100644
--- a/src/gs-listener-dbus.c
+++ b/src/gs-listener-dbus.c
@@ -1484,6 +1484,22 @@ listener_dbus_handle_system_message (DBusConnection *connection,
             }
 
             return DBUS_HANDLER_RESULT_HANDLED;
+        } else if (dbus_message_is_signal (message, SYSTEMD_LOGIND_INTERFACE, "PrepareForSleep")) {
+            gboolean  active = 0;
+            DBusError error;
+
+            dbus_error_init (&error);
+            dbus_message_get_args (message, &error, DBUS_TYPE_BOOLEAN, &active, DBUS_TYPE_INVALID);
+            if (active) {
+                gs_debug ("Logind requested session lock");
+                g_signal_emit (listener, signals[LOCK], 0);
+            } else {
+                gs_debug ("Logind requested session unlock");
+                //FIXME: there is no signal to request password prompt
+                g_signal_emit (listener, signals[SHOW_MESSAGE], 0, NULL, NULL, NULL);
+            }
+
+            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")) {
@@ -2031,6 +2047,12 @@ gs_listener_acquire (GSListener  *listener,
             dbus_bus_add_match (listener->priv->system_connection,
                                 "type='signal'"
                                 ",sender='"SYSTEMD_LOGIND_SERVICE"'"
+                                ",interface='"SYSTEMD_LOGIND_INTERFACE"'"
+                                ",member='PrepareForSleep'",
+                                NULL);
+            dbus_bus_add_match (listener->priv->system_connection,
+                                "type='signal'"
+                                ",sender='"SYSTEMD_LOGIND_SERVICE"'"
                                 ",interface='"DBUS_INTERFACE_PROPERTIES"'"
                                 ",member='PropertiesChanged'",
                                 NULL);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list