fixed bug with menu editor in wprefs
[wmaker-crm.git] / WPrefs.app / Expert.c
blobd6e1c2dfeeb15b209f86c0ae0516dfde613e3343
1 /* Expert.c- expert user options
2 *
3 * WPrefs - Window Maker 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 char *description;
32 CallbackRec callbacks;
34 WMWindow *win;
36 WMButton *swi[5];
38 } _Panel;
42 #define ICON_FILE "expert"
45 static void
46 showData(_Panel *panel)
48 WMUserDefaults *udb = WMGetStandardUserDefaults();
50 WMSetButtonSelected(panel->swi[0], GetBoolForKey("DisableMiniwindows"));
51 WMSetButtonSelected(panel->swi[1], WMGetUDBoolForKey(udb, "NoXSetStuff"));
52 WMSetButtonSelected(panel->swi[2], GetBoolForKey("SaveSessionOnExit"));
53 WMSetButtonSelected(panel->swi[3], GetBoolForKey("UseSaveUnders"));
54 WMSetButtonSelected(panel->swi[4], GetBoolForKey("DisableBlinking"));
58 static void
59 createPanel(Panel *p)
61 _Panel *panel = (_Panel*)p;
62 int i;
64 panel->frame = WMCreateFrame(panel->win);
65 WMResizeWidget(panel->frame, FRAME_WIDTH, FRAME_HEIGHT);
66 WMMoveWidget(panel->frame, FRAME_LEFT, FRAME_TOP);
68 for (i=0; i<5; i++) {
69 panel->swi[i] = WMCreateSwitchButton(panel->frame);
70 WMResizeWidget(panel->swi[i], FRAME_WIDTH-40, 25);
71 WMMoveWidget(panel->swi[i], 20, 20+i*25);
74 WMSetButtonText(panel->swi[0], _("Disable miniwindows (icons for miniaturized windows). For use with KDE/GNOME."));
75 WMSetButtonText(panel->swi[1], _("Do not set non-WindowMaker specific parameters (do not use xset)"));
76 WMSetButtonText(panel->swi[2], _("Automatically save session when exiting WindowMaker"));
77 WMSetButtonText(panel->swi[3], _("Use SaveUnder in window frames, icons, menus and other objects"));
78 WMSetButtonText(panel->swi[4], _("Disable cycling color highlighting of icons."));
80 WMRealizeWidget(panel->frame);
81 WMMapSubwidgets(panel->frame);
83 showData(panel);
87 static void
88 storeDefaults(_Panel *panel)
90 WMUserDefaults *udb = WMGetStandardUserDefaults();
92 SetBoolForKey(WMGetButtonSelected(panel->swi[0]), "DisableMiniwindows");
94 WMSetUDBoolForKey(udb, WMGetButtonSelected(panel->swi[1]), "NoXSetStuff");
96 SetBoolForKey(WMGetButtonSelected(panel->swi[2]), "SaveSessionOnExit");
97 SetBoolForKey(WMGetButtonSelected(panel->swi[3]), "UseSaveUnders");
98 SetBoolForKey(WMGetButtonSelected(panel->swi[4]), "DisableBlinking");
102 Panel*
103 InitExpert(WMScreen *scr, WMWindow *win)
105 _Panel *panel;
107 panel = wmalloc(sizeof(_Panel));
108 memset(panel, 0, sizeof(_Panel));
110 panel->sectionName = _("Expert User Preferences");
112 panel->description = _("Options for people who know what they're doing...\n"
113 "Also have some other misc. options.");
115 panel->win = win;
117 panel->callbacks.createWidgets = createPanel;
118 panel->callbacks.updateDomain = storeDefaults;
120 AddSection(panel, ICON_FILE);
122 return panel;