From ef88f11c4f70e3b209656d823edd2becd89bf8a1 Mon Sep 17 00:00:00 2001 From: En-Jan Chou Date: Thu, 26 Dec 2019 06:11:55 -0500 Subject: [PATCH] Hide startHidden setting when system tray is not supported For platform not supporting system tray, users will have no chance to show window and modify settings back again if the window is hidden at startup. --- .../ui/preferences/GeneralPreferencesController.java | 9 ++++++++- main/ui/src/main/resources/fxml/preferences_general.fxml | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/main/ui/src/main/java/org/cryptomator/ui/preferences/GeneralPreferencesController.java b/main/ui/src/main/java/org/cryptomator/ui/preferences/GeneralPreferencesController.java index bbccb0ad7..94647efa8 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/preferences/GeneralPreferencesController.java +++ b/main/ui/src/main/java/org/cryptomator/ui/preferences/GeneralPreferencesController.java @@ -15,6 +15,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.inject.Inject; +import javax.inject.Named; @PreferencesScoped public class GeneralPreferencesController implements FxController { @@ -22,6 +23,7 @@ public class GeneralPreferencesController implements FxController { private static final Logger LOG = LoggerFactory.getLogger(GeneralPreferencesController.class); private final Settings settings; + private final boolean trayMenuSupported; public ChoiceBox themeChoiceBox; public CheckBox startHiddenCheckbox; public CheckBox debugModeCheckbox; @@ -30,8 +32,9 @@ public class GeneralPreferencesController implements FxController { public RadioButton nodeOrientationRtl; @Inject - GeneralPreferencesController(Settings settings) { + GeneralPreferencesController(Settings settings, @Named("trayMenuSupported") boolean trayMenuSupported) { this.settings = settings; + this.trayMenuSupported = trayMenuSupported; } public void initialize() { @@ -48,6 +51,10 @@ public class GeneralPreferencesController implements FxController { nodeOrientationRtl.setSelected(settings.userInterfaceOrientation().get() == NodeOrientation.RIGHT_TO_LEFT); } + public boolean isTrayMenuSupported() { + return this.trayMenuSupported; + } + private void toggleNodeOrientation(@SuppressWarnings("unused") ObservableValue observable, @SuppressWarnings("unused") Toggle oldValue, Toggle newValue) { if (nodeOrientationLtr.equals(newValue)) { settings.userInterfaceOrientation().set(NodeOrientation.LEFT_TO_RIGHT); diff --git a/main/ui/src/main/resources/fxml/preferences_general.fxml b/main/ui/src/main/resources/fxml/preferences_general.fxml index 1f05151f8..f5ee40489 100644 --- a/main/ui/src/main/resources/fxml/preferences_general.fxml +++ b/main/ui/src/main/resources/fxml/preferences_general.fxml @@ -30,7 +30,7 @@ - +