mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-11-05 05:46:44 +00:00
add preference option to load recent wallets
This commit is contained in:
parent
211e5952aa
commit
6fbd332b4d
5 changed files with 25 additions and 2 deletions
|
@ -540,7 +540,7 @@ public class AppServices {
|
|||
Platform.runLater(() -> {
|
||||
if(!Window.getWindows().isEmpty()) {
|
||||
List<File> walletFiles = allWallets.stream().map(walletTabData -> walletTabData.getStorage().getWalletFile()).collect(Collectors.toList());
|
||||
Config.get().setRecentWalletFiles(walletFiles);
|
||||
Config.get().setRecentWalletFiles(Config.get().isLoadRecentWallets() ? walletFiles : Collections.emptyList());
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ public class Config {
|
|||
private FeeRatesSelection feeRatesSelection;
|
||||
private Currency fiatCurrency;
|
||||
private ExchangeSource exchangeSource;
|
||||
private boolean loadRecentWallets = true;
|
||||
private boolean validateDerivationPaths = true;
|
||||
private boolean groupByAddress = true;
|
||||
private boolean includeMempoolChange = true;
|
||||
|
@ -155,6 +156,15 @@ public class Config {
|
|||
flush();
|
||||
}
|
||||
|
||||
public boolean isLoadRecentWallets() {
|
||||
return loadRecentWallets;
|
||||
}
|
||||
|
||||
public void setLoadRecentWallets(boolean loadRecentWallets) {
|
||||
this.loadRecentWallets = loadRecentWallets;
|
||||
flush();
|
||||
}
|
||||
|
||||
public boolean isValidateDerivationPaths() {
|
||||
return validateDerivationPaths;
|
||||
}
|
||||
|
|
|
@ -33,6 +33,9 @@ public class GeneralPreferencesController extends PreferencesDetailController {
|
|||
@FXML
|
||||
private ComboBox<ExchangeSource> exchangeSource;
|
||||
|
||||
@FXML
|
||||
private UnlabeledToggleSwitch loadRecentWallets;
|
||||
|
||||
@FXML
|
||||
private UnlabeledToggleSwitch validateDerivationPaths;
|
||||
|
||||
|
@ -97,6 +100,12 @@ public class GeneralPreferencesController extends PreferencesDetailController {
|
|||
|
||||
updateCurrencies(exchangeSource.getSelectionModel().getSelectedItem());
|
||||
|
||||
loadRecentWallets.setSelected(config.isLoadRecentWallets());
|
||||
loadRecentWallets.selectedProperty().addListener((observableValue, oldValue, newValue) -> {
|
||||
config.setLoadRecentWallets(newValue);
|
||||
EventManager.get().post(new RequestOpenWalletsEvent());
|
||||
});
|
||||
|
||||
validateDerivationPaths.setSelected(config.isValidateDerivationPaths());
|
||||
validateDerivationPaths.selectedProperty().addListener((observableValue, oldValue, newValue) -> {
|
||||
config.setValidateDerivationPaths(newValue);
|
||||
|
|
|
@ -47,7 +47,7 @@ public class PreferencesDialog extends Dialog<Boolean> {
|
|||
}
|
||||
|
||||
dialogPane.setPrefWidth(750);
|
||||
dialogPane.setPrefHeight(600);
|
||||
dialogPane.setPrefHeight(630);
|
||||
|
||||
preferencesController.reconnectOnClosingProperty().set(AppServices.isConnecting() || AppServices.isConnected());
|
||||
setOnCloseRequest(event -> {
|
||||
|
|
|
@ -72,6 +72,10 @@
|
|||
</Field>
|
||||
</Fieldset>
|
||||
<Fieldset inputGrow="SOMETIMES" text="Wallet" styleClass="wideLabelFieldSet">
|
||||
<Field text="Load recent wallets:">
|
||||
<UnlabeledToggleSwitch fx:id="loadRecentWallets" />
|
||||
<HelpLabel helpText="Keep a record of open wallets, and reopen them on startup."/>
|
||||
</Field>
|
||||
<Field text="Validate derivations:">
|
||||
<UnlabeledToggleSwitch fx:id="validateDerivationPaths" />
|
||||
<HelpLabel helpText="Disallow keystores to have derivation paths that match the defaults for other script types."/>
|
||||
|
|
Loading…
Reference in a new issue