DTG: Can't do first-time startup from /configservice,

restart required
This commit is contained in:
zzz
2016-05-09 14:26:07 +00:00
parent 702e1c5a78
commit 97fca96861

View File

@ -332,15 +332,25 @@ public class ConfigServiceHandler extends FormHandler {
ClientApp dtg = mgr.getRegisteredApp("desktopgui"); ClientApp dtg = mgr.getRegisteredApp("desktopgui");
if (dtg != null) { if (dtg != null) {
if (enable) { if (enable) {
if (dtg.getState() == ClientAppState.STOPPED) if (dtg.getState() == ClientAppState.STOPPED) {
dtg.startup(); dtg.startup();
addFormNotice(_t("Enabled system tray"));
}
} else { } else {
if (dtg.getState() == ClientAppState.RUNNING) if (dtg.getState() == ClientAppState.RUNNING) {
dtg.shutdown(null); dtg.shutdown(null);
addFormNotice(_t("Disabled system tray"));
}
} }
} else if (enable) { } else if (enable) {
// already set to true, GraphicsEnvironment initialized, can't change it now
if (Boolean.valueOf(System.getProperty("java.awt.headless"))) {
addFormError(_t("Restart required to take effect"));
} else {
dtg = new net.i2p.desktopgui.Main(_context, mgr, null); dtg = new net.i2p.desktopgui.Main(_context, mgr, null);
dtg.startup(); dtg.startup();
addFormNotice(_t("Enabled system tray"));
}
} }
} catch (Throwable t) { } catch (Throwable t) {
if (enable) if (enable)