slitaz-dev-tools view tazyad/tazyad @ rev 211

(c) 20** --> 2014
author Christophe Lincoln <pankso@slitaz.org>
date Thu Jan 02 14:46:57 2014 +0100 (2014-01-02)
parents 7e359c3b959d
children
line source
1 #!/bin/sh
2 #
3 # Yad on SliTaz - Create simple GUI boxes using Ash shell scripts.
4 #
5 # Copyright (C) 2014 SliTaz GNU/Linux - GNU gpl v2
6 #
7 # Authors : Name Firstname <mail@example.com>
8 #
10 # Main GUI box function with pure Yad spec
11 skel_main() {
12 yad --entry $opts \
13 --width=400 \
14 --image="slitaz-menu" \
15 --image-on-top \
16 --button="Button:2" \
17 --button="gtk-ok:0" \
18 --button="gtk-close:1" \
19 --text="Choose action:" \
20 --entry-text="install" "remove" "list" "upgrade"
21 }
23 # This is a function, usually the same name as the command if scripts
24 # have multiple commands and options.
25 skel() {
26 # Store box results
27 main=$(skel_main)
28 ret=$?
29 # Deal with --button values
30 case $ret in
31 1) exit 0 ;;
32 2) echo "Additional button action" && exit 0 ;;
33 *) continue ;;
34 esac
35 # Deal with $main values
36 case $main in
37 install) echo "Main var: $main" ;;
38 remove) echo "Main var: $main" ;;
39 *) echo "Main var: $main" ;;
40 esac
41 }
43 #
44 # Script commands
45 #
47 case "$1" in
48 usage)
49 echo "Usage: $(basename $0) [command]" ;;
50 *)
51 skel ;;
52 esac
54 exit 0