#!/usr/bin/wish

wm geometry . 505x270
wm title    . "X Shut by k-s"

set TIME 0
set RUNL 1

image create photo shutdown \
	-file [file join /usr/local/bin/xshut-pics/shutdown.gif]
image create photo reboot \
        -file [file join /usr/local/bin/xshut-pics/reboot.gif]
image create photo stop \
        -file [file join /usr/local/bin/xshut-pics/stop.gif]
image create photo standby \
        -file [file join /usr/local/bin/xshut-pics/standby.gif]
image create photo console \
	 -file [file join /usr/local/bin/xshut-pics/console.gif]
image create photo cuser \
	 -file [file join /usr/local/bin/xshut-pics/cuser.gif]
image create photo crunlevel \
	-file [file join /usr/local/bin/xshut-pics/crunlevel.gif]
image create photo door \
        -file [file join /usr/local/bin/xshut-pics/exit.gif]
image create photo iinfo \
	-file [file join /usr/local/bin/xshut-pics/info.gif]
image create photo logo \
        -file [file join /usr/local/bin/xshut-pics/logo.gif]

frame .frame1 -borderwidth 3 -height 160 -relief groove -width 160
frame .frame2 -borderwidth 3 -height 160 -relief groove -width 160
frame .frame3 -borderwidth 3 -height 160 -relief groove -width 160

label .txttime -text "Time(minutes):"
label .txtrunl -text "RunLevel:"
label .logo    -image logo

entry .time	-textvariable TIME
entry .runlevel	-textvariable RUNL

button .bshutdown -image shutdown -relief flat -borderwidth 0 \
	-command { exec shutdown -h $TIME | killall xshut} 
button .breboot    -image reboot -relief flat -borderwidth 0 \
	-command { exec shutdown -r $TIME | killall xshut}
button .bstop      -image stop -relief flat -borderwidth 0 \
	-command { exec shutdown -t 1 -c | killall xshut}
button .bconsole  -image console -relief flat -borderwidth 0 \
	-command { exec telinit 3 | killall X }
button .bcuser    -image cuser -relief flat -borderwidth 0 \
	-command { exec telinit 5 | killall X}
button .bstandby -image standby -relief flat -borderwidth 0 \
	-command { exec apm -S } 
button .bcrunlevel -image crunlevel  -relief flat -borderwidth 0 \
	-command { exec telinit -t 1 $RUNL | killall xshut}
button .bexit -image door -relief flat -borderwidth 0 \
        -justify center -command exit
button .binfo    -image iinfo -relief flat -borderwidth 0 \
	-command { showinfo }
button .bmyhp   -text " K-S Linux Programs: http://start.at/k-s " \
		   -font "-adobe-courier-bold-*-normal-*-10-*-*-*-*-*-*-*-*" \
                   -foreground green -background black -command { exec netscape http://www.angelfire.com/ks/linuxprg/} \
                   -justify center -borderwidth 0
proc showinfo {} {
        if [catch {toplevel .info}] return
        label .info.text1  -justify left -text "NOTE:"
	label .info.text2  -justify left -text "   This program was made by me (k-s) and with the help of a friend of mine," -font "courier"
	label .info.text3  -justify left -text " DEATH ANGEL who always helped me when I need."  -font "courier"
	label .info.text4  -justify left -text "THANKS:"	
	label .info.text5  -justify left -text "   To my girl friend Debora, who's always waiting I reply her ICQ messages."  -font "courier"
	label .info.text6  -justify left -text "PLEASE VISIT:"
	label .info.text7  -justify left -text "    http://www.angelfire.com/ks/linuxprg - the K-S Linux Programs"  -font "courier"
	label .info.text8  -justify left -text "    http://ano2001.sti.com.br - The best Brazilian Linux Page"  -font "courier"
	label .info.text9  -justify center -text "- October 16th, 1999 - this program is free, distribute it ! -"
        button .info.b1 -text "exit" -command {destroy .info}
        pack .info.text1 -fill x
	pack .info.text2 -fill x
	pack .info.text3 -fill x
	pack .info.text4 -fill x
	pack .info.text5 -fill x
	pack .info.text6 -fill x
	pack .info.text7 -fill x
	pack .info.text8 -fill x
	pack .info.text9 -fill x
	pack .info.b1 -fill x
	wm geometry .info 550x200
	wm title .info "XShut Info"
} 


place .frame1    -x 5   -y 5
place .bshutdown -x 10   -y 10
place .breboot   -x 10   -y 45  
place .txttime   -x 10   -y 85  -height 25
place .time      -x 110 -y 85  -height 25 -width 40
place .bstop     -x 10   -y 120

place .frame2    -x 170   -y 5
place .bconsole  -x 175   -y 15
place .bcuser    -x 175   -y 65
place .bstandby  -x 175   -y 115

place .frame3     -x 340   -y 5
place .bcrunlevel -x 345  -y 50
place .txtrunl    -x 345  -y 85 -height 25
place .runlevel   -x 425  -y 85 -height 25 -width 50

place .bexit	-x 40  -y 200
place .binfo    -x 227 -y 200 
place .logo     -x 405 -y 200
place .bmyhp	-x 5   -y 250 -width 495 -height 15
