From 9b6145ce3fde36e7b8d46ffacb3aad2c79a9d5bf Mon Sep 17 00:00:00 2001 From: En-Jan Chou Date: Wed, 18 Dec 2019 02:28:58 -0500 Subject: [PATCH] Initialize radio button before binding settings to it The usesIndividualMountPath setting will be cleared if it bind to an uninitialized radio button. This patch sets radio button with current settings before binding the setting to the radio button. --- .../ui/vaultoptions/MountOptionsController.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/main/ui/src/main/java/org/cryptomator/ui/vaultoptions/MountOptionsController.java b/main/ui/src/main/java/org/cryptomator/ui/vaultoptions/MountOptionsController.java index 040b8cf6c..9ed5ba2ea 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/vaultoptions/MountOptionsController.java +++ b/main/ui/src/main/java/org/cryptomator/ui/vaultoptions/MountOptionsController.java @@ -84,12 +84,7 @@ public class MountOptionsController implements FxController { driveLetterSelection.getItems().addAll(windowsDriveLetters.getAllDriveLetters()); driveLetterSelection.setConverter(new WinDriveLetterLabelConverter(windowsDriveLetters)); driveLetterSelection.setValue(vault.getVaultSettings().winDriveLetter().get()); - vault.getVaultSettings().usesIndividualMountPath().bind(mountPoint.selectedToggleProperty().isEqualTo(mountPointCustomDir)); - vault.getVaultSettings().winDriveLetter().bind( // - Bindings.when(mountPoint.selectedToggleProperty().isEqualTo(mountPointWinDriveLetter)) // - .then(driveLetterSelection.getSelectionModel().selectedItemProperty()) // - .otherwise((String) null) // - ); + if (vault.getVaultSettings().usesIndividualMountPath().get()) { mountPoint.selectToggle(mountPointCustomDir); } else if (!Strings.isNullOrEmpty(vault.getVaultSettings().winDriveLetter().get())) { @@ -97,6 +92,13 @@ public class MountOptionsController implements FxController { } else { mountPoint.selectToggle(mountPointAuto); } + + vault.getVaultSettings().usesIndividualMountPath().bind(mountPoint.selectedToggleProperty().isEqualTo(mountPointCustomDir)); + vault.getVaultSettings().winDriveLetter().bind( // + Bindings.when(mountPoint.selectedToggleProperty().isEqualTo(mountPointWinDriveLetter)) // + .then(driveLetterSelection.getSelectionModel().selectedItemProperty()) // + .otherwise((String) null) // + ); } @FXML