I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit d147db33 authored by str4d's avatar str4d
Browse files

Only call SaveConfig once in ConfigUIHandler

parent 9d29dc6b
No related branches found
No related tags found
No related merge requests found
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 { ...@@ -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.") +
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment