From ce024ff0062363a4f86e1bb51db007ae78a5941f Mon Sep 17 00:00:00 2001
From: str4d <str4d@mail.i2p>
Date: Sat, 21 Jul 2012 11:39:13 +0000
Subject: [PATCH] Store susidns theme setting in themes.config

---
 .../susidns/src/java/src/i2p/susi/dns/BaseBean.java | 13 ++++++++++---
 apps/susidns/src/jsp/config.jsp                     |  3 ---
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/apps/susidns/src/java/src/i2p/susi/dns/BaseBean.java b/apps/susidns/src/java/src/i2p/susi/dns/BaseBean.java
index a5cc49e2da..7d229cd841 100644
--- a/apps/susidns/src/java/src/i2p/susi/dns/BaseBean.java
+++ b/apps/susidns/src/java/src/i2p/susi/dns/BaseBean.java
@@ -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;
     }
 }
diff --git a/apps/susidns/src/jsp/config.jsp b/apps/susidns/src/jsp/config.jsp
index 95e904c3a3..10cc595808 100644
--- a/apps/susidns/src/jsp/config.jsp
+++ b/apps/susidns/src/jsp/config.jsp
@@ -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">
-- 
GitLab