mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +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"
|
"center"
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *const dragMaximizedWindowOptions[] = {
|
static const struct {
|
||||||
"Move",
|
const char *db_value;
|
||||||
"RestoreGeometry",
|
const char *label;
|
||||||
"Unmaximize",
|
} drag_maximized_window_options[] = {
|
||||||
"NoMove"
|
{ "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)
|
static void sliderCallback(WMWidget * w, void *data)
|
||||||
@@ -177,18 +180,16 @@ static int getPlacement(const char *str)
|
|||||||
|
|
||||||
static int getDragMaximizedWindow(const char *str)
|
static int getDragMaximizedWindow(const char *str)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
if (!str)
|
if (!str)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (strcasecmp(str, "Move") == 0)
|
for (i = 0; i < wlengthof(drag_maximized_window_options); i++) {
|
||||||
return 0;
|
if (strcasecmp(str, drag_maximized_window_options[i].db_value) == 0)
|
||||||
else if (strcasecmp(str, "RestoreGeometry") == 0)
|
return i;
|
||||||
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);
|
wwarning(_("bad option value %s in WindowPlacement. Using default value"), str);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -271,7 +272,7 @@ static void storeData(_Panel * panel)
|
|||||||
|
|
||||||
SetIntegerForKey(WMGetSliderValue(panel->resS), "EdgeResistance");
|
SetIntegerForKey(WMGetSliderValue(panel->resS), "EdgeResistance");
|
||||||
|
|
||||||
SetStringForKey(dragMaximizedWindowOptions[WMGetPopUpButtonSelectedItem(panel->dragmaxP)],
|
SetStringForKey(drag_maximized_window_options[WMGetPopUpButtonSelectedItem(panel->dragmaxP)].db_value,
|
||||||
"DragMaximizedWindow");
|
"DragMaximizedWindow");
|
||||||
|
|
||||||
SetIntegerForKey(WMGetSliderValue(panel->resizeS), "ResizeIncrement");
|
SetIntegerForKey(WMGetSliderValue(panel->resizeS), "ResizeIncrement");
|
||||||
@@ -290,6 +291,7 @@ static void createPanel(Panel * p)
|
|||||||
int swidth, sheight;
|
int swidth, sheight;
|
||||||
char *path;
|
char *path;
|
||||||
WMBox *hbox;
|
WMBox *hbox;
|
||||||
|
int i;
|
||||||
|
|
||||||
panel->box = WMCreateBox(panel->parent);
|
panel->box = WMCreateBox(panel->parent);
|
||||||
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
|
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
|
||||||
@@ -533,10 +535,9 @@ static void createPanel(Panel * p)
|
|||||||
panel->dragmaxP = WMCreatePopUpButton(panel->dragmaxF);
|
panel->dragmaxP = WMCreatePopUpButton(panel->dragmaxF);
|
||||||
WMResizeWidget(panel->dragmaxP, 269, 20);
|
WMResizeWidget(panel->dragmaxP, 269, 20);
|
||||||
WMMoveWidget(panel->dragmaxP, 10, 20);
|
WMMoveWidget(panel->dragmaxP, 10, 20);
|
||||||
WMAddPopUpButtonItem(panel->dragmaxP, _("...change position (normal behavior)"));
|
|
||||||
WMAddPopUpButtonItem(panel->dragmaxP, _("...restore unmaximized geometry"));
|
for (i = 0; i < wlengthof(drag_maximized_window_options); i++)
|
||||||
WMAddPopUpButtonItem(panel->dragmaxP, _("...consider the window unmaximized"));
|
WMAddPopUpButtonItem(panel->dragmaxP, _(drag_maximized_window_options[i].label));
|
||||||
WMAddPopUpButtonItem(panel->dragmaxP, _("...do not move the window"));
|
|
||||||
|
|
||||||
WMMapSubwidgets(panel->dragmaxF);
|
WMMapSubwidgets(panel->dragmaxF);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user