[gnome-shell] UnlockDialog: go back to the lock screen automatically when idle



commit 341b6a1290f5b46429d457b07fe377f67e34808f
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Thu Aug 16 21:24:53 2012 +0200

    UnlockDialog: go back to the lock screen automatically when idle
    
    Now that GDM no longer emits auth failures after 25 seconds, we
    need to handle inactivity ourselves.
    This has also the advantage that it tracks real inactivity, rather
    than a timeout from a fixed point in time.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=682041

 js/ui/unlockDialog.js |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/unlockDialog.js b/js/ui/unlockDialog.js
index 8f2e6c2..c582635 100644
--- a/js/ui/unlockDialog.js
+++ b/js/ui/unlockDialog.js
@@ -20,6 +20,9 @@ const UserMenu = imports.ui.userMenu;
 const Batch = imports.gdm.batch;
 const GdmUtil = imports.gdm.util;
 
+// The timeout before going back automatically to the lock screen (in seconds)
+const IDLE_TIMEOUT = 2 * 60;
+
 // A widget showing the user avatar and name
 const UserWidget = new Lang.Class({
     Name: 'UserWidget',
@@ -154,6 +157,11 @@ const UnlockDialog = new Lang.Class({
             this.emit('loaded');
             return false;
         }));
+
+        this._idleMonitor = Shell.IdleMonitor.get();
+        // this dialog is only created after user activity (curtain drag or
+        // escape key press), so the timeout will fire after IDLE_TIMEOUT seconds of inactivity
+        this._idleWatchId = this._idleMonitor.add_watch(IDLE_TIMEOUT * 1000, Lang.bind(this, this._escape));
     },
 
     _updateOkButton: function(sensitive) {
@@ -218,6 +226,12 @@ const UnlockDialog = new Lang.Class({
 
     destroy: function() {
         this._userVerifier.clear();
+
+        if (this._idleWatchId) {
+            this._idleMonitor.remove_watch(this._idleWatchId);
+            this._idleWatchId = 0;
+        }
+
         this.parent();
     },
 



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