~profzoom/ubuntu/quantal/wmaker/bug-1079925

« back to all changes in this revision

Viewing changes to WPrefs.app/Expert.c

  • Committer: Bazaar Package Importer
  • Author(s): Marcelo E. Magallon
  • Date: 2004-11-10 14:05:30 UTC
  • Revision ID: james.westby@ubuntu.com-20041110140530-qpd66b5lm38x7apk
Tags: upstream-0.91.0
ImportĀ upstreamĀ versionĀ 0.91.0

Show diffs side-by-side

added added

removed removed

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