mirror of https://github.com/zlatinb/muwire
reuse closing code from system tray. That fixes remembering window size and closing while muwire is still loading
parent
edede81ffc
commit
2cd5691e9c
|
@ -146,16 +146,10 @@ class Initialize extends AbstractLifecycleHandler {
|
||||||
|
|
||||||
def exit = new MenuItem(Translator.trans("EXIT"))
|
def exit = new MenuItem(Translator.trans("EXIT"))
|
||||||
exit.addActionListener({
|
exit.addActionListener({
|
||||||
application.getWindowManager().findWindow("main-frame").setVisible(false)
|
def mainFrame = application.getMvcGroupManager().findGroup("MainFrame")
|
||||||
application.getWindowManager().findWindow("shutdown-window").setVisible(true)
|
if (mainFrame != null)
|
||||||
Core core = application.getContext().get("core")
|
mainFrame.view.closeApplication()
|
||||||
if (core != null) {
|
else
|
||||||
Thread t = new Thread({
|
|
||||||
core.shutdown()
|
|
||||||
application.shutdown()
|
|
||||||
}as Runnable)
|
|
||||||
t.start()
|
|
||||||
} else
|
|
||||||
application.shutdown()
|
application.shutdown()
|
||||||
tray.remove(trayIcon)
|
tray.remove(trayIcon)
|
||||||
})
|
})
|
||||||
|
|
|
@ -1517,7 +1517,7 @@ class MainFrameView {
|
||||||
rv
|
rv
|
||||||
}
|
}
|
||||||
|
|
||||||
private void closeApplication() {
|
void closeApplication() {
|
||||||
Core core = application.getContext().get("core")
|
Core core = application.getContext().get("core")
|
||||||
|
|
||||||
def tabbedPane = builder.getVariable("result-tabs")
|
def tabbedPane = builder.getVariable("result-tabs")
|
||||||
|
@ -1531,18 +1531,17 @@ class MainFrameView {
|
||||||
settings.mainFrameX = mainFrame.getSize().width
|
settings.mainFrameX = mainFrame.getSize().width
|
||||||
settings.mainFrameY = mainFrame.getSize().height
|
settings.mainFrameY = mainFrame.getSize().height
|
||||||
mainFrame.setVisible(false)
|
mainFrame.setVisible(false)
|
||||||
application.getWindowManager().findWindow("shutdown-window").setVisible(true)
|
application.getWindowManager().findWindow("shutdown-window")?.setVisible(true)
|
||||||
if (core != null) {
|
if (core != null) {
|
||||||
Thread t = new Thread({
|
Thread t = new Thread({
|
||||||
core.shutdown()
|
core.shutdown()
|
||||||
application.shutdown()
|
application.shutdown()
|
||||||
}as Runnable)
|
}as Runnable)
|
||||||
t.start()
|
t.start()
|
||||||
}
|
|
||||||
|
|
||||||
File uiPropsFile = new File(core.home, "gui.properties")
|
File uiPropsFile = new File(core.home, "gui.properties")
|
||||||
uiPropsFile.withOutputStream { settings.write(it) }
|
uiPropsFile.withOutputStream { settings.write(it) }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static class TreeExpansions implements TreeExpansionListener {
|
private static class TreeExpansions implements TreeExpansionListener {
|
||||||
private final Set<TreePath> expandedPaths = new HashSet<>()
|
private final Set<TreePath> expandedPaths = new HashSet<>()
|
||||||
|
|
Loading…
Reference in New Issue