From 4d7d51f3f87f571c98ee11169fc029449c4d38fb Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Sun, 30 Aug 2020 13:47:31 +0200 Subject: [PATCH] dont show status server banner (but show height in tooltip) --- .../java/com/sparrowwallet/sparrow/AppController.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/sparrowwallet/sparrow/AppController.java b/src/main/java/com/sparrowwallet/sparrow/AppController.java index 629960c1..853204cb 100644 --- a/src/main/java/com/sparrowwallet/sparrow/AppController.java +++ b/src/main/java/com/sparrowwallet/sparrow/AppController.java @@ -255,7 +255,9 @@ public class AppController implements Initializable { }); onlineProperty.bindBidirectional(serverToggle.selectedProperty()); - onlineProperty().addListener((observable, oldValue, newValue) -> serverToggle.setTooltip(new Tooltip(newValue ? "Connected to " + Config.get().getElectrumServer() : "Disconnected"))); + onlineProperty().addListener((observable, oldValue, newValue) -> { + Platform.runLater(this::setServerToggleTooltip); + }); Config config = Config.get(); connectionService = createConnectionService(); @@ -670,6 +672,10 @@ public class AppController implements Initializable { return FileType.JSON.equals(fileType) || FileType.BINARY.equals(fileType); } + private void setServerToggleTooltip() { + serverToggle.setTooltip(new Tooltip(isOnline() ? "Connected to " + Config.get().getElectrumServer() + (getCurrentBlockHeight() != null ? " at height " + getCurrentBlockHeight() : "") : "Disconnected")); + } + public void newWallet(ActionEvent event) { WalletNameDialog dlg = new WalletNameDialog(); Optional walletName = dlg.showAndWait(); @@ -1172,7 +1178,7 @@ public class AppController implements Initializable { currentBlockHeight = event.getBlockHeight(); targetBlockFeeRates = event.getTargetBlockFeeRates(); String banner = event.getServerBanner(); - String status = "Connected: " + (banner == null ? "Server" : banner.split("\\R", 2)[0]) + " at height " + event.getBlockHeight(); + String status = "Connected to " + Config.get().getElectrumServer() + " at height " + event.getBlockHeight(); EventManager.get().post(new StatusEvent(status)); } @@ -1186,6 +1192,7 @@ public class AppController implements Initializable { @Subscribe public void newBlock(NewBlockEvent event) { currentBlockHeight = event.getHeight(); + setServerToggleTooltip(); String status = "Updating to new block height " + event.getHeight(); EventManager.get().post(new StatusEvent(status)); }