mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-20 02:12:00 +01:00
Remove cycle between SystemTray and BitsquareUI
This commit is contained in:
parent
b1a4641139
commit
f278db01ac
@ -109,7 +109,7 @@ public class BitsquareUI extends Application {
|
||||
|
||||
// configure the system tray
|
||||
|
||||
SystemTray systemTray = new SystemTray(primaryStage, this);
|
||||
SystemTray systemTray = new SystemTray(primaryStage, this::stop);
|
||||
primaryStage.setOnCloseRequest(e -> systemTray.hideStage());
|
||||
scene.setOnKeyReleased(keyEvent -> {
|
||||
if (new KeyCodeCombination(KeyCode.W, KeyCombination.SHORTCUT_DOWN).match(keyEvent))
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
package io.bitsquare.gui;
|
||||
|
||||
import io.bitsquare.BitsquareUI;
|
||||
import io.bitsquare.gui.util.ImageUtil;
|
||||
|
||||
import java.awt.*;
|
||||
@ -43,13 +42,13 @@ public class SystemTray {
|
||||
public static final String HIDE_WINDOW_LABEL = "Hide exchange window";
|
||||
|
||||
private final Stage stage;
|
||||
private final BitsquareUI application;
|
||||
private final Runnable onExit;
|
||||
private final TrayIcon trayIcon = createTrayIcon();
|
||||
private final MenuItem toggleShowHideItem = new MenuItem(HIDE_WINDOW_LABEL);
|
||||
|
||||
public SystemTray(Stage stage, BitsquareUI application) {
|
||||
public SystemTray(Stage stage, Runnable onExit) {
|
||||
this.stage = stage;
|
||||
this.application = application;
|
||||
this.onExit = onExit;
|
||||
init();
|
||||
}
|
||||
|
||||
@ -95,11 +94,7 @@ public class SystemTray {
|
||||
|
||||
exitItem.addActionListener(e -> {
|
||||
self.remove(trayIcon);
|
||||
try {
|
||||
application.stop();
|
||||
} catch (Exception ex) {
|
||||
log.error("Application failed to shut down properly.", ex);
|
||||
}
|
||||
onExit.run();
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user