tazlito rev 139

box: move all GUI action to functions
author Christophe Lincoln <pankso@slitaz.org>
date Sat Jan 23 23:52:59 2010 +0100 (2010-01-23)
parents a31e7804380b
children 1e0f8206aa53
files tazlitobox
line diff
     1.1 --- a/tazlitobox	Sat Jan 23 21:59:04 2010 +0000
     1.2 +++ b/tazlitobox	Sat Jan 23 23:52:59 2010 +0100
     1.3 @@ -45,6 +45,8 @@
     1.4  	file-manager distro/addfiles &
     1.5  }
     1.6  
     1.7 +# All actions
     1.8 +
     1.9  writeiso_action()
    1.10  {
    1.11  	xterm -geometry 80x16 \
    1.12 @@ -70,6 +72,39 @@
    1.13  		-e "tazlito clean-distro && sleep 1"
    1.14  }
    1.15  
    1.16 +get_flavor_action()
    1.17 +{
    1.18 +	cd /home/slitaz
    1.19 +	xterm -geometry 80x16 \
    1.20 +		-title "get-flavor $COMMUNITY_FLAVOR" \
    1.21 +		-e "tazlito get-flavor $COMMUNITY_FLAVOR && echo -e \"----\nENTER to continue...\" && read close"
    1.22 +}
    1.23 +
    1.24 +gen_distro_action()
    1.25 +{
    1.26 +	cd /home/slitaz
    1.27 +	xterm -geometry 80x16 \
    1.28 +		-title "gen-distro" \
    1.29 +		-e "tazlito gen-distro && echo -e \"----\nENTER to continue...\" && read close"
    1.30 +}
    1.31 +
    1.32 +gen_flavor_action()
    1.33 +{
    1.34 +	cd /home/slitaz
    1.35 +	xterm -geometry 80x16 \
    1.36 +		-title "gen-flavor $GEN_FLAVOR_NAME" \
    1.37 +		-e "tazlito gen-flavor $GEN_FLAVOR_NAME && echo -e \"----\nENTER to continue...\" && read close"
    1.38 +}
    1.39 +
    1.40 +edit_distro_script()
    1.41 +{
    1.42 +	[ ! -f $DISTRO_SCRIPT ] && echo "#!/bin/sh" > $DISTRO_SCRIPT
    1.43 +	chmod +x $DISTRO_SCRIPT
    1.44 +	editor $DISTRO_SCRIPT
    1.45 +}
    1.46 +
    1.47 +# Boxes
    1.48 +
    1.49  export HELP='
    1.50  <window title="Tazlito Box - Help" icon-name="media-cdrom">
    1.51  <vbox>
    1.52 @@ -151,7 +186,6 @@
    1.53    <hbox>
    1.54      <text use-markup="true">
    1.55        <label>"<b>SliTaz Live Tool</b>"</label>
    1.56 -      
    1.57      </text>
    1.58      <pixmap>
    1.59  			<input file>/usr/share/pixmaps/tazlito.png</input>
    1.60 @@ -231,7 +265,6 @@
    1.61            <action>$BIN clean_distro_action</action>
    1.62          </button>
    1.63        </hbox>
    1.64 -      
    1.65       </frame>
    1.66       
    1.67           <frame Community and personal flavors>
    1.68 @@ -239,7 +272,7 @@
    1.69          <label>
    1.70  "
    1.71  Get and build preconfigured flavors from the community. Flavors
    1.72 -list can be recharged from SliTaz mirror. Some addfiles can be
    1.73 +llist can be recharged from SliTaz mirror. Some addfiles can be
    1.74  copied before generating the distro.
    1.75  "
    1.76          </label>
    1.77 @@ -264,8 +297,7 @@
    1.78          <button>
    1.79            <label>Get flavor</label>
    1.80            <input file icon="forward"></input>
    1.81 -          <action>cd /home/slitaz</action>
    1.82 -          <action>xterm -geometry 80x16 -title "get-flavor $COMMUNITY_FLAVOR" -e "tazlito get-flavor $COMMUNITY_FLAVOR && echo -e \"----\nENTER to continue...\" && read close"</action>
    1.83 +          <action>$BIN get_flavor_action</action>
    1.84          </button>
    1.85          <button>
    1.86            <label>Addfiles</label>
    1.87 @@ -275,8 +307,7 @@
    1.88          <button>
    1.89            <label>Gen distro</label>
    1.90            <input file icon="forward"></input>
    1.91 -          <action>cd /home/slitaz</action>
    1.92 -          <action>xterm -geometry 80x16 -title "gen-distro" -e "tazlito gen-distro && echo -e \"----\nENTER to continue...\" && read close"</action>
    1.93 +          <action>$BIN gen_distro_action</action>
    1.94          </button>
    1.95          <button>
    1.96            <label>Clean distro</label>
    1.97 @@ -315,8 +346,7 @@
    1.98        <button>
    1.99            <label>Gen new flavor</label>
   1.100            <input file icon="forward"></input>
   1.101 -          <action>cd /home/slitaz</action>
   1.102 -          <action>xterm -geometry 80x16 -title "gen-flavor $GEN_FLAVOR_NAME" -e "tazlito gen-flavor $GEN_FLAVOR_NAME && echo -e \"----\nENTER to continue...\" && read close"</action>
   1.103 +          <action>$BIN gen_flavor_action</action>
   1.104          </button>
   1.105        </hbox>
   1.106      </frame>
   1.107 @@ -370,9 +400,7 @@
   1.108          </entry>
   1.109          <button>
   1.110            <input file icon="accessories-text-editor"></input>
   1.111 -          <action>[ ! -f $DISTRO_SCRIPT ] && echo "#!/bin/sh" > $DISTRO_SCRIPT</action>
   1.112 -          <action>chmod +x $DISTRO_SCRIPT</action>
   1.113 -          <action>editor $DISTRO_SCRIPT</action>
   1.114 +          <action>$BIN edit_distro_script</action>
   1.115          </button>
   1.116        </hbox>
   1.117