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