Remove gobject timer and replace with a twisted LoopingCall

This commit is contained in:
Andrew Resch 2009-05-12 16:15:06 +00:00
commit 0ab8fa4871

View file

@ -22,10 +22,9 @@
# Boston, MA 02110-1301, USA. # Boston, MA 02110-1301, USA.
# #
import gobject
import os import os
import os.path
from twisted.internet.task import LoopingCall
import deluge.common import deluge.common
from deluge.log import LOG as log from deluge.log import LOG as log
@ -37,8 +36,9 @@ class _ConfigManager:
self.config_files = {} self.config_files = {}
self.__config_directory = None self.__config_directory = None
# Set a 5 minute timer to call save() # 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 @property
def config_directory(self): def config_directory(self):
if self.__config_directory is None: if self.__config_directory is None:
@ -75,8 +75,8 @@ class _ConfigManager:
def save(self): def save(self):
"""Saves all the configs to disk.""" """Saves all the configs to disk."""
for key in self.config_files.keys(): for value in self.config_files.values():
self.config_files[key].save() value.save()
# We need to return True to keep the timer active # We need to return True to keep the timer active
return True return True