diff --git a/gui/src/main/java/io/bitsquare/app/BitsquareApp.java b/gui/src/main/java/io/bitsquare/app/BitsquareApp.java index ae5fc7d086..15e2088cf2 100644 --- a/gui/src/main/java/io/bitsquare/app/BitsquareApp.java +++ b/gui/src/main/java/io/bitsquare/app/BitsquareApp.java @@ -111,7 +111,6 @@ public class BitsquareApp extends Application { // load the main view and create the main scene CachingViewLoader viewLoader = injector.getInstance(CachingViewLoader.class); mainView = (MainView) viewLoader.load(MainView.class); - mainView.setExitHandler(this::stop); mainView.setPersistedFilesCorrupted(corruptedDatabaseFiles); scene = new Scene(mainView.getRoot(), 1000, 650); diff --git a/gui/src/main/java/io/bitsquare/gui/main/MainView.java b/gui/src/main/java/io/bitsquare/gui/main/MainView.java index 03eb8fab55..f701023661 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/MainView.java +++ b/gui/src/main/java/io/bitsquare/gui/main/MainView.java @@ -81,7 +81,6 @@ public class MainView extends InitializableView { private ProgressBar blockchainSyncIndicator; private Label blockchainSyncLabel; private Label updateInfoLabel; - private Runnable exitHandler; private List persistedFilesCorrupted; @Inject @@ -190,10 +189,6 @@ public class MainView extends InitializableView { Platform.runLater(model::initBackend); } - public void setExitHandler(Runnable exitHandler) { - this.exitHandler = exitHandler; - } - public void setPersistedFilesCorrupted(List persistedFilesCorrupted) { this.persistedFilesCorrupted = persistedFilesCorrupted; } @@ -213,9 +208,7 @@ public class MainView extends InitializableView { blockchainSyncLabel.textProperty().bind(model.blockchainSyncInfo); walletServiceErrorMsgListener = (ov, oldValue, newValue) -> { blockchainSyncLabel.setId("splash-error-state-msg"); - Popups.openErrorPopup("Error", "Connecting to the bitcoin network failed. \n" + newValue - + "\nPlease check our internet connection and restart the application."); - exitHandler.run(); + openBTCConnectionErrorPopup(newValue); }; model.walletServiceErrorMsg.addListener(walletServiceErrorMsgListener); @@ -264,10 +257,7 @@ public class MainView extends InitializableView { bootstrapErrorMsgListener = (ov, oldValue, newValue) -> { bootstrapStateLabel.setId("splash-error-state-msg"); bootstrapIndicator.setVisible(false); - - Popups.openErrorPopup("Error", "Connecting to the Bitsquare network failed. \n" + model.bootstrapErrorMsg.get() - + "\nPlease check our internet connection and restart the application."); - exitHandler.run(); + openBTCConnectionErrorPopup(model.bootstrapErrorMsg.get()); }; model.bootstrapErrorMsg.addListener(bootstrapErrorMsgListener); @@ -373,9 +363,7 @@ public class MainView extends InitializableView { bitcoinNetworkLabel.setId("splash-error-state-msg"); bitcoinNetworkLabel.textProperty().unbind(); bitcoinNetworkLabel.setText("Not connected"); - Popups.openErrorPopup("Error", "Connecting to the bitcoin network failed. \n" + newValue - + "\nPlease check our internet connection and restart the application."); - exitHandler.run(); + openBTCConnectionErrorPopup(newValue); }); model.blockchainSyncProgress.addListener((ov, oldValue, newValue) -> { @@ -428,8 +416,7 @@ public class MainView extends InitializableView { bootstrapLabel.textProperty().unbind(); bootstrapLabel.setText("Not connected"); Popups.openErrorPopup("Error", "Connecting to the P2P network failed. \n" + newValue - + "\nPlease check our internet connection and restart the application."); - exitHandler.run(); + + "\nPlease check our internet connection."); }); AnchorPane footerContainer = new AnchorPane(separator, blockchainSyncBox, versionLabel, bootstrapLabel, bootstrapIcon, numPeersLabel) {{ @@ -559,4 +546,9 @@ public class MainView extends InitializableView { throw new IllegalArgumentException("Cannot get ID for " + viewClass + ": class must end in " + suffix); return viewName.substring(0, suffixIdx).toLowerCase(); } + + private void openBTCConnectionErrorPopup(String errorMsg) { + Popups.openErrorPopup("Error", "Connecting to the bitcoin network failed. \n" + errorMsg + + "\nPlease check our internet connection."); + } } \ No newline at end of file