forked from I2P_Developers/i2p.i2p
Only call SaveConfig once in ConfigUIHandler
This commit is contained in:
@ -1,5 +1,10 @@
|
||||
package net.i2p.router.web;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/** set the theme */
|
||||
public class ConfigUIHandler extends FormHandler {
|
||||
private boolean _shouldSave;
|
||||
@ -24,18 +29,18 @@ public class ConfigUIHandler extends FormHandler {
|
||||
private void saveChanges() {
|
||||
if (_config == null)
|
||||
return;
|
||||
Map<String, String> changes = new HashMap();
|
||||
List<String> removes = new ArrayList();
|
||||
String oldTheme = _context.getProperty(CSSHelper.PROP_THEME_NAME, CSSHelper.DEFAULT_THEME);
|
||||
boolean ok;
|
||||
if (_config.equals("default")) // obsolete
|
||||
ok = _context.router().saveConfig(CSSHelper.PROP_THEME_NAME, null);
|
||||
removes.add(CSSHelper.PROP_THEME_NAME);
|
||||
else
|
||||
ok = _context.router().saveConfig(CSSHelper.PROP_THEME_NAME, _config);
|
||||
if (ok) {
|
||||
if (_universalTheming)
|
||||
ok = _context.router().saveConfig(CSSHelper.PROP_UNIVERSAL_THEMING, "true");
|
||||
else
|
||||
ok = _context.router().saveConfig(CSSHelper.PROP_UNIVERSAL_THEMING, null);
|
||||
}
|
||||
changes.put(CSSHelper.PROP_THEME_NAME, _config);
|
||||
if (_universalTheming)
|
||||
changes.put(CSSHelper.PROP_UNIVERSAL_THEMING, "true");
|
||||
else
|
||||
removes.add(CSSHelper.PROP_UNIVERSAL_THEMING);
|
||||
boolean ok = _context.router().saveConfig(changes, removes);
|
||||
if (ok) {
|
||||
if (!oldTheme.equals(_config))
|
||||
addFormNotice(_("Theme change saved.") +
|
||||
|
Reference in New Issue
Block a user