summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouis <louis.braun@gmx.de>2013-10-27 16:17:24 +0100
committerlouis <louis.braun@gmx.de>2013-10-27 16:17:24 +0100
commit3cdbc204e283f45bfd71ea6adacd3693e83c1255 (patch)
tree344faf3a7d1240bf825b7a5c698d7e0f460354fb
parenteec77c1ec540282b30891aeede497045b97070b6 (diff)
downloadskin-nopacity-3cdbc204e283f45bfd71ea6adacd3693e83c1255.tar.gz
skin-nopacity-3cdbc204e283f45bfd71ea6adacd3693e83c1255.tar.bz2
Fixed a bug in theme specific configs
-rw-r--r--config.c28
-rw-r--r--config.h1
-rw-r--r--setup.c3
3 files changed, 20 insertions, 12 deletions
diff --git a/config.c b/config.c
index 9fa449a..f7d7e10 100644
--- a/config.c
+++ b/config.c
@@ -341,24 +341,28 @@ bool cNopacityConfig::SetupParse(const char *Name, const char *Value) {
std::map<std::string, int>::iterator hit = conf.find(name);
if (hit == conf.end())
return false;
- //check if theme already in map
- std::map<std::string, std::map<std::string, int> >::iterator hit2 = themeConfigSetup.find(theme);
- if (hit2 != themeConfigSetup.end()) {
- std::map<std::string, int> existingValues = (std::map<std::string, int>)hit2->second;
- existingValues.insert(std::pair<std::string, int>(name, atoi(Value)));
- themeConfigSetup.erase(theme);
- themeConfigSetup.insert(std::pair<std::string, std::map<std::string, int> >(theme, existingValues));
- } else {
- std::map<std::string, int> themeConf;
- themeConf.insert(std::pair<std::string, int>(name, atoi(Value)));
- themeConfigSetup.insert(std::pair<std::string, std::map<std::string, int> >(theme, themeConf));
- }
+ SetThemeConfigSetupValue(theme, name, atoi(Value));
} else {
return false;
}
return true;
}
+void cNopacityConfig::SetThemeConfigSetupValue(std::string themeName, std::string key, int value) {
+ //check if theme already in map
+ std::map<std::string, std::map<std::string, int> >::iterator hit = themeConfigSetup.find(themeName);
+ if (hit != themeConfigSetup.end()) {
+ std::map<std::string, int> existingValues = (std::map<std::string, int>)hit->second;
+ existingValues.insert(std::pair<std::string, int>(key, value));
+ themeConfigSetup.erase(themeName);
+ themeConfigSetup.insert(std::pair<std::string, std::map<std::string, int> >(themeName, existingValues));
+ } else {
+ std::map<std::string, int> themeConf;
+ themeConf.insert(std::pair<std::string, int>(key, value));
+ themeConfigSetup.insert(std::pair<std::string, std::map<std::string, int> >(themeName, themeConf));
+ }
+}
+
void cNopacityConfig::DumpConfig(void) {
esyslog("nopacity: current config -----------------");
for(std::map<std::string, int>::const_iterator it = conf.begin(); it != conf.end(); it++) {
diff --git a/config.h b/config.h
index 943f1d3..db77f87 100644
--- a/config.h
+++ b/config.h
@@ -23,6 +23,7 @@ class cNopacityConfig {
std::map<std::string, int>::const_iterator GetStart(void) { return conf.begin(); };
std::map<std::string, int>::const_iterator GetEnd(void) { return conf.end(); };
bool SetupParse(const char *Name, const char *Value);
+ void SetThemeConfigSetupValue(std::string themeName, std::string key, int value);
void SetLogoPath(cString path);
void SetIconPath(cString path);
void SetEpgImagePath(cString path);
diff --git a/setup.c b/setup.c
index e48dc41..2a607c9 100644
--- a/setup.c
+++ b/setup.c
@@ -84,7 +84,10 @@ void cNopacitySetup::Store(void) {
int value = (int)it->second;
int origValue = config.GetValue(name);
if (value != origValue) {
+ //Save changed value in setup.conf
SetupStore(*cString::sprintf("%s.%s", themeName, name.c_str()), value);
+ //Save changed value also in cConfig::themeConfigSetup
+ tmpConf.SetThemeConfigSetupValue(themeName, name, value);
}
}
config = tmpConf;