Initial revision
[wmaker-crm.git] / WPrefs.app / Expert.c
blob9ad23c8c59e3d2829cf00b87fe449f15b7c40deb
1 /* Expert.c- expert user options
2 *
3 * WPrefs - WindowMaker Preferences Program
4 *
5 * Copyright (c) 1998 Alfredo K. Kojima
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20 * USA.
24 #include "WPrefs.h"
26 typedef struct _Panel {
27 WMFrame *frame;
28 char *sectionName;
30 CallbackRec callbacks;
32 WMWindow *win;
34 WMButton *swi[4];
36 } _Panel;
40 #define ICON_FILE "expert"
43 static void
44 showData(_Panel *panel)
46 WMUserDefaults *udb = WMGetStandardUserDefaults();
48 WMSetButtonSelected(panel->swi[0], WMGetUDBoolForKey(udb, "NoXSetStuff"));
49 WMSetButtonSelected(panel->swi[1], GetBoolForKey("SaveSessionOnExit"));
50 WMSetButtonSelected(panel->swi[2], GetBoolForKey("UseSaveUnders"));
51 WMSetButtonSelected(panel->swi[3], GetBoolForKey("DisableBlinking"));
55 static void
56 createPanel(Panel *p)
58 _Panel *panel = (_Panel*)p;
59 int i;
61 panel->frame = WMCreateFrame(panel->win);
62 WMResizeWidget(panel->frame, FRAME_WIDTH, FRAME_HEIGHT);
63 WMMoveWidget(panel->frame, FRAME_LEFT, FRAME_TOP);
65 for (i=0; i<4; i++) {
66 panel->swi[i] = WMCreateSwitchButton(panel->frame);
67 WMResizeWidget(panel->swi[i], FRAME_WIDTH-40, 25);
68 WMMoveWidget(panel->swi[i], 20, 20+i*25);
70 WMSetButtonText(panel->swi[0], _("Do not set non-WindowMaker specific parameters (do not use xset)"));
71 WMSetButtonText(panel->swi[1], _("Automatically save session when exiting WindowMaker"));
72 WMSetButtonText(panel->swi[2], _("Use SaveUnder in window frames, icons, menus and other objects"));
73 WMSetButtonText(panel->swi[3], _("Disable cycling color highlighting of icons."));
75 WMRealizeWidget(panel->frame);
76 WMMapSubwidgets(panel->frame);
78 showData(panel);
82 static void
83 storeDefaults(_Panel *panel)
85 WMUserDefaults *udb = WMGetStandardUserDefaults();
87 WMSetUDBoolForKey(udb, WMGetButtonSelected(panel->swi[0]), "NoXSetStuff");
89 SetBoolForKey(WMGetButtonSelected(panel->swi[1]), "SaveSessionOnExit");
90 SetBoolForKey(WMGetButtonSelected(panel->swi[2]), "UseSaveUnders");
91 SetBoolForKey(WMGetButtonSelected(panel->swi[3]), "DisableBlinking");
95 Panel*
96 InitExpert(WMScreen *scr, WMWindow *win)
98 _Panel *panel;
100 panel = wmalloc(sizeof(_Panel));
101 memset(panel, 0, sizeof(_Panel));
103 panel->sectionName = _("Expert User Preferences");
105 panel->win = win;
107 panel->callbacks.createWidgets = createPanel;
108 panel->callbacks.updateDomain = storeDefaults;
110 AddSection(panel, ICON_FILE);
112 return panel;