Module: deluge
Branch: master
Commit: eff17931eb3da9fdf619338f910c7d36451e3b5f

Author: Andrew Resch <[email protected]>
Date:   Sun May  9 22:31:49 2010 -0700

Fix preferences manager not setting initial settings on start-up

---

 deluge/core/preferencesmanager.py |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/deluge/core/preferencesmanager.py 
b/deluge/core/preferencesmanager.py
index 7f12485..82b3630 100644
--- a/deluge/core/preferencesmanager.py
+++ b/deluge/core/preferencesmanager.py
@@ -153,9 +153,12 @@ class PreferencesManager(component.Component):
         self.core = component.get("Core")
         self.session = component.get("Core").session
         self.settings = component.get("Core").settings
-
         self.new_release_timer = None
 
+        # Set the initial preferences on start-up
+        for key in DEFAULT_PREFS:
+            self.do_config_set_func(key, self.config[key])
+
         self.config.register_change_callback(self._on_config_value_change)
 
     def stop(self):
@@ -163,12 +166,15 @@ class PreferencesManager(component.Component):
             self.new_release_timer.stop()
 
     # Config set functions
-    def _on_config_value_change(self, key, value):
-        component.get("EventManager").emit(ConfigValueChangedEvent(key, value))
+    def do_config_set_func(self, key, value):
         on_set_func = getattr(self, "_on_set_" + key, None)
         if on_set_func:
             on_set_func(key, value)
 
+    def _on_config_value_change(self, key, value):
+        self.do_config_set_func(key, value)
+        component.get("EventManager").emit(ConfigValueChangedEvent(key, value))
+
     def _on_set_torrentfiles_location(self, key, value):
         if self.config["copy_torrent_file"]:
             try:

-- 
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