Author: andar

Revision: 5258

Log:
        Remove gobject timer and replace with a twisted LoopingCall

Diff:
Modified: trunk/deluge/configmanager.py
===================================================================
--- trunk/deluge/configmanager.py       2009-05-12 05:38:36 UTC (rev 5257)
+++ trunk/deluge/configmanager.py       2009-05-12 16:15:06 UTC (rev 5258)
@@ -22,11 +22,10 @@
 #      Boston, MA    02110-1301, USA.
 #
 
-
-import gobject
 import os
-import os.path
 
+from twisted.internet.task import LoopingCall
+
 import deluge.common
 from deluge.log import LOG as log
 from deluge.config import Config
@@ -37,8 +36,9 @@
         self.config_files = {}
         self.__config_directory = None
         # Set a 5 minute timer to call save()
-        gobject.timeout_add(300000, self.save)
-    
+        self.__timer = LoopingCall(self.save)
+        self.__timer.start(300, False)
+
     @property
     def config_directory(self):
         if self.__config_directory is None:
@@ -75,8 +75,8 @@
 
     def save(self):
         """Saves all the configs to disk."""
-        for key in self.config_files.keys():
-            self.config_files[key].save()
+        for value in self.config_files.values():
+            value.save()
         # We need to return True to keep the timer active
         return True
 



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to