diff --git a/src/main/java/org/cryptomator/ui/mainwindow/VaultListCellController.java b/src/main/java/org/cryptomator/ui/mainwindow/VaultListCellController.java index 6afac6a11..38d7ed1c7 100644 --- a/src/main/java/org/cryptomator/ui/mainwindow/VaultListCellController.java +++ b/src/main/java/org/cryptomator/ui/mainwindow/VaultListCellController.java @@ -10,8 +10,6 @@ import org.cryptomator.ui.controls.FontAwesome5Icon; import org.cryptomator.ui.controls.FontAwesome5IconView; import javax.inject.Inject; -import javafx.beans.binding.Bindings; -import javafx.beans.binding.BooleanBinding; import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleObjectProperty; import javafx.beans.value.ObservableValue; diff --git a/src/main/java/org/cryptomator/ui/mainwindow/VaultListController.java b/src/main/java/org/cryptomator/ui/mainwindow/VaultListController.java index 53b80753c..37b9841d0 100644 --- a/src/main/java/org/cryptomator/ui/mainwindow/VaultListController.java +++ b/src/main/java/org/cryptomator/ui/mainwindow/VaultListController.java @@ -71,8 +71,7 @@ public class VaultListController implements FxController { private final BooleanProperty draggingVaultOver = new SimpleBooleanProperty(); private final ResourceBundle resourceBundle; private final FxApplicationWindows appWindows; - private final Settings settings; - + private final ObservableValue cellSize; public ListView vaultList; public StackPane root; @FXML @@ -102,20 +101,17 @@ public class VaultListController implements FxController { this.vaultListManager = vaultListManager; this.resourceBundle = resourceBundle; this.appWindows = appWindows; - this.settings = settings; this.emptyVaultList = Bindings.isEmpty(vaults); selectedVault.addListener(this::selectedVaultDidChange); + cellSize = settings.compactMode.map(compact -> compact ? 30.0 : 60.0); } public void initialize() { vaultList.setItems(vaults); vaultList.setCellFactory(cellFactory); - vaultList.fixedCellSizeProperty().bind(Bindings.createDoubleBinding(() -> - settings.compactMode.get() ? 30.0 : 60.0, settings.compactMode)); - selectedVault.bind(vaultList.getSelectionModel().selectedItemProperty()); vaults.addListener((ListChangeListener.Change c) -> { while (c.next()) { @@ -280,5 +276,12 @@ public class VaultListController implements FxController { return draggingVaultOver.get(); } + public ObservableValue cellSizeProperty() { + return cellSize; + } + + public Double getCellSize() { + return cellSize.getValue(); + } } diff --git a/src/main/resources/fxml/vault_list.fxml b/src/main/resources/fxml/vault_list.fxml index b59b838a8..ae0905d4e 100644 --- a/src/main/resources/fxml/vault_list.fxml +++ b/src/main/resources/fxml/vault_list.fxml @@ -18,7 +18,7 @@ minWidth="206"> - +