gnome-shell/g-s-honor-lock-delay-GSettings.patch

42 lines
1.8 KiB
Diff
Raw Normal View History

From db1aea210969e3c9558dd672620d8df2ebab0a4b Mon Sep 17 00:00:00 2001
From: Giovanni Campagna <gcampagna@src.gnome.org>
Date: Tue, 25 Dec 2012 00:13:52 +0000
Subject: ScreenShield: honor lock-delay GSettings key
org.gnome.desktop.screensaver.lock-delay contains the grace period
of the screensaver: if deactivated within that many seconds from the
start of the idle period, the shell should not prompt for a password.
This setting correspond to the "Lock screen after" combo in screen
and privacy panels.
https://bugzilla.gnome.org/show_bug.cgi?id=690766
---
diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js
index 988e191..94fc2b5 100644
--- a/js/ui/screenShield.js
+++ b/js/ui/screenShield.js
@@ -26,6 +26,7 @@ const Util = imports.misc.util;
const SCREENSAVER_SCHEMA = 'org.gnome.desktop.screensaver';
const LOCK_ENABLED_KEY = 'lock-enabled';
+const LOCK_DELAY_KEY = 'lock-delay';
const CURTAIN_SLIDE_TIME = 0.3;
// fraction of screen height the arrow must reach before completing
@@ -582,7 +583,11 @@ const ScreenShield = new Lang.Class({
let lightboxWasShown = this._lightbox.shown;
this._lightbox.hide();
- let shouldLock = lightboxWasShown && this._settings.get_boolean(LOCK_ENABLED_KEY);
+ // GLib.get_monotonic_time() returns microseconds, convert to seconds
+ let elapsedTime = (GLib.get_monotonic_time() - this._activationTime) / 1000000;
+ let shouldLock = lightboxWasShown &&
+ this._settings.get_boolean(LOCK_ENABLED_KEY) &&
+ (elapsedTime >= this._settings.get_boolean(LOCK_DELAY_KEY));
if (shouldLock || this._isLocked) {
this.lock(false);
} else if (this._isActive) {
--
cgit v0.9.0.2