diff options
Diffstat (limited to 'Locker.py')
-rw-r--r-- | Locker.py | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -4,7 +4,7 @@ import Idle class Locker(object): - def __init__(self, lockTimeout, doLock, doUnlock, logoutTimeout = 0, doLogout = None, updateLogoutTimeout = None): + def __init__(self, lockTimeout, doLock, doUnlock, logoutTimeout = None, doLogout = None, updateLogoutTimeout = None): self.locked = False self.lockTimeout = lockTimeout self.logoutTimeout = logoutTimeout @@ -13,7 +13,10 @@ class Locker(object): self.doLogout = doLogout self.updateLogoutTimeout = updateLogoutTimeout - GLib.timeout_add_seconds(1, self._checkLock) + if self.lockTimeout > 0: + GLib.timeout_add_seconds(1, self._checkLock) + else: + GLib.idle_add(self.lock) def _checkLock(self): if self.locked: |