1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-01-04 04:44:16 +01:00

WPrefs: Fixed handling of options which default to true

Two problems caused Boolean options which default to true to be shown
incorrectly when the option was not already present in the defaults database.
First a typo (Enabled instead of Selected) caused the switch button to stay
off then because GetBoolForKey key returns False also when the option
is not set it would have been turned off while it should stay on to
reflect the default value of the option.
This commit is contained in:
BALATON Zoltan
2012-11-16 22:07:47 +01:00
committed by Carlos R. Mafra
parent c7e3666e62
commit faa74a14b1
2 changed files with 13 additions and 9 deletions

View File

@@ -53,10 +53,13 @@ static void showData(_Panel * panel)
WMSetButtonSelected(panel->swi[3], GetBoolForKey("UseSaveUnders"));
WMSetButtonSelected(panel->swi[4], GetBoolForKey("DontConfirmKill"));
WMSetButtonSelected(panel->swi[5], GetBoolForKey("DisableBlinking"));
WMSetButtonSelected(panel->swi[6], GetBoolForKey("AntialiasedText"));
if (GetStringForKey("AntialiasedText"))
WMSetButtonSelected(panel->swi[6], GetBoolForKey("AntialiasedText"));
WMSetButtonSelected(panel->swi[7], GetBoolForKey("CycleActiveHeadOnly"));
WMSetButtonSelected(panel->swi[8], GetBoolForKey("ShowClipTitle"));
WMSetButtonSelected(panel->swi[9], GetBoolForKey("HighlightActiveApp"));
if (GetStringForKey("ShowClipTitle"))
WMSetButtonSelected(panel->swi[8], GetBoolForKey("ShowClipTitle"));
if (GetStringForKey("HighlightActiveApp"))
WMSetButtonSelected(panel->swi[9], GetBoolForKey("HighlightActiveApp"));
#ifdef XKB_MODELOCK
WMSetButtonSelected(panel->swi[10], GetBoolForKey("KbdModeLock"));
#endif /* XKB_MODELOCK */
@@ -104,10 +107,10 @@ static void createPanel(Panel * p)
WMSetButtonText(panel->swi[10], _("Enable keyboard language switch button in window titlebars."));
#endif /* XKB_MODELOCK */
/* If the item is default true, enable the button here */
WMSetButtonEnabled(panel->swi[6], True);
WMSetButtonEnabled(panel->swi[8], True);
WMSetButtonEnabled(panel->swi[9], True);
/* If the item is default true, switch it on here */
WMSetButtonSelected(panel->swi[6], True);
WMSetButtonSelected(panel->swi[8], True);
WMSetButtonSelected(panel->swi[9], True);
WMMapSubwidgets(panel->box);
WMSetScrollViewContentView(sv, WMWidgetView(f));

View File

@@ -127,7 +127,8 @@ static void showData(_Panel * panel)
}
WMSetButtonSelected(panel->bounceB, GetBoolForKey("DoNotMakeAppIconsBounce"));
WMSetButtonSelected(panel->bounceUrgB, GetBoolForKey("BounceAppIconsWhenUrgent"));
if (GetStringForKey("BounceAppIconsWhenUrgent"))
WMSetButtonSelected(panel->bounceUrgB, GetBoolForKey("BounceAppIconsWhenUrgent"));
WMSetButtonSelected(panel->bounceRaisB, GetBoolForKey("RaiseAppIconsWhenBouncing"));
WMSetButtonSelected(panel->ballB[0], GetBoolForKey("WindowTitleBalloons"));
@@ -278,7 +279,7 @@ static void createPanel(Panel * p)
WMResizeWidget(panel->bounceUrgB, 210, 30);
WMMoveWidget(panel->bounceUrgB, 15, 39);
WMSetButtonText(panel->bounceUrgB, _("Bounce AppIcon when the application wants attention."));
WMSetButtonEnabled(panel->bounceUrgB, True); /* defaults to true */
WMSetButtonSelected(panel->bounceUrgB, True); /* defaults to true */
panel->bounceRaisB = WMCreateSwitchButton(panel->optF);
WMResizeWidget(panel->bounceRaisB, 210, 25);