Change to the linux kernel coding style
[wmaker-crm.git] / WPrefs.app / Expert.c
1 /* Expert.c- expert user options
2 *
3 * WPrefs - Window Maker Preferences Program
4 *
5 * Copyright (c) 1998-2003 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.
11 *
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.
16 *
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.
21 */
22
23 #include "WPrefs.h"
24
25 typedef struct _Panel {
26 WMBox *box;
27 char *sectionName;
28
29 char *description;
30
31 CallbackRec callbacks;
32
33 WMWidget *parent;
34
35 WMButton *swi[8];
36
37 } _Panel;
38
39 #define ICON_FILE "expert"
40
41 static void showData(_Panel * panel)
42 {
43 WMUserDefaults *udb = WMGetStandardUserDefaults();
44
45 WMSetButtonSelected(panel->swi[0], GetBoolForKey("DisableMiniwindows"));
46 WMSetButtonSelected(panel->swi[1], WMGetUDBoolForKey(udb, "NoXSetStuff"));
47 WMSetButtonSelected(panel->swi[2], GetBoolForKey("SaveSessionOnExit"));
48 WMSetButtonSelected(panel->swi[3], GetBoolForKey("UseSaveUnders"));
49 WMSetButtonSelected(panel->swi[4], GetBoolForKey("DontConfirmKill"));
50 WMSetButtonSelected(panel->swi[5], GetBoolForKey("DisableBlinking"));
51 WMSetButtonSelected(panel->swi[6], GetBoolForKey("AntialiasedText"));
52 }
53
54 static void createPanel(Panel * p)
55 {
56 _Panel *panel = (_Panel *) p;
57 int i;
58
59 panel->box = WMCreateBox(panel->parent);
60 WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
61
62 for (i = 0; i < 7; i++) {
63 panel->swi[i] = WMCreateSwitchButton(panel->box);
64 WMResizeWidget(panel->swi[i], FRAME_WIDTH - 40, 25);
65 WMMoveWidget(panel->swi[i], 20, 20 + i * 25);
66 }
67
68 WMSetButtonText(panel->swi[0],
69 _("Disable miniwindows (icons for minimized windows). For use with KDE/GNOME."));
70 WMSetButtonText(panel->swi[1], _("Do not set non-WindowMaker specific parameters (do not use xset)."));
71 WMSetButtonText(panel->swi[2], _("Automatically save session when exiting Window Maker."));
72 WMSetButtonText(panel->swi[3], _("Use SaveUnder in window frames, icons, menus and other objects."));
73 WMSetButtonText(panel->swi[4], _("Disable confirmation panel for the Kill command."));
74 WMSetButtonText(panel->swi[5], _("Disable selection animation for selected icons."));
75 WMSetButtonText(panel->swi[6], _("Smooth font edges (needs restart)."));
76
77 WMSetButtonEnabled(panel->swi[6], True);
78
79 WMRealizeWidget(panel->box);
80 WMMapSubwidgets(panel->box);
81
82 showData(panel);
83 }
84
85 static void storeDefaults(_Panel * panel)
86 {
87 WMUserDefaults *udb = WMGetStandardUserDefaults();
88
89 SetBoolForKey(WMGetButtonSelected(panel->swi[0]), "DisableMiniwindows");
90
91 WMSetUDBoolForKey(udb, WMGetButtonSelected(panel->swi[1]), "NoXSetStuff");
92
93 SetBoolForKey(WMGetButtonSelected(panel->swi[2]), "SaveSessionOnExit");
94 SetBoolForKey(WMGetButtonSelected(panel->swi[3]), "UseSaveUnders");
95 SetBoolForKey(WMGetButtonSelected(panel->swi[4]), "DontConfirmKill");
96 SetBoolForKey(WMGetButtonSelected(panel->swi[5]), "DisableBlinking");
97 SetBoolForKey(WMGetButtonSelected(panel->swi[6]), "AntialiasedText");
98 }
99
100 Panel *InitExpert(WMScreen * scr, WMWidget * parent)
101 {
102 _Panel *panel;
103
104 panel = wmalloc(sizeof(_Panel));
105 memset(panel, 0, sizeof(_Panel));
106
107 panel->sectionName = _("Expert User Preferences");
108
109 panel->description = _("Options for people who know what they're doing...\n"
110 "Also have some other misc. options.");
111
112 panel->parent = parent;
113
114 panel->callbacks.createWidgets = createPanel;
115 panel->callbacks.updateDomain = storeDefaults;
116
117 AddSection(panel, ICON_FILE);
118
119 return panel;
120 }