mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-25 05:06:45 +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(() -> {
|
Platform.runLater(() -> {
|
||||||
if(!Window.getWindows().isEmpty()) {
|
if(!Window.getWindows().isEmpty()) {
|
||||||
List<File> walletFiles = allWallets.stream().map(walletTabData -> walletTabData.getStorage().getWalletFile()).collect(Collectors.toList());
|
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 FeeRatesSelection feeRatesSelection;
|
||||||
private Currency fiatCurrency;
|
private Currency fiatCurrency;
|
||||||
private ExchangeSource exchangeSource;
|
private ExchangeSource exchangeSource;
|
||||||
|
private boolean loadRecentWallets = true;
|
||||||
private boolean validateDerivationPaths = true;
|
private boolean validateDerivationPaths = true;
|
||||||
private boolean groupByAddress = true;
|
private boolean groupByAddress = true;
|
||||||
private boolean includeMempoolChange = true;
|
private boolean includeMempoolChange = true;
|
||||||
|
@ -155,6 +156,15 @@ public class Config {
|
||||||
flush();
|
flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isLoadRecentWallets() {
|
||||||
|
return loadRecentWallets;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLoadRecentWallets(boolean loadRecentWallets) {
|
||||||
|
this.loadRecentWallets = loadRecentWallets;
|
||||||
|
flush();
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isValidateDerivationPaths() {
|
public boolean isValidateDerivationPaths() {
|
||||||
return validateDerivationPaths;
|
return validateDerivationPaths;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,9 @@ public class GeneralPreferencesController extends PreferencesDetailController {
|
||||||
@FXML
|
@FXML
|
||||||
private ComboBox<ExchangeSource> exchangeSource;
|
private ComboBox<ExchangeSource> exchangeSource;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private UnlabeledToggleSwitch loadRecentWallets;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private UnlabeledToggleSwitch validateDerivationPaths;
|
private UnlabeledToggleSwitch validateDerivationPaths;
|
||||||
|
|
||||||
|
@ -97,6 +100,12 @@ public class GeneralPreferencesController extends PreferencesDetailController {
|
||||||
|
|
||||||
updateCurrencies(exchangeSource.getSelectionModel().getSelectedItem());
|
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.setSelected(config.isValidateDerivationPaths());
|
||||||
validateDerivationPaths.selectedProperty().addListener((observableValue, oldValue, newValue) -> {
|
validateDerivationPaths.selectedProperty().addListener((observableValue, oldValue, newValue) -> {
|
||||||
config.setValidateDerivationPaths(newValue);
|
config.setValidateDerivationPaths(newValue);
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class PreferencesDialog extends Dialog<Boolean> {
|
||||||
}
|
}
|
||||||
|
|
||||||
dialogPane.setPrefWidth(750);
|
dialogPane.setPrefWidth(750);
|
||||||
dialogPane.setPrefHeight(600);
|
dialogPane.setPrefHeight(630);
|
||||||
|
|
||||||
preferencesController.reconnectOnClosingProperty().set(AppServices.isConnecting() || AppServices.isConnected());
|
preferencesController.reconnectOnClosingProperty().set(AppServices.isConnecting() || AppServices.isConnected());
|
||||||
setOnCloseRequest(event -> {
|
setOnCloseRequest(event -> {
|
||||||
|
|
|
@ -72,6 +72,10 @@
|
||||||
</Field>
|
</Field>
|
||||||
</Fieldset>
|
</Fieldset>
|
||||||
<Fieldset inputGrow="SOMETIMES" text="Wallet" styleClass="wideLabelFieldSet">
|
<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:">
|
<Field text="Validate derivations:">
|
||||||
<UnlabeledToggleSwitch fx:id="validateDerivationPaths" />
|
<UnlabeledToggleSwitch fx:id="validateDerivationPaths" />
|
||||||
<HelpLabel helpText="Disallow keystores to have derivation paths that match the defaults for other script types."/>
|
<HelpLabel helpText="Disallow keystores to have derivation paths that match the defaults for other script types."/>
|
||||||
|
|
Loading…
Reference in a new issue