show warning in preferences if currencies could not be retrieved from exchange rate source

This commit is contained in:
Craig Raw
2023-07-17 11:17:16 +02:00
parent 4c408ac7b1
commit 31bd64f821
3 changed files with 19 additions and 0 deletions
@@ -18,6 +18,7 @@ import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.util.StringConverter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -45,6 +46,9 @@ public class GeneralPreferencesController extends PreferencesDetailController {
@FXML
private ComboBox<ExchangeSource> exchangeSource;
@FXML
private Label currenciesLoadWarning;
@FXML
private UnlabeledToggleSwitch loadRecentWallets;
@@ -87,6 +91,9 @@ public class GeneralPreferencesController extends PreferencesDetailController {
EventManager.get().post(new FeeRatesSourceChangedEvent(newValue));
});
currenciesLoadWarning.managedProperty().bind(currenciesLoadWarning.visibleProperty());
currenciesLoadWarning.setVisible(false);
blockExplorers.setItems(getBlockExplorerList());
blockExplorers.setConverter(new StringConverter<>() {
@Override
@@ -237,6 +244,8 @@ public class GeneralPreferencesController extends PreferencesDetailController {
fiatCurrency.setDisable(true);
}
currenciesLoadWarning.setVisible(exchangeSource.getValue() != ExchangeSource.NONE && currencies.isEmpty());
//Always fire event regardless of previous selection to update rates
EventManager.get().post(new FiatCurrencySelectedEvent(exchangeSource.getValue(), fiatCurrency.getValue()));