mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 04:20:27 +01:00
WPrefs: grouped items related to the behaviour of moving a maximized window 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. Took the opportunity to de-CamelCase the name of the variable to comply with project's coding rules. Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
committed by
Carlos R. Mafra
parent
d02d362295
commit
8522283d68
@@ -86,11 +86,14 @@ static const char *const placements[] = {
|
||||
"center"
|
||||
};
|
||||
|
||||
static const char *const dragMaximizedWindowOptions[] = {
|
||||
"Move",
|
||||
"RestoreGeometry",
|
||||
"Unmaximize",
|
||||
"NoMove"
|
||||
static const struct {
|
||||
const char *db_value;
|
||||
const char *label;
|
||||
} drag_maximized_window_options[] = {
|
||||
{ "Move", N_("...change position (normal behavior)") },
|
||||
{ "RestoreGeometry", N_("...restore unmaximized geometry") },
|
||||
{ "Unmaximize", N_("...consider the window unmaximized") },
|
||||
{ "NoMove", N_("...do not move the window") }
|
||||
};
|
||||
|
||||
static void sliderCallback(WMWidget * w, void *data)
|
||||
@@ -177,19 +180,17 @@ static int getPlacement(const char *str)
|
||||
|
||||
static int getDragMaximizedWindow(const char *str)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!str)
|
||||
return 0;
|
||||
|
||||
if (strcasecmp(str, "Move") == 0)
|
||||
return 0;
|
||||
else if (strcasecmp(str, "RestoreGeometry") == 0)
|
||||
return 1;
|
||||
else if (strcasecmp(str, "Unmaximize") == 0)
|
||||
return 2;
|
||||
else if (strcasecmp(str, "NoMove") == 0)
|
||||
return 3;
|
||||
else
|
||||
wwarning(_("bad option value %s in WindowPlacement. Using default value"), str);
|
||||
for (i = 0; i < wlengthof(drag_maximized_window_options); i++) {
|
||||
if (strcasecmp(str, drag_maximized_window_options[i].db_value) == 0)
|
||||
return i;
|
||||
}
|
||||
|
||||
wwarning(_("bad option value %s in WindowPlacement. Using default value"), str);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -271,8 +272,8 @@ static void storeData(_Panel * panel)
|
||||
|
||||
SetIntegerForKey(WMGetSliderValue(panel->resS), "EdgeResistance");
|
||||
|
||||
SetStringForKey(dragMaximizedWindowOptions[WMGetPopUpButtonSelectedItem(panel->dragmaxP)],
|
||||
"DragMaximizedWindow");
|
||||
SetStringForKey(drag_maximized_window_options[WMGetPopUpButtonSelectedItem(panel->dragmaxP)].db_value,
|
||||
"DragMaximizedWindow");
|
||||
|
||||
SetIntegerForKey(WMGetSliderValue(panel->resizeS), "ResizeIncrement");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->resrB), "Attraction");
|
||||
@@ -290,6 +291,7 @@ static void createPanel(Panel * p)
|
||||
int swidth, sheight;
|
||||
char *path;
|
||||
WMBox *hbox;
|
||||
int i;
|
||||
|
||||
panel->box = WMCreateBox(panel->parent);
|
||||
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
|
||||
@@ -533,10 +535,9 @@ static void createPanel(Panel * p)
|
||||
panel->dragmaxP = WMCreatePopUpButton(panel->dragmaxF);
|
||||
WMResizeWidget(panel->dragmaxP, 269, 20);
|
||||
WMMoveWidget(panel->dragmaxP, 10, 20);
|
||||
WMAddPopUpButtonItem(panel->dragmaxP, _("...change position (normal behavior)"));
|
||||
WMAddPopUpButtonItem(panel->dragmaxP, _("...restore unmaximized geometry"));
|
||||
WMAddPopUpButtonItem(panel->dragmaxP, _("...consider the window unmaximized"));
|
||||
WMAddPopUpButtonItem(panel->dragmaxP, _("...do not move the window"));
|
||||
|
||||
for (i = 0; i < wlengthof(drag_maximized_window_options); i++)
|
||||
WMAddPopUpButtonItem(panel->dragmaxP, _(drag_maximized_window_options[i].label));
|
||||
|
||||
WMMapSubwidgets(panel->dragmaxF);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user