forked from I2P_Developers/i2p.i2p
i2psnark: Sort themes in config form
Don't return null from getThemes()
This commit is contained in:
@ -600,10 +600,10 @@ public class SnarkManager implements CompleteListener {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all themes
|
* Get all themes
|
||||||
* @return String[] -- Array of all the themes found.
|
* @return String[] -- Array of all the themes found, non-null, unsorted
|
||||||
*/
|
*/
|
||||||
public String[] getThemes() {
|
public String[] getThemes() {
|
||||||
String[] themes = null;
|
String[] themes;
|
||||||
// "docs/themes/snark/"
|
// "docs/themes/snark/"
|
||||||
File dir = new File(_context.getBaseDir(), "docs/themes/snark");
|
File dir = new File(_context.getBaseDir(), "docs/themes/snark");
|
||||||
FileFilter fileFilter = new FileFilter() { public boolean accept(File file) { return file.isDirectory(); } };
|
FileFilter fileFilter = new FileFilter() { public boolean accept(File file) { return file.isDirectory(); } };
|
||||||
@ -614,6 +614,8 @@ public class SnarkManager implements CompleteListener {
|
|||||||
for(int i = 0; i < dirnames.length; i++) {
|
for(int i = 0; i < dirnames.length; i++) {
|
||||||
themes[i] = dirnames[i].getName();
|
themes[i] = dirnames[i].getName();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
themes = new String[0];
|
||||||
}
|
}
|
||||||
// return the map.
|
// return the map.
|
||||||
return themes;
|
return themes;
|
||||||
|
@ -2115,6 +2115,7 @@ public class I2PSnarkServlet extends BasicServlet {
|
|||||||
out.write(": <td><select name='theme'>");
|
out.write(": <td><select name='theme'>");
|
||||||
String theme = _manager.getTheme();
|
String theme = _manager.getTheme();
|
||||||
String[] themes = _manager.getThemes();
|
String[] themes = _manager.getThemes();
|
||||||
|
Arrays.sort(themes);
|
||||||
for(int i = 0; i < themes.length; i++) {
|
for(int i = 0; i < themes.length; i++) {
|
||||||
if(themes[i].equals(theme))
|
if(themes[i].equals(theme))
|
||||||
out.write("\n<OPTION value=\"" + themes[i] + "\" SELECTED>" + themes[i]);
|
out.write("\n<OPTION value=\"" + themes[i] + "\" SELECTED>" + themes[i]);
|
||||||
|
Reference in New Issue
Block a user