Store susidns theme setting in themes.config

This commit is contained in:
str4d
2012-07-21 11:39:13 +00:00
parent e603b120c3
commit ce024ff006
2 changed files with 10 additions and 6 deletions

View File

@@ -4,24 +4,30 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
import net.i2p.I2PAppContext;
/**
* Holds methods common to several Beans.
* @since 0.9.1
*/
public class BaseBean
{
private final I2PAppContext _context;
protected final Properties properties;
private String _theme;
private long configLastLoaded = 0;
private static final String PRIVATE_BOOK = "private_addressbook";
private static final String DEFAULT_PRIVATE_BOOK = "../privatehosts.txt";
public static final String PROP_THEME_NAME = "theme";
public static final String THEME_CONFIG_FILE = "themes.config";
public static final String PROP_THEME_NAME = "susidns.theme";
public static final String DEFAULT_THEME = "light";
public static final String BASE_THEME_PATH = "/themes/susidns/";
public BaseBean()
{
_context = I2PAppContext.getGlobalContext();
properties = new Properties();
}
@@ -40,6 +46,8 @@ public class BaseBean
// added in 0.5, for compatibility with 0.4 config.txt
if( properties.getProperty(PRIVATE_BOOK) == null)
properties.setProperty(PRIVATE_BOOK, DEFAULT_PRIVATE_BOOK);
// Fetch theme
_theme = _context.readConfigFile(THEME_CONFIG_FILE).getProperty(PROP_THEME_NAME, DEFAULT_THEME);
configLastLoaded = currentTime;
}
catch (Exception e) {
@@ -57,8 +65,7 @@ public class BaseBean
public String getTheme() {
loadConfig();
String url = BASE_THEME_PATH;
String theme = properties.getProperty(PROP_THEME_NAME, DEFAULT_THEME);
url += theme + "/";
url += _theme + "/";
return url;
}
}

View File

@@ -130,9 +130,6 @@
<li><b>log</b> -
<%=intl._("File to log activity to (change to /dev/null if you like)")%>
</li>
<li><b>theme</b> -
<%=intl._("Name of the theme to use (defaults to 'light')")%>
</li>
</ul>
</div><hr>
<div id="footer">