summaryrefslogtreecommitdiff
path: root/src/settings.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/settings.cpp')
-rw-r--r--src/settings.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/settings.cpp b/src/settings.cpp
index 65896ef27..001d93f5e 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -620,6 +620,13 @@ void Settings::update(const Settings &other)
}
+void Settings::registerChangedCallback(std::string name,
+ setting_changed_callback cbf)
+{
+ m_callbacks[name].push_back(cbf);
+}
+
+
inline bool Settings::parseConfigObject(std::istream &is,
std::string &name, std::string &value)
{
@@ -701,3 +708,20 @@ void Settings::clearNoLock()
m_defaults.clear();
}
+void Settings::doCallbacks(const std::string name)
+{
+ std::vector<setting_changed_callback> tempvector;
+ {
+ JMutexAutoLock lock(m_mutex);
+ if (m_callbacks.find(name) != m_callbacks.end())
+ {
+ tempvector = m_callbacks[name];
+ }
+ }
+
+ for (std::vector<setting_changed_callback>::iterator iter = tempvector.begin();
+ iter != tempvector.end(); iter ++)
+ {
+ (*iter)(name);
+ }
+}