slitaz-tools view tazbox/tazbox @ rev 559

tazbox: tiny edits
author Paul Issott <paul@slitaz.org>
date Mon Apr 18 18:11:21 2011 +0100 (2011-04-18)
parents d89081e15839
children 1b852318ef51
line source
1 #!/bin/sh
2 #
3 # SliTaz tiny GUI boxes for the desktop (su, logout, etc) and as usual
4 # please KISS
5 #
6 # Note: $(gettext "text") doesn't work inside Yad so use `gettext \"text\"`
7 #
8 # Copyright (C) 2011 SliTaz GNU/linux - GNU gpl v3
9 # - Christophe Lincoln <pankso@slitaz.org>
10 #
12 # Internationalization
13 . /usr/bin/gettext.sh
14 TEXTDOMAIN='tazbox'
15 export TEXTDOMAIN
17 #
18 # Functions
19 #
21 usage() {
22 cat << EOT
24 $(gettext "Usage:") $(basename $0) [command]
26 $(gettext "Commands:")
27 usage $(gettext "Display this short help usage")
28 logout $(gettext "Desktop logout box")
30 EOT
31 }
33 # Logout GUI function
34 logout_main() {
35 text=$(gettext "SliTaz Logout. Please choose an action:")
36 yad --entry --title="SliTaz Logout" \
37 --window-icon=/usr/share/pixmaps/slitaz-menu.png \
38 --width=440 --height=150 --text="$text" \
39 --image="slitaz-menu" --image-on-top \
40 --center --on-top --entry-text \
41 "`gettext \"Close X session\"` : exit" \
42 "`gettext \"Reboot system\"` : reboot" \
43 "`gettext \"Shutdown system\"` : halt"
44 }
46 #
47 # Commands
48 #
49 case "$1" in
50 su)
51 echo "TODO" ;;
52 logout)
53 # Store box results
54 main=`logout_main`
55 # Deal with --button values
56 case $? in
57 1) exit 0 ;;
58 *) continue ;;
59 esac
60 # Deal with $main values
61 case "$main" in
62 *exit) openbox --exit || jwm -exit ;;
63 *reboot) reboot ;;
64 *halt) poweroff ;;
65 esac ;;
66 *)
67 usage ;;
68 esac
70 exit 0