1 # Copyright 1999 Jean-Louis Thirot
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 proc TkW
:debug
{msg
} {
20 proc TkW
:fixme
{msg
} {
22 proc TkW
:wineconf1
{} {
24 # propmt the user for a choice of the default config file:
26 # Existing {--> menu ~/.winerc or /etc/wineconf or custom}
27 # autogenarated with tools/wineconf
30 # test of existing is preformed first; test of existing wineconf also
33 set ExistEtc
[TkW
:ListConfig
/etc
/wine.conf
]
34 set ExistHome
[TkW
:ListConfig
"~/.winerc"]
36 TkW
:AskUserConfMethod
$ExistEtc $ExistHome
38 while [winfo exists .askConf
] {update}
41 proc TkW
:ListConfig
{fileConf
} {
46 if [file writa
$fileConf] {return 1} {return 0}
49 proc TkW
:AskUserConfMethod
{ExistEtc ExistHome
} {
51 global USER ChDefautConf DejaConf HOME OK CANCEL WAITfilename
52 global DefaultType EtcState HomeState GiveCustomDefault Default
53 global GetFileName GenereConf TkWBuiltConf
55 toplevel .askConf
-backgr #ffffff
56 label .askConf.banner
-text $ChDefautConf -backgr #0000ff \
57 -foregr #ffffff -height 2
58 pack .askConf.banner
-side top
-fill x
60 if {$USER == "root" && $ExistEtc == 1} {
61 set Default
/etc
/wine.conf
63 if {$ExistHome == 1} {set Default
"~/.winerc"} \
64 else {set Default Custom
}
66 if {[file writable
/etc
/wine.conf
]} {set EtcState normal
} {set EtcState disabled
}
67 if {$ExistHome == 1} {set HomeState normal
} {set HomeState disabled
}
69 frame .askConf.deja
-width 200 -backgr #ffffff
70 radiobutton .askConf.deja.rad
-backgr #dddddd -text $DejaConf\
71 -anchor nw
-value 0 -variable DefaultType
\
72 -indicatoron 1 -relief raised
-selectcolor #00ff00
73 pack .askConf.deja.rad
-side left
-padx 5
74 menubutton .askConf.deja.men
-backgr #dddddd \
75 -menu .askConf.deja.men.m
-width 50 -text $Default\
78 menu .askConf.deja.men.m
-cursor {} -tearoff 0
79 .askConf.deja.men.m add command
\
81 set Default
"$HOME/.winerc"
82 .askConf.deja.men configure
-text $Default
83 } -label "~/.winerc" -state $HomeState
84 .askConf.deja.men.m add command
\
86 set Default
"/etc/wine.conf"
87 .askConf.deja.men configure
-text $Default
89 -label "/etc/wine.conf (System wide configuration)"
90 .askConf.deja.men.m add command
\
92 TkW
:GetFileName
$GiveCustomDefault $OK $CANCEL File
93 #set WAITfilename wait
94 #while {$WAITfilename == "wait"} {update}
95 if {$WAITfilename == "opt1"} {
96 set Default
$GetFileName
98 .askConf.deja.men configure
-text $Default
101 -label "Custom (Give your own configuration file)"
102 pack .askConf.deja
-padx 5 -pady 10
103 pack .askConf.deja.men
105 label .askConf.img
-image wine_half
-backgr #ffffff -relief flat
106 pack .askConf.img
-side right
-anchor se
-padx 5 -pady 5
108 # Next radiobutton: tools/wineconf:
110 frame .askConf.radio
-backgr #ffffff -relief flat
111 radiobutton .askConf.radio.generate
-text $GenereConf\
112 -anchor nw
-value 1 -variable DefaultType
\
113 -selectcolor #00ff00 -relief raised
114 pack .askConf.radio.generate
-padx 5 -pady 5 -anchor w
-fill x
116 # Next radiobutton : TkWine Built-in
118 radiobutton .askConf.radio.tkwbuilt
-text $TkWBuiltConf\
119 -anchor nw
-value 2 -variable DefaultType
\
120 -selectcolor #00ff00 -relief raised
121 pack .askConf.radio.tkwbuilt
-padx 5 -pady 5 -anchor w
-fill x
122 pack .askConf.radio
-padx 0 -pady 0 -anchor w
124 # now OK or CANCEL....
125 frame .askConf.buttons
-backgr #ffffff -relief flat -height 25
126 button .askConf.buttons.ok
-width 8 -text $OK -command {
130 button .askConf.buttons.cancel
-width 8 -text $CANCEL -command {
133 pack .askConf.buttons.ok
-side left
-padx 25 -pady 5
134 pack .askConf.buttons.cancel
-side left
-padx 5 -pady 5
135 pack .askConf.buttons
-anchor w
-padx 5
138 proc TkW
:CallWineConf
{} {
140 global Default DefaultType TKW
141 switch $DefaultType {
142 0 {TkW
:wineconf
$Default}
145 set FoundWineConf
[TkW
:autoconf
/tmp
/auto_generated_wineconf
]
146 while {$FoundWineConf == 0} update
147 TkW
:wineconf
/tmp
/auto_generated_wineconf
150 2 {TkW
:wineconf
$TKW/setupfiles
/wine.ini
}
155 proc TkW
:GenereTmpConf
{wineconfTool
} {
157 set wherearewe ConfTool
158 set Pipe
[open "| $wineconfTool " r
+]
159 exec rm
-f /tmp
/auto_generated_wineconf
160 set TmpConf
[open /tmp
/auto_generated_wineconf w
]
161 while {![eof $Pipe]} {
166 set specialwhere CloseWineAutoConf