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"))
|
||||
exit.addActionListener({
|
||||
application.getWindowManager().findWindow("main-frame").setVisible(false)
|
||||
application.getWindowManager().findWindow("shutdown-window").setVisible(true)
|
||||
Core core = application.getContext().get("core")
|
||||
if (core != null) {
|
||||
Thread t = new Thread({
|
||||
core.shutdown()
|
||||
application.shutdown()
|
||||
}as Runnable)
|
||||
t.start()
|
||||
} else
|
||||
def mainFrame = application.getMvcGroupManager().findGroup("MainFrame")
|
||||
if (mainFrame != null)
|
||||
mainFrame.view.closeApplication()
|
||||
else
|
||||
application.shutdown()
|
||||
tray.remove(trayIcon)
|
||||
})
|
||||
|
|
|
@ -1517,7 +1517,7 @@ class MainFrameView {
|
|||
rv
|
||||
}
|
||||
|
||||
private void closeApplication() {
|
||||
void closeApplication() {
|
||||
Core core = application.getContext().get("core")
|
||||
|
||||
def tabbedPane = builder.getVariable("result-tabs")
|
||||
|
@ -1531,18 +1531,17 @@ class MainFrameView {
|
|||
settings.mainFrameX = mainFrame.getSize().width
|
||||
settings.mainFrameY = mainFrame.getSize().height
|
||||
mainFrame.setVisible(false)
|
||||
application.getWindowManager().findWindow("shutdown-window").setVisible(true)
|
||||
application.getWindowManager().findWindow("shutdown-window")?.setVisible(true)
|
||||
if (core != null) {
|
||||
Thread t = new Thread({
|
||||
core.shutdown()
|
||||
application.shutdown()
|
||||
}as Runnable)
|
||||
t.start()
|
||||
}
|
||||
|
||||
File uiPropsFile = new File(core.home, "gui.properties")
|
||||
uiPropsFile.withOutputStream { settings.write(it) }
|
||||
}
|
||||
}
|
||||
|
||||
private static class TreeExpansions implements TreeExpansionListener {
|
||||
private final Set<TreePath> expandedPaths = new HashSet<>()
|
||||
|
|
Loading…
Reference in New Issue