summaryrefslogtreecommitdiff
path: root/src/core.py
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2013-06-18 20:37:04 +0200
committerFlorent Le Coz <louiz@louiz.org>2013-06-18 20:37:04 +0200
commit39fa811374b7119173120175e70fb4f197bc0aba (patch)
treea9d4f70ce027ae7df31aaf4c97008fb7307533db /src/core.py
parentef9672c0fd5f053ba2eae8704836685a3edb340c (diff)
downloadpoezio-39fa811374b7119173120175e70fb4f197bc0aba.tar.gz
poezio-39fa811374b7119173120175e70fb4f197bc0aba.tar.bz2
poezio-39fa811374b7119173120175e70fb4f197bc0aba.tar.xz
poezio-39fa811374b7119173120175e70fb4f197bc0aba.zip
Trigger config_change handlers when the config has changed using a USR1 signal
Diffstat (limited to 'src/core.py')
-rw-r--r--src/core.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/core.py b/src/core.py
index 9e12ba03..9476bd42 100644
--- a/src/core.py
+++ b/src/core.py
@@ -370,7 +370,18 @@ class Core(object):
log.debug("Theme reloaded.")
# reload the config from the disk
log.debug("Reloading the config…")
- config.__init__(config.file_name)
+ # Copy the old config in a dict
+ old_config = config.to_dict()
+ config.read_file(config.file_name)
+ # Compare old and current config, to trigger the callbacks of all
+ # modified options
+ for section in config.sections():
+ old_section = old_config.get(section, {})
+ for option in config.options(section):
+ old_value = old_section.get(option)
+ new_value = config.get(option, "", section)
+ if new_value != old_value:
+ self.trigger_configuration_change(option, new_value)
log.debug("Config reloaded.")
# in case some roster options have changed
roster.modified()