]> git.neil.brown.name Git - freerunner.git/commitdiff
dnotify: allow a notification request to be cancelled.
authorNeil Brown <neilb@suse.de>
Sun, 8 Feb 2009 07:22:44 +0000 (18:22 +1100)
committerNeil Brown <neilb@suse.de>
Sun, 8 Feb 2009 07:22:44 +0000 (18:22 +1100)
lib/dnotify.py

index 7ae7aeaa1d45164f548a239ac49f4651fe07bdb8..1cd8c4115cc7b05011e402bb2c87f66ab1846ae9 100644 (file)
@@ -38,6 +38,10 @@ class dir():
         for f in self.files:
             f.check()
 
+    def cancel(self, victim):
+        if victim in self.files:
+            self.files.remove(victim)
+
 class file():
     def __init__(self, fname, callback):
         self.name = fname
@@ -58,6 +62,12 @@ class file():
         self.callback(self)
         return True
 
+    def cancel(self):
+        global dirlist
+        for d in dirlist:
+            d.cancel(self)
+
+
 if __name__ == "__main__" :
     import signal