[gnome-flashback] screensaver: redo screen lock on suspend



commit 9f4c4fbce11a2e3422671c3fd25624eac3f407c8
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Sat Jun 27 21:21:35 2020 +0300

    screensaver: redo screen lock on suspend
    
    Don't lock screen on suspend if automatic screen lock is disabled.

 gnome-flashback/libscreensaver/gf-listener.c    |  8 +++++++-
 gnome-flashback/libscreensaver/gf-screensaver.c | 14 ++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)
---
diff --git a/gnome-flashback/libscreensaver/gf-listener.c b/gnome-flashback/libscreensaver/gf-listener.c
index 63641bc..f7fe225 100644
--- a/gnome-flashback/libscreensaver/gf-listener.c
+++ b/gnome-flashback/libscreensaver/gf-listener.c
@@ -66,6 +66,8 @@ enum
 
   ACTIVE_CHANGED,
 
+  PREPARE_FOR_SLEEP,
+
   LAST_SIGNAL
 };
 
@@ -379,7 +381,7 @@ prepare_for_sleep_cb (GfLoginManagerGen *login_manager,
   if (start)
     {
       g_debug ("A system suspend has been requested");
-      g_signal_emit (self, listener_signals[LOCK], 0);
+      g_signal_emit (self, listener_signals[PREPARE_FOR_SLEEP], 0);
       release_inhibit_lock (self);
     }
   else
@@ -524,6 +526,10 @@ install_signals (GObjectClass *object_class)
   listener_signals[ACTIVE_CHANGED] =
     g_signal_new ("active-changed", GF_TYPE_LISTENER, G_SIGNAL_RUN_LAST,
                   0, NULL, NULL, NULL, G_TYPE_BOOLEAN, 1, G_TYPE_BOOLEAN);
+
+  listener_signals[PREPARE_FOR_SLEEP] =
+    g_signal_new ("prepare-for-sleep", GF_TYPE_LISTENER, G_SIGNAL_RUN_LAST,
+                  0, NULL, NULL, NULL, G_TYPE_NONE, 0);
 }
 
 static void
diff --git a/gnome-flashback/libscreensaver/gf-screensaver.c b/gnome-flashback/libscreensaver/gf-screensaver.c
index c2dd07e..f97eb59 100644
--- a/gnome-flashback/libscreensaver/gf-screensaver.c
+++ b/gnome-flashback/libscreensaver/gf-screensaver.c
@@ -196,6 +196,16 @@ listener_show_message_cb (GfListener    *listener,
   gf_manager_show_message (self->manager, summary, body, icon);
 }
 
+static void
+listener_prepare_for_sleep_cb (GfListener    *listener,
+                               GfScreensaver *self)
+{
+  if (!gf_prefs_get_lock_enabled (self->prefs))
+    return;
+
+  listener_lock_cb (listener, self);
+}
+
 static gboolean
 watcher_idle_changed_cb (GfWatcher     *watcher,
                          gboolean       is_idle,
@@ -336,6 +346,10 @@ gf_screensaver_init (GfScreensaver *self)
                     G_CALLBACK (listener_show_message_cb),
                     self);
 
+  g_signal_connect (self->listener, "prepare-for-sleep",
+                    G_CALLBACK (listener_prepare_for_sleep_cb),
+                    self);
+
   g_signal_connect (self->watcher, "idle-changed",
                     G_CALLBACK (watcher_idle_changed_cb),
                     self);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]