From: BALATON Zoltan Date: Fri, 16 Nov 2012 21:07:47 +0000 (+0100) Subject: WPrefs: Fixed handling of options which default to true X-Git-Tag: wmaker-0.95.4~26 X-Git-Url: https://repo.or.cz/w/wmaker-crm.git/commitdiff_plain/faa74a14b1f01a343bf3f183e2515dcff2ecc006 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. --- diff --git a/WPrefs.app/Expert.c b/WPrefs.app/Expert.c index 177bbd88..ee8d6251 100644 --- a/WPrefs.app/Expert.c +++ b/WPrefs.app/Expert.c @@ -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)); diff --git a/WPrefs.app/Preferences.c b/WPrefs.app/Preferences.c index 8c0ef2cf..93990231 100644 --- a/WPrefs.app/Preferences.c +++ b/WPrefs.app/Preferences.c @@ -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);