mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +01:00
WPrefs: grouped items related to the AppIcon bouncing configuration in a single place
Having all these information spread in different places makes it error prone when wanting to add/remove/change something in the list are there are many unrelated places to keep in sync. Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
committed by
Carlos R. Mafra
parent
e73c3e84de
commit
d02d362295
@@ -33,6 +33,16 @@ static const struct {
|
|||||||
{ "HelpBalloons", N_("internal help"), }
|
{ "HelpBalloons", N_("internal help"), }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const struct {
|
||||||
|
const char *db_key;
|
||||||
|
int default_value;
|
||||||
|
const char *label;
|
||||||
|
} appicon_bouncing[] = {
|
||||||
|
{ "DoNotMakeAppIconsBounce", False, N_("Disable AppIcon bounce.") },
|
||||||
|
{ "BounceAppIconsWhenUrgent", True, N_("Bounce AppIcon when the application wants attention.") },
|
||||||
|
{ "RaiseAppIconsWhenBouncing", False, N_("Raise AppIcons when bouncing.") }
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct _Panel {
|
typedef struct _Panel {
|
||||||
WMBox *box;
|
WMBox *box;
|
||||||
|
|
||||||
@@ -54,9 +64,7 @@ typedef struct _Panel {
|
|||||||
WMButton *ballB[wlengthof_nocheck(balloon_choices)];
|
WMButton *ballB[wlengthof_nocheck(balloon_choices)];
|
||||||
|
|
||||||
WMFrame *optF;
|
WMFrame *optF;
|
||||||
WMButton *bounceB;
|
WMButton *bounceB[wlengthof_nocheck(appicon_bouncing)];
|
||||||
WMButton *bounceUrgB;
|
|
||||||
WMButton *bounceRaisB;
|
|
||||||
|
|
||||||
WMFrame *borderF;
|
WMFrame *borderF;
|
||||||
WMSlider *borderS;
|
WMSlider *borderS;
|
||||||
@@ -141,10 +149,10 @@ static void showData(_Panel * panel)
|
|||||||
WMSetButtonSelected(panel->lrB, True);
|
WMSetButtonSelected(panel->lrB, True);
|
||||||
}
|
}
|
||||||
|
|
||||||
WMSetButtonSelected(panel->bounceB, GetBoolForKey("DoNotMakeAppIconsBounce"));
|
for (x = 0; x < wlengthof(appicon_bouncing); x++) {
|
||||||
if (GetStringForKey("BounceAppIconsWhenUrgent"))
|
if (GetStringForKey(appicon_bouncing[x].db_key))
|
||||||
WMSetButtonSelected(panel->bounceUrgB, GetBoolForKey("BounceAppIconsWhenUrgent"));
|
WMSetButtonSelected(panel->bounceB[x], GetBoolForKey(appicon_bouncing[x].db_key));
|
||||||
WMSetButtonSelected(panel->bounceRaisB, GetBoolForKey("RaiseAppIconsWhenBouncing"));
|
}
|
||||||
|
|
||||||
for (x = 0; x < wlengthof(balloon_choices); x++)
|
for (x = 0; x < wlengthof(balloon_choices); x++)
|
||||||
WMSetButtonSelected(panel->ballB[x], GetBoolForKey(balloon_choices[x].db_key));
|
WMSetButtonSelected(panel->ballB[x], GetBoolForKey(balloon_choices[x].db_key));
|
||||||
@@ -204,9 +212,8 @@ static void storeData(_Panel * panel)
|
|||||||
SetStringForKey(str, "WorkspaceBorder");
|
SetStringForKey(str, "WorkspaceBorder");
|
||||||
SetIntegerForKey(WMGetSliderValue(panel->borderS), "WorkspaceBorderSize");
|
SetIntegerForKey(WMGetSliderValue(panel->borderS), "WorkspaceBorderSize");
|
||||||
|
|
||||||
SetBoolForKey(WMGetButtonSelected(panel->bounceB), "DoNotMakeAppIconsBounce");
|
for (i = 0; i < wlengthof(appicon_bouncing); i++)
|
||||||
SetBoolForKey(WMGetButtonSelected(panel->bounceUrgB), "BounceAppIconsWhenUrgent");
|
SetBoolForKey(WMGetButtonSelected(panel->bounceB[i]), appicon_bouncing[i].db_key);
|
||||||
SetBoolForKey(WMGetButtonSelected(panel->bounceRaisB), "RaiseAppIconsWhenBouncing");
|
|
||||||
|
|
||||||
for (i = 0; i < wlengthof(balloon_choices); i++)
|
for (i = 0; i < wlengthof(balloon_choices); i++)
|
||||||
SetBoolForKey(WMGetButtonSelected(panel->ballB[i]), balloon_choices[i].db_key);
|
SetBoolForKey(WMGetButtonSelected(panel->ballB[i]), balloon_choices[i].db_key);
|
||||||
@@ -280,21 +287,15 @@ static void createPanel(Panel * p)
|
|||||||
WMMoveWidget(panel->optF, 265, 136);
|
WMMoveWidget(panel->optF, 265, 136);
|
||||||
WMSetFrameTitle(panel->optF, _("AppIcon bouncing"));
|
WMSetFrameTitle(panel->optF, _("AppIcon bouncing"));
|
||||||
|
|
||||||
panel->bounceB = WMCreateSwitchButton(panel->optF);
|
for (i = 0; i < wlengthof(appicon_bouncing); i++) {
|
||||||
WMResizeWidget(panel->bounceB, 210, 25);
|
panel->bounceB[i] = WMCreateSwitchButton(panel->optF);
|
||||||
WMMoveWidget(panel->bounceB, 15, 14);
|
WMResizeWidget(panel->bounceB[i], 210, 26);
|
||||||
WMSetButtonText(panel->bounceB, _("Disable AppIcon bounce."));
|
WMMoveWidget(panel->bounceB[i], 15, 12 + i * 25);
|
||||||
|
WMSetButtonText(panel->bounceB[i], _(appicon_bouncing[i].label));
|
||||||
|
|
||||||
panel->bounceUrgB = WMCreateSwitchButton(panel->optF);
|
if (appicon_bouncing[i].default_value)
|
||||||
WMResizeWidget(panel->bounceUrgB, 210, 28);
|
WMSetButtonSelected(panel->bounceB[i], True);
|
||||||
WMMoveWidget(panel->bounceUrgB, 15, 37);
|
}
|
||||||
WMSetButtonText(panel->bounceUrgB, _("Bounce AppIcon when the application wants attention."));
|
|
||||||
WMSetButtonSelected(panel->bounceUrgB, True); /* defaults to true */
|
|
||||||
|
|
||||||
panel->bounceRaisB = WMCreateSwitchButton(panel->optF);
|
|
||||||
WMResizeWidget(panel->bounceRaisB, 210, 23);
|
|
||||||
WMMoveWidget(panel->bounceRaisB, 15, 65);
|
|
||||||
WMSetButtonText(panel->bounceRaisB, _("Raise AppIcons when bouncing."));
|
|
||||||
|
|
||||||
WMMapSubwidgets(panel->optF);
|
WMMapSubwidgets(panel->optF);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user