summaryrefslogtreecommitdiffstats
path: root/Locker.py
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-01-28 14:31:07 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-01-28 14:31:07 +0100
commite342d5c7241cd04352948fb6937e05a98000b70c (patch)
tree4a8cdf8e6d4c8863026b310d8b6dda9188ba475c /Locker.py
parent76532c49651a372a25010bc7f7f8b60eeebefdfd (diff)
downloadpylock-e342d5c7241cd04352948fb6937e05a98000b70c.tar
pylock-e342d5c7241cd04352948fb6937e05a98000b70c.zip
Handle failed device grabs and retry lock
Diffstat (limited to 'Locker.py')
-rw-r--r--Locker.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Locker.py b/Locker.py
index fd2f5ed..0f10fe0 100644
--- a/Locker.py
+++ b/Locker.py
@@ -66,7 +66,10 @@ class Locker(object):
def lock(self):
if not self.locked:
self.locked = True
- self.doLock(self.logoutTimeout)
+ if not self.doLock(self.logoutTimeout):
+ self.locked = False
+ GLib.timeout_add_seconds(1, self._checkLock)
+ return False
if self.doLogout is not None:
self.currentLogoutTimeout = self.logoutTimeout
@@ -74,6 +77,8 @@ class Locker(object):
if self.currentLogoutTimeout > 0:
GLib.timeout_add_seconds(1, self._checkLogout)
+ return True
+
def unlock(self):
if self.locked:
self.doUnlock()