From 771f645df089e543d14dcf32cca4b3cda872db10 Mon Sep 17 00:00:00 2001 From: Zlatin Balevsky Date: Wed, 23 Oct 2019 08:48:53 +0100 Subject: [PATCH] proper close --- .../views/com/muwire/gui/MainFrameView.groovy | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/gui/griffon-app/views/com/muwire/gui/MainFrameView.groovy b/gui/griffon-app/views/com/muwire/gui/MainFrameView.groovy index 69d37f4a..7b446421 100644 --- a/gui/griffon-app/views/com/muwire/gui/MainFrameView.groovy +++ b/gui/griffon-app/views/com/muwire/gui/MainFrameView.groovy @@ -86,7 +86,7 @@ class MainFrameView { visible : bind { model.coreInitialized }) { menuBar { menu (text : "File") { - menuItem("Exit", actionPerformed : {application.shutdown()}) + menuItem("Exit", actionPerformed : {closeApplication()}) } menu (text : "Options") { menuItem("Configuration", actionPerformed : {mvcGroup.createMVCGroup("Options")}) @@ -456,16 +456,7 @@ class MainFrameView { } } } else { - mainFrame.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() - } + closeApplication() } }}) @@ -930,4 +921,18 @@ class MainFrameView { tree.setSelectionPaths(selectedPaths) builder.getVariable("shared-files-table").model.fireTableDataChanged() } + + private void closeApplication() { + def mainFrame = builder.getVariable("main-frame") + mainFrame.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() + } + } } \ No newline at end of file