1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 12:28:22 +01:00

WPrefs: add expert option to disable switch panel

This patch is adding a checkbox option in the expert panel
to let the user enable/disable switching panel.
This commit is contained in:
David Maciejak
2014-06-05 11:23:51 +07:00
committed by Carlos R. Mafra
parent b323800c02
commit f33c89e369

View File

@@ -2,6 +2,7 @@
* *
* WPrefs - Window Maker Preferences Program * WPrefs - Window Maker Preferences Program
* *
* Copyright (c) 2014 Window Maker Team
* Copyright (c) 1998-2003 Alfredo K. Kojima * Copyright (c) 1998-2003 Alfredo K. Kojima
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -31,6 +32,7 @@ static const struct {
enum { enum {
OPTION_WMAKER, OPTION_WMAKER,
OPTION_WMAKER_ARRAY,
OPTION_USERDEF OPTION_USERDEF
} class; } class;
@@ -65,6 +67,9 @@ static const struct {
{ N_("Ignore minimized windows when cycling."), { N_("Ignore minimized windows when cycling."),
/* default: */ False, OPTION_WMAKER, "CycleIgnoreMinimized" }, /* default: */ False, OPTION_WMAKER, "CycleIgnoreMinimized" },
{ N_("Show switch panel when cycling windows."),
/* default: */ True, OPTION_WMAKER_ARRAY, "SwitchPanelImages" },
{ N_("Show workspace title on Clip."), { N_("Show workspace title on Clip."),
/* default: */ True, OPTION_WMAKER, "ShowClipTitle" }, /* default: */ True, OPTION_WMAKER, "ShowClipTitle" },
@@ -96,7 +101,7 @@ typedef struct _Panel {
#define ICON_FILE "expert" #define ICON_FILE "expert"
static void createPanel(Panel * p) static void createPanel(Panel *p)
{ {
_Panel *panel = (_Panel *) p; _Panel *panel = (_Panel *) p;
WMScrollView *sv; WMScrollView *sv;
@@ -134,6 +139,14 @@ static void createPanel(Panel * p)
state = expert_options[i].def_state; state = expert_options[i].def_state;
break; break;
case OPTION_WMAKER_ARRAY: {
char *str = GetStringForKey(expert_options[i].op_name);
state = expert_options[i].def_state;
if (str && strcasecmp(str, "None") == 0)
state = False;
}
break;
case OPTION_USERDEF: case OPTION_USERDEF:
state = WMGetUDBoolForKey(udb, expert_options[i].op_name); state = WMGetUDBoolForKey(udb, expert_options[i].op_name);
break; break;
@@ -141,7 +154,7 @@ static void createPanel(Panel * p)
default: default:
#ifdef DEBUG #ifdef DEBUG
wwarning("export_options[%d].class = %d, this should not happen\n", wwarning("export_options[%d].class = %d, this should not happen\n",
i, expert_options[i].class); i, expert_options[i].class);
#endif #endif
state = expert_options[i].def_state; state = expert_options[i].def_state;
break; break;
@@ -154,7 +167,7 @@ static void createPanel(Panel * p)
WMRealizeWidget(panel->box); WMRealizeWidget(panel->box);
} }
static void storeDefaults(_Panel * panel) static void storeDefaults(_Panel *panel)
{ {
WMUserDefaults *udb = WMGetStandardUserDefaults(); WMUserDefaults *udb = WMGetStandardUserDefaults();
int i; int i;
@@ -165,6 +178,17 @@ static void storeDefaults(_Panel * panel)
SetBoolForKey(WMGetButtonSelected(panel->swi[i]), expert_options[i].op_name); SetBoolForKey(WMGetButtonSelected(panel->swi[i]), expert_options[i].op_name);
break; break;
case OPTION_WMAKER_ARRAY:
if (WMGetButtonSelected(panel->swi[i])) {
/* check if the array was not manually modified */
char *str = GetStringForKey(expert_options[i].op_name);
if (str && strcasecmp(str, "None") == 0)
RemoveObjectForKey(expert_options[i].op_name);
}
else
SetStringForKey("None", expert_options[i].op_name);
break;
case OPTION_USERDEF: case OPTION_USERDEF:
WMSetUDBoolForKey(udb, WMGetButtonSelected(panel->swi[i]), expert_options[i].op_name); WMSetUDBoolForKey(udb, WMGetButtonSelected(panel->swi[i]), expert_options[i].op_name);
break; break;