Skip to content

Commit

Permalink
Hide avoid standby mode feature on *nux OS (#3563)
Browse files Browse the repository at this point in the history
* Hide avoid standby mode feature on *nux OS

Displays standby mode button on only on Windows and OSX,
and hides it on Linux and Unix distributions.

TitledGroupBg num rows reduced to 7 when standby mode button
is not displayed.

Fixes #3223

Replaces PR #3322 -- rejected because source file reformat
rearanged class level field declarations, making review
more difficult.

* Set use standby mode to false on non Win, OSX desktops
  • Loading branch information
ripcurlx committed Dec 6, 2019
2 parents 87fb9c0 + dd8fd30 commit 19da79b
Showing 1 changed file with 19 additions and 8 deletions.
Expand Up @@ -54,6 +54,7 @@
import bisq.common.UserThread;
import bisq.common.app.DevEnv;
import bisq.common.util.Tuple3;
import bisq.common.util.Utilities;

import org.bitcoinj.core.Coin;

Expand Down Expand Up @@ -145,7 +146,7 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
private ChangeListener<Boolean> useCustomFeeCheckboxListener;
private ChangeListener<Number> transactionFeeChangeListener;
private final boolean daoOptionsSet;

private final boolean displayStandbyModeFeature;

///////////////////////////////////////////////////////////////////////////////////////////
// Constructor, initialisation
Expand Down Expand Up @@ -174,6 +175,7 @@ public PreferencesView(PreferencesViewModel model,
rpcUser != null && !rpcUser.isEmpty() &&
rpcPassword != null && !rpcPassword.isEmpty() &&
rpcBlockNotificationPort != null && !rpcBlockNotificationPort.isEmpty();
this.displayStandbyModeFeature = Utilities.isOSX() || Utilities.isWindows();
}

@Override
Expand Down Expand Up @@ -225,7 +227,8 @@ protected void deactivate() {
///////////////////////////////////////////////////////////////////////////////////////////

private void initializeGeneralOptions() {
TitledGroupBg titledGroupBg = addTitledGroupBg(root, gridRow, 8, Res.get("setting.preferences.general"));
int titledGroupBgRowSpan = displayStandbyModeFeature ? 8 : 7;
TitledGroupBg titledGroupBg = addTitledGroupBg(root, gridRow, titledGroupBgRowSpan, Res.get("setting.preferences.general"));
GridPane.setColumnSpan(titledGroupBg, 1);

userLanguageComboBox = addComboBox(root, gridRow,
Expand Down Expand Up @@ -347,9 +350,11 @@ private void initializeGeneralOptions() {
}
};

// AvoidStandbyModeService
avoidStandbyMode = addSlideToggleButton(root, ++gridRow,
Res.get("setting.preferences.avoidStandbyMode"));
if (displayStandbyModeFeature) {
// AvoidStandbyModeService feature works only on OSX & Windows
avoidStandbyMode = addSlideToggleButton(root, ++gridRow,
Res.get("setting.preferences.avoidStandbyMode"));
}
}

private void initializeSeparator() {
Expand Down Expand Up @@ -807,8 +812,12 @@ private void activateDisplayPreferences() {

// We use opposite property (useStandbyMode) in preferences to have the default value (false) set as we want it,
// so users who update gets set avoidStandbyMode=true (useStandbyMode=false)
avoidStandbyMode.setSelected(!preferences.isUseStandbyMode());
avoidStandbyMode.setOnAction(e -> preferences.setUseStandbyMode(!avoidStandbyMode.isSelected()));
if (displayStandbyModeFeature) {
avoidStandbyMode.setSelected(!preferences.isUseStandbyMode());
avoidStandbyMode.setOnAction(e -> preferences.setUseStandbyMode(!avoidStandbyMode.isSelected()));
} else {
preferences.setUseStandbyMode(false);
}
}

private void activateDaoPreferences() {
Expand Down Expand Up @@ -930,7 +939,9 @@ private void deactivateDisplayPreferences() {
sortMarketCurrenciesNumerically.setOnAction(null);
showOwnOffersInOfferBook.setOnAction(null);
resetDontShowAgainButton.setOnAction(null);
avoidStandbyMode.setOnAction(null);
if (displayStandbyModeFeature) {
avoidStandbyMode.setOnAction(null);
}
}

private void deactivateDaoPreferences() {
Expand Down

0 comments on commit 19da79b

Please sign in to comment.