slitaz-tools rev 737

created oldstuff/gtkdialog
author Christophe Lincoln <pankso@slitaz.org>
date Sat Apr 28 20:13:13 2012 +0200 (2012-04-28)
parents 96a05e0a165d
children 0a831f1f1b51
files oldstuff/gtkdialog/subox oldstuff/gtkdialog/subox.pot oldstuff/gtkdialog/tazctrlbox oldstuff/gtkdialog/tazctrlbox.desktop oldstuff/gtkdialog/wifibox oldstuff/subox oldstuff/subox.pot oldstuff/tazctrlbox oldstuff/tazctrlbox.desktop oldstuff/wifibox
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/oldstuff/gtkdialog/subox	Sat Apr 28 20:13:13 2012 +0200
     1.3 @@ -0,0 +1,114 @@
     1.4 +#!/bin/sh
     1.5 +#
     1.6 +# Gtkdialog to execute program as root from a WM menu.
     1.7 +# (c) SliTaz GNU/Linux 2008-2010 - GNU gpl.
     1.8 +#
     1.9 +VERSION=20100324
    1.10 +
    1.11 +# Usage.
    1.12 +if [ -z "$1" ]; then
    1.13 +    echo "Slitaz subox version : $VERSION"
    1.14 +    echo -e "\nUsage : subox program\n"
    1.15 +    exit 0
    1.16 +fi
    1.17 +
    1.18 +# Nothing to do if we are root
    1.19 +test $(id -u) = 0 && exec $1
    1.20 +
    1.21 +# Include gettext helper script.
    1.22 +. /usr/bin/gettext.sh
    1.23 +
    1.24 +# Export package name for gettext.
    1.25 +TEXTDOMAIN='subox'
    1.26 +export TEXTDOMAIN
    1.27 +
    1.28 +# Keep command in an exported variable to be used by SU_DIALOG.
    1.29 +export SU_CMD=$1
    1.30 +
    1.31 +# Error window if the pwd is wrong.
    1.32 +export ERROR_DIALOG='
    1.33 +<window title="Subox">
    1.34 +  <vbox>
    1.35 +
    1.36 +    <text use-markup="true">
    1.37 +      <label>"
    1.38 +<b>SliTaz - Subox</b>"
    1.39 +      </label>
    1.40 +    </text>
    1.41 +    <text wrap="true" width-chars="48">
    1.42 +	<label>"'`gettext "Error: wrong password!"`'"</label>
    1.43 +    </text>
    1.44 +
    1.45 +    <hbox>
    1.46 +      <button ok></button>
    1.47 +    </hbox>
    1.48 +</vbox>
    1.49 +</window>
    1.50 +'
    1.51 +
    1.52 +# Main window and root password default entry set to 'root'.
    1.53 +SU_DIALOG='
    1.54 +<window title="Subox" skip_taskbar_hint="true">
    1.55 +<vbox>
    1.56 +
    1.57 +	<text use-markup="true">
    1.58 +		<label>"
    1.59 +<b>SliTaz - Subox</b>"
    1.60 +		</label>
    1.61 +	</text>
    1.62 +	<text wrap="true" width-chars="50">
    1.63 +		<label>"'`gettext "
    1.64 +Please enter root password (default root) to execute :"`'
    1.65 +'$@'
    1.66 +"
    1.67 +		</label>
    1.68 +	</text>
    1.69 +	
    1.70 +	<hbox>
    1.71 +		<text use-markup="true">
    1.72 +			<label>"'`gettext "<b>Admin password :</b>"`'"</label>
    1.73 +		</text>
    1.74 +		<entry visibility="false">'
    1.75 +
    1.76 +# Check if we have a saved passwd.
    1.77 +if [ -s $HOME/.config/slitaz/subox.conf ]; then
    1.78 +	PASSWD=`cat $HOME/.config/slitaz/subox.conf`
    1.79 +	[ -n "$PASSWD" ] && SU_DIALOG="$SU_DIALOG <default>$PASSWD</default>" && AUTO_SAVED_PASSWD=true
    1.80 +else 
    1.81 +AUTO_SAVED_PASSWD=false
    1.82 +fi
    1.83 +
    1.84 +export SU_DIALOG=''${SU_DIALOG}'
    1.85 +			<variable>PASSWD</variable>
    1.86 +		</entry>
    1.87 +	</hbox>
    1.88 +	
    1.89 +	<hbox>
    1.90 +		<checkbox>
    1.91 +			
    1.92 +			<label>"'`gettext "Autosave password"`'"</label>
    1.93 +			<variable>AUTOSAVE</variable>'
    1.94 +if [ $AUTO_SAVED_PASSWD = "true" ]
    1.95 +	then SU_DIALOG="$SU_DIALOG <default>true</default>"
    1.96 +	else SU_DIALOG="$SU_DIALOG <default>false</default>"
    1.97 +fi
    1.98 +
    1.99 +export SU_DIALOG=''${SU_DIALOG}'
   1.100 +			
   1.101 +		</checkbox>
   1.102 +		<button ok>
   1.103 +			<action> echo $PASSWD | su -c "$SU_CMD &" || gtkdialog --center --program=ERROR_DIALOG</action>
   1.104 +			<action>[ $AUTOSAVE == true ] && echo $PASSWD > '$HOME/.config/slitaz/subox.conf'</action>
   1.105 +			<action>[ $AUTOSAVE == true ] && chmod 0600 '$HOME/.config/slitaz/subox.conf'</action>
   1.106 +			<action>[ $AUTOSAVE == false ] && cat /dev/null > '$HOME/.config/slitaz/subox.conf'</action>
   1.107 +			<action type="closewindow">SU_DIALOG</action>
   1.108 +		</button>
   1.109 +		<button cancel></button>
   1.110 +	</hbox>
   1.111 +
   1.112 +</vbox>
   1.113 +</window>'
   1.114 +
   1.115 +gtkdialog --center --program=SU_DIALOG > /dev/null
   1.116 +
   1.117 +exit 0
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/oldstuff/gtkdialog/subox.pot	Sat Apr 28 20:13:13 2012 +0200
     2.3 @@ -0,0 +1,36 @@
     2.4 +# SOME DESCRIPTIVE TITLE.
     2.5 +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
     2.6 +# This file is distributed under the same license as the PACKAGE package.
     2.7 +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
     2.8 +#
     2.9 +#, fuzzy
    2.10 +msgid ""
    2.11 +msgstr ""
    2.12 +"Project-Id-Version: subox\n"
    2.13 +"Report-Msgid-Bugs-To: \n"
    2.14 +"POT-Creation-Date: 2011-04-29 18:20+0200\n"
    2.15 +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    2.16 +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
    2.17 +"Language-Team: LANGUAGE <LL@li.org>\n"
    2.18 +"Language: \n"
    2.19 +"MIME-Version: 1.0\n"
    2.20 +"Content-Type: text/plain; charset=CHARSET\n"
    2.21 +"Content-Transfer-Encoding: 8bit\n"
    2.22 +
    2.23 +#: tinyutils/subox:39
    2.24 +msgid "Error: wrong password!"
    2.25 +msgstr ""
    2.26 +
    2.27 +#: tinyutils/subox:60
    2.28 +msgid ""
    2.29 +"\n"
    2.30 +"Please enter root password (default root) to execute :"
    2.31 +msgstr ""
    2.32 +
    2.33 +#: tinyutils/subox:69
    2.34 +msgid "<b>Admin password :</b>"
    2.35 +msgstr ""
    2.36 +
    2.37 +#: tinyutils/subox:89
    2.38 +msgid "Autosave password"
    2.39 +msgstr ""
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/oldstuff/gtkdialog/tazctrlbox	Sat Apr 28 20:13:13 2012 +0200
     3.3 @@ -0,0 +1,563 @@
     3.4 +#!/bin/sh
     3.5 +#
     3.6 +# SliTaz Control Box is a tool to configure and manage a SliTaz system.
     3.7 +# The script uses GTKdialog for the UI interface. Some shell functions
     3.8 +# are called by argument. Individual window dialogs are put into 
     3.9 +# functions.
    3.10 +#
    3.11 +# (C) GNU gpl v3 - SliTaz GNU/Linux 2010.
    3.12 +# Author: Christophe Lincoln <pankso@slitaz.org>
    3.13 +#
    3.14 +VERSION=1.1
    3.15 +
    3.16 +# Include gettext helper script.
    3.17 +. /usr/bin/gettext.sh
    3.18 +
    3.19 +# Export package name for gettext.
    3.20 +TEXTDOMAIN='tazctrlbox'
    3.21 +export TEXTDOMAIN
    3.22 +
    3.23 +# Get init configuration.
    3.24 +. /etc/rcS.conf
    3.25 +
    3.26 +# Tazctrlbox is only for root.
    3.27 +if test $(id -u) != 0 ; then
    3.28 +	exec subox $0
    3.29 +	exit 0
    3.30 +fi
    3.31 +
    3.32 +# By default autologin is not configured on an installed system.
    3.33 +if ! grep -q 'auto_login' /etc/slim.conf; then
    3.34 +	echo '# Auto login default user' >> /etc/slim.conf
    3.35 +	echo 'auto_login          no' >> /etc/slim.conf
    3.36 +fi
    3.37 +
    3.38 +# Change Grub menu.lst timeout.
    3.39 +sed_grub_timeout()
    3.40 +{
    3.41 +	CURRENT=`cat /boot/grub/menu.lst | grep ^timeout | cut -d " " -f2`
    3.42 +	sed -i s/"timeout $CURRENT"/"timeout $GRUB_TIMEOUT"/ /boot/grub/menu.lst
    3.43 +}
    3.44 +
    3.45 +# Change Grub menu.lst timeout.
    3.46 +sed_grub_color()
    3.47 +{
    3.48 +	CURRENT=`cat /boot/grub/menu.lst | grep ^color | cut -d " " -f2-3`
    3.49 +	sed -i s#"color $CURRENT"#"color $GRUB_COLOR"# /boot/grub/menu.lst
    3.50 +}
    3.51 +
    3.52 +# Set check fs on boot.
    3.53 +sed_check_fs()
    3.54 +{
    3.55 +	sed -i s#"CHECK_FS=\"$CHECK_FS\""#"CHECK_FS=\"$NEW_CHECK_FS\""# \
    3.56 +		/etc/rcS.conf
    3.57 +}
    3.58 +
    3.59 +# Set loaded modules on boot.
    3.60 +sed_load_modules()
    3.61 +{
    3.62 +	sed -i s/"LOAD_MODULES=\"$LOAD_MODULES\""/"LOAD_MODULES=\"$NEW_MODULES\""/ \
    3.63 +		/etc/rcS.conf
    3.64 +}
    3.65 +
    3.66 +# Set daemons to run on boot.
    3.67 +sed_run_daemons()
    3.68 +{
    3.69 +	sed -i s/"RUN_DAEMONS=\"$RUN_DAEMONS\""/"RUN_DAEMONS=\"$NEW_DAEMONS\""/ \
    3.70 +		/etc/rcS.conf
    3.71 +}
    3.72 +
    3.73 +# Get user list.
    3.74 +get_users()
    3.75 +{
    3.76 +	for i in `cat /etc/passwd | cut -d ":" -f 1`
    3.77 +	do
    3.78 +		if [ -d /home/$i ]; then
    3.79 +			login=$i
    3.80 +			uid=`cat /etc/passwd | grep $i | cut -d ":" -f 3`
    3.81 +			gid=`cat /etc/passwd | grep $i | cut -d ":" -f 4`
    3.82 +			name=`cat /etc/passwd | grep $i | cut -d ":" -f 5 | sed s/,,,//`
    3.83 +			home=`cat /etc/passwd | grep $i | cut -d ":" -f 6`
    3.84 +			shell=`cat /etc/passwd | grep $i | cut -d ":" -f 7`
    3.85 +			echo "system-users | $login | $uid:$gid | $name | $home | $shell"
    3.86 +		fi
    3.87 +	done
    3.88 +}
    3.89 +
    3.90 +# Remove a user or change passwd.
    3.91 +manage_user()
    3.92 +{
    3.93 +	export MANAGE_DIALOG="
    3.94 +<window title=\"`gettext "Manage user: "`$USER\" icon-name=\"computer\">
    3.95 +	<vbox>
    3.96 +		<vbox>
    3.97 +			<text wrap=\"false\" width-chars=\"34\">
    3.98 +				<label>\"
    3.99 +Login name: $USER
   3.100 +				\"</label>
   3.101 +			</text>
   3.102 +		</vbox>
   3.103 +		<hbox>
   3.104 +			<text wrap=\"false\">
   3.105 +				<label>\"`gettext "New password:"`\"</label>
   3.106 +			</text>
   3.107 +			<entry invisible_char=\"*\" visibility=\"false\" max_length=\"8\">
   3.108 +				<variable>PASSWD</variable>
   3.109 +			</entry>
   3.110 +			<button>
   3.111 +				<label>Change</label>
   3.112 +				<input file icon=\"forward\"></input>
   3.113 +				<action>echo \"$USER:$PASSWD\" | chpasswd -m</action>
   3.114 +				<action type=\"closewindow\">MANAGE_USER</action>
   3.115 +			</button>
   3.116 +		</hbox>
   3.117 +		<hbox>
   3.118 +			<button>
   3.119 +				<label>`gettext "Delete user"`</label>
   3.120 +				<input file icon=\"gtk-delete\"></input>
   3.121 +				<action>deluser $USER</action>
   3.122 +				<action type=\"closewindow\">MANAGE_USER</action>
   3.123 +			</button>
   3.124 +			<button cancel>
   3.125 +				<action type=\"closewindow\">MANAGE_USER</action>
   3.126 +			</button>
   3.127 +		</hbox>
   3.128 +	</vbox>
   3.129 +</window>
   3.130 +"
   3.131 +	gtkdialog --center --program=MANAGE_DIALOG >/dev/null
   3.132 +}
   3.133 +
   3.134 +# Add a new user.
   3.135 +add_user()
   3.136 +{
   3.137 +	export ADD_USER_DIALOG='
   3.138 +<window title="New user" icon-name="gtk-add">
   3.139 +	<vbox>
   3.140 +		<vbox>
   3.141 +			<text wrap="false" width-chars="34">
   3.142 +				<label>"'`gettext "
   3.143 +New account information"`'
   3.144 +				"</label>
   3.145 +			</text>
   3.146 +		</vbox>
   3.147 +		<hbox>
   3.148 +			<text wrap="false">
   3.149 +				<label>"'`gettext "Login:"`'      "</label>
   3.150 +			</text>
   3.151 +			<entry>
   3.152 +				<variable>NEW_USER</variable>
   3.153 +			</entry>
   3.154 +		</hbox>
   3.155 +		<hbox>
   3.156 +			<text wrap="false">
   3.157 +				<label>"'`gettext "Password:"`'"</label>
   3.158 +			</text>
   3.159 +			<entry invisible_char="*" visibility="false" max_length="8">
   3.160 +				<variable>PASSWD</variable>
   3.161 +			</entry>
   3.162 +		</hbox>
   3.163 +		<hbox>
   3.164 +			<button ok>
   3.165 +				<action>adduser -D $NEW_USER</action>
   3.166 +				<action>echo "$NEW_USER:$PASSWD" | chpasswd -m</action>
   3.167 +				<action>addgroup $NEW_USER audio</action>
   3.168 +				<action>addgroup $NEW_USER cdrom</action>
   3.169 +				<action>addgroup $NEW_USER floppy</action>
   3.170 +				<action>addgroup $NEW_USER video</action>
   3.171 +				<action>rmdir /home/$NEW_USER</action>
   3.172 +				<action>cp -a /etc/skel /home/$NEW_USER</action>
   3.173 +				<action>cp /root/.xinitrc /home/$NEW_USER</action>
   3.174 +				<action>mkdir -p /home/$NEW_USER/.config/slitaz</action>
   3.175 +				<action>cp -a /etc/slitaz/applications.conf /home/$NEW_USER/.config/slitaz</action>
   3.176 +				<action>chown -R $NEW_USER:$NEW_USER /home/$NEW_USER</action>
   3.177 +				<action type="closewindow">MANAGE_USER</action>
   3.178 +			</button>
   3.179 +			<button cancel>
   3.180 +				<action type="closewindow">MANAGE_USER</action>
   3.181 +			</button>
   3.182 +		</hbox>
   3.183 +	</vbox>
   3.184 +</window>
   3.185 +'
   3.186 +	gtkdialog --center --program=ADD_USER_DIALOG >/dev/null	
   3.187 +}
   3.188 +
   3.189 +# i18n functions.
   3.190 +list_locales()
   3.191 +{
   3.192 +	cd /usr/share/i18n/locales
   3.193 +	for locale in `ls -1 [a-z][a-z]_[A-Z][A-Z]`
   3.194 +	do
   3.195 +		echo "preferences-desktop-locale | $locale | UTF-8"
   3.196 +	done
   3.197 +}
   3.198 +gen_utf8_locale()
   3.199 +{
   3.200 +	rm -rf /usr/lib/locale/$LANGUAGE
   3.201 +	localedef -i $LANGUAGE -c -f UTF-8 /usr/lib/locale/$LANGUAGE
   3.202 +	# System configuration
   3.203 +	echo "LANG=$LANGUAGE" > /etc/locale.conf
   3.204 +	echo "LC_ALL=$LANGUAGE" >> /etc/locale.conf
   3.205 +}
   3.206 +
   3.207 +# Main dialog with notebook.
   3.208 +#
   3.209 +export MAIN_DIALOG='
   3.210 +<window title="'`gettext "SliTaz Control Box"`'" icon-name="computer">
   3.211 +<vbox>
   3.212 +
   3.213 +	<hbox>
   3.214 +		<text use-markup="true">
   3.215 +			<label>"'`gettext "<b>SliTaz Control Box</b>"`'"</label>
   3.216 +		</text>
   3.217 +		<pixmap>
   3.218 +			<input file>/usr/share/pixmaps/tazctrlbox.png</input>
   3.219 +		</pixmap>
   3.220 +	</hbox>
   3.221 +
   3.222 +	<notebook labels="'`gettext "Boot loader|Initialization|Login manager|Time|Language|Users"`'">'
   3.223 +	
   3.224 +# GRUB.
   3.225 +MAIN_DIALOG=${MAIN_DIALOG}"
   3.226 +	<vbox>
   3.227 +		<frame `gettext "Grub boot loader"`>
   3.228 +			<hbox>
   3.229 +				<text wrap=\"false\">
   3.230 +					<label>\"`gettext "Timeout:"`\"</label>
   3.231 +				</text>
   3.232 +				<entry>
   3.233 +					<input>cat /boot/grub/menu.lst | grep ^timeout | cut -d \" \" -f2</input>
   3.234 +					<variable>GRUB_TIMEOUT</variable>
   3.235 +				</entry>
   3.236 +				<button>
   3.237 +					<label>`gettext "Change"`</label>
   3.238 +					<input file icon=\"forward\"></input>
   3.239 +					<action>$0 sed_grub_timeout</action>
   3.240 +				</button>
   3.241 +			</hbox>
   3.242 +			<hbox>
   3.243 +				<text wrap=\"false\">
   3.244 +					<label>\"`gettext "Color:"`    \"</label>
   3.245 +				</text>
   3.246 +				<entry>
   3.247 +					<input>cat /boot/grub/menu.lst | grep ^color | cut -d \" \" -f2-3</input>
   3.248 +					<variable>GRUB_COLOR</variable>
   3.249 +				</entry>
   3.250 +				<button>
   3.251 +					<label>`gettext "Change"`</label>
   3.252 +					<input file icon=\"forward\"></input>
   3.253 +					<action>$0 sed_grub_color</action>
   3.254 +				</button>
   3.255 +			</hbox>
   3.256 +			<hbox>
   3.257 +				<text wrap=\"false\">
   3.258 +					<label>\"`gettext "Configuration file:"`\"</label>
   3.259 +				</text>
   3.260 +				<button>
   3.261 +					<label>/boot/grub/menu.lst</label>
   3.262 +					<input file icon=\"accessories-text-editor\"></input>
   3.263 +					<action>leafpad /boot/grub/menu.lst</action>
   3.264 +					<action>refresh:GRUB_COLOR</action>
   3.265 +					<action>refresh:GRUB_TIMEOUT</action>
   3.266 +				</button>
   3.267 +			</hbox>
   3.268 +		</frame>
   3.269 +	</vbox>"
   3.270 +# Init script.
   3.271 +MAIN_DIALOG=${MAIN_DIALOG}"
   3.272 +	<vbox>
   3.273 +		<frame `gettext "rcS init scripts"`>
   3.274 +			<hbox>
   3.275 +				<text wrap=\"false\">
   3.276 +					<label>\"`gettext "Check filesystems:"`\"</label>
   3.277 +				</text>
   3.278 +				<entry>
   3.279 +					<input>echo $CHECK_FS</input>
   3.280 +					<variable>NEW_CHECK_FS</variable>
   3.281 +				</entry>
   3.282 +				<button>
   3.283 +					<label>Change</label>
   3.284 +					<input file icon=\"forward\"></input>
   3.285 +					<action>$0 sed_check_fs</action>
   3.286 +				</button>
   3.287 +			</hbox>
   3.288 +			<hbox>
   3.289 +				<text wrap=\"false\">
   3.290 +					<label>\"`gettext "Load modules:"`      \"</label>
   3.291 +				</text>
   3.292 +				<entry>
   3.293 +					<input>echo $LOAD_MODULES</input>
   3.294 +					<variable>NEW_MODULES</variable>
   3.295 +				</entry>
   3.296 +				<button>
   3.297 +					<label>`gettext "Change"`</label>
   3.298 +					<input file icon=\"forward\"></input>
   3.299 +					<action>$0 sed_load_modules</action>
   3.300 +				</button>
   3.301 +			</hbox>
   3.302 +			<hbox>
   3.303 +				<text wrap=\"false\">
   3.304 +					<label>\"`gettext "Run daemons:"`       \"</label>
   3.305 +				</text>
   3.306 +				<entry>
   3.307 +					<input>echo $RUN_DAEMONS</input>
   3.308 +					<variable>NEW_DAEMONS</variable>
   3.309 +				</entry>
   3.310 +				<button>
   3.311 +					<label>`gettext "Change"`</label>
   3.312 +					<input file icon=\"forward\"></input>
   3.313 +					<action>$0 sed_run_daemons</action>
   3.314 +				</button>
   3.315 +			</hbox>
   3.316 +			<hbox>
   3.317 +				<text wrap=\"false\">
   3.318 +					<label>\"`gettext "Add local commands:"`\"</label>
   3.319 +				</text>
   3.320 +				<button>
   3.321 +					<label>/etc/init.d/local.sh</label>
   3.322 +					<input file icon=\"accessories-text-editor\"></input>
   3.323 +					<action>leafpad /etc/init.d/local.sh</action>
   3.324 +				</button>
   3.325 +			</hbox>
   3.326 +		</frame>
   3.327 +	</vbox>"
   3.328 +# Slim login.
   3.329 +MAIN_DIALOG=${MAIN_DIALOG}'
   3.330 +	<vbox>
   3.331 +		<frame '`gettext "Slim settings"`'>
   3.332 +			<hbox>
   3.333 +				<text wrap="false">
   3.334 +					<label>"'`gettext "Sessions:"`'                "</label>
   3.335 +				</text>
   3.336 +				<entry>
   3.337 +					<input>cat /etc/slim.conf | grep ^session | sed s/"sessions. *"//</input>
   3.338 +					<variable>SLIM_SESSIONS</variable>
   3.339 +				</entry>
   3.340 +				<button>
   3.341 +					<label>'`gettext "Change"`'</label>
   3.342 +					<input file icon="forward"></input>
   3.343 +					<action>sed -i "s/^sessions.*/sessions            $SLIM_SESSIONS/" /etc/slim.conf</action>
   3.344 +				</button>
   3.345 +			</hbox>
   3.346 +			<hbox>
   3.347 +				<text wrap="false">
   3.348 +					<label>"'`gettext "Default user:"`'           "</label>
   3.349 +				</text>
   3.350 +				<entry>
   3.351 +					<input>cat /etc/slim.conf | grep ^default_user | sed s/"default_user. *"//</input>
   3.352 +					<variable>SLIM_DEF_USER</variable>
   3.353 +				</entry>
   3.354 +				<button>
   3.355 +					<label>'`gettext "Change"`'</label>
   3.356 +					<input file icon="forward"></input>
   3.357 +					<action>sed -i "s/^default_user.*/default_user        $SLIM_DEF_USER/" /etc/slim.conf</action>
   3.358 +				</button>
   3.359 +			</hbox>
   3.360 +			<hbox>
   3.361 +				<text wrap="false">
   3.362 +					<label>"'`gettext "Auto login (yes|no):"`' "</label>
   3.363 +				</text>
   3.364 +				<entry max_length="3">
   3.365 +					<input>cat /etc/slim.conf | grep ^auto_login | sed s/"auto_login. *"//</input>
   3.366 +					<variable>SLIM_AUTO_LOGIN</variable>
   3.367 +				</entry>
   3.368 +				<button>
   3.369 +					<label>'`gettext "Change"`'</label>
   3.370 +					<input file icon="forward"></input>
   3.371 +					<action>sed -i "s/^auto_login.*/auto_login          $SLIM_AUTO_LOGIN/" /etc/slim.conf</action>
   3.372 +				</button>
   3.373 +			</hbox>
   3.374 +			<hbox>
   3.375 +				<text wrap="false">
   3.376 +					<label>"'`gettext "Theme:"`'"</label>
   3.377 +				</text>
   3.378 +				<combobox>
   3.379 +					<variable>NEW_SLIM_THEME</variable>'
   3.380 +# List all installed Slim themes.
   3.381 +for dir in $(ls /usr/share/slim/themes)
   3.382 +do
   3.383 +	THEME_ITEMS="<item>$dir</item>"
   3.384 +	MAIN_DIALOG=${MAIN_DIALOG}${THEME_ITEMS}
   3.385 +done		
   3.386 +MAIN_DIALOG=${MAIN_DIALOG}'
   3.387 +				</combobox>	
   3.388 +				<button>
   3.389 +					<label>'`gettext "Preview"`'</label>
   3.390 +					<input file icon="video-display"></input>
   3.391 +					<action>slim -p /usr/share/slim/themes/$NEW_SLIM_THEME &</action>
   3.392 +				</button>
   3.393 +				<button>
   3.394 +					<label>'`gettext "Change"`'</label>
   3.395 +					<input file icon="forward"></input>
   3.396 +					<action>sed -i "s/^current_theme.*/current_theme       $NEW_SLIM_THEME/" /etc/slim.conf</action>
   3.397 +					<action>refresh:SLIM_THEME</action>
   3.398 +				</button>
   3.399 +			</hbox>
   3.400 +			<hbox>
   3.401 +				<text wrap="false">
   3.402 +					<label>"'`gettext "Configuration file:"`'"</label>
   3.403 +				</text>
   3.404 +				<button>
   3.405 +					<label>/etc/slim.conf</label>
   3.406 +					<input file icon="accessories-text-editor"></input>
   3.407 +					<action>leafpad /etc/slim.conf</action>
   3.408 +					<action>refresh:SLIM_SESSIONS</action>
   3.409 +					<action>refresh:SLIM_DEF_USER</action>
   3.410 +				</button>
   3.411 +			</hbox>
   3.412 +		</frame>
   3.413 +	</vbox>'
   3.414 +# Time settings.
   3.415 +MAIN_DIALOG=${MAIN_DIALOG}'	
   3.416 +	<vbox>
   3.417 +		<frame '`gettext "Date and time"`'>
   3.418 +			<hbox>
   3.419 +				<text wrap="false">
   3.420 +					<label>"'`gettext "System time:"`'   "</label>
   3.421 +				</text>
   3.422 +				<entry editable="false">
   3.423 +					<input>LC_ALL=C date</input>
   3.424 +					<variable>DATE</variable>
   3.425 +				</entry>
   3.426 +				<button>
   3.427 +					<label>'`gettext "Sync online"`'</label>
   3.428 +					<input file icon="reload"></input>
   3.429 +					<action>rdate -s tick.greyware.com</action>
   3.430 +					<action>refresh:DATE</action>
   3.431 +					<action>refresh:HWTIME</action>
   3.432 +				</button>
   3.433 +			</hbox>
   3.434 +			<hbox>
   3.435 +				<text wrap="false">
   3.436 +					<label>"'`gettext "Hardware time:"`'"</label>
   3.437 +				</text>
   3.438 +				<entry editable="false">
   3.439 +					<input>LC_ALL=C hwclock</input>
   3.440 +					<variable>HWTIME</variable>
   3.441 +				</entry>
   3.442 +				<button>
   3.443 +					<label>'`gettext "Set from system"`'</label>
   3.444 +					<input file icon="reload"></input>
   3.445 +					<action>hwclock -w -u</action>
   3.446 +					<action>refresh:HWTIME</action>
   3.447 +					<action>refresh:DATE</action>
   3.448 +				</button>
   3.449 +			</hbox>
   3.450 +			<hbox>
   3.451 +				<text wrap="true">
   3.452 +					<label>"'`gettext "Timezone:"`'       "</label>
   3.453 +				</text>
   3.454 +				<entry>
   3.455 +					<input>cat /etc/TZ</input>
   3.456 +					<variable>NEW_TZ</variable>
   3.457 +				</entry>
   3.458 +				<button>
   3.459 +					<label>'`gettext "Change"`'</label>
   3.460 +					<input file icon="forward"></input>
   3.461 +					<action>echo "$NEW_TZ" > /etc/TZ</action>
   3.462 +				</button>
   3.463 +			</hbox>
   3.464 +		</frame>
   3.465 +	</vbox>'
   3.466 +# Language settings.
   3.467 +MAIN_DIALOG=${MAIN_DIALOG}"
   3.468 +	<vbox>
   3.469 +		<tree>
   3.470 +			<width>600</width><height>210</height>
   3.471 +			<variable>LANGUAGE</variable>
   3.472 +			<label>`gettext "Language|Charmap"`</label>
   3.473 +			<input icon_column=\"0\">$0 list_locales</input>
   3.474 +			<action>$0 gen_utf8_locale</action>
   3.475 +		</tree>
   3.476 +		<hbox>
   3.477 +		<text width-chars=\"60\">
   3.478 +			<label>
   3.479 +\"`gettext "To change the system language you can double-click on the locale name."`\"
   3.480 +			</label>
   3.481 +		</text>
   3.482 +		<button>
   3.483 +			<label>`gettext "Keymap"`</label>
   3.484 +			<input file icon=\"input-keyboard\"></input>
   3.485 +			<action>tazkeymap &</action>
   3.486 +		</button>
   3.487 +	</hbox>
   3.488 +	</vbox>"
   3.489 +# Display users list through get_users.
   3.490 +MAIN_DIALOG=${MAIN_DIALOG}"
   3.491 +	<vbox>
   3.492 +		<tree>
   3.493 +			<width>600</width><height>210</height>
   3.494 +			<variable>USER</variable>
   3.495 +			<label>`gettext "Login|uid:gid|Name|Home|SHell"`</label>
   3.496 +			<input icon_column=\"0\">$0 get_users</input>
   3.497 +			<action>$0 manage_user</action>
   3.498 +			<action>refresh:USER</action>
   3.499 +		</tree>
   3.500 +		<hbox>
   3.501 +		<text width-chars=\"60\">
   3.502 +			<label>
   3.503 +\"`gettext "To change passwords or delete users you can double-click on the user name."`\"
   3.504 +			</label>
   3.505 +		</text>
   3.506 +		<button>
   3.507 +			<label>`gettext "Add newuser"`</label>
   3.508 +			<input file icon=\"gtk-add\"></input>
   3.509 +			<action>$0 add_user</action>
   3.510 +			<action>refresh:USER</action>
   3.511 +		</button>
   3.512 +	</hbox>
   3.513 +	</vbox>"
   3.514 +export MAIN_DIALOG=${MAIN_DIALOG}'	
   3.515 +	</notebook>
   3.516 +
   3.517 +	<hbox>
   3.518 +		<button>
   3.519 +			<label>'`gettext "Network"`'</label>
   3.520 +			<input file icon="netbox"></input>
   3.521 +			<action>netbox &</action>
   3.522 +		</button>
   3.523 +		<button>
   3.524 +			<label>'`gettext "Wireless"`'</label>
   3.525 +			<input file icon="network-wireless"></input>
   3.526 +			<action>wifibox &</action>
   3.527 +		</button>
   3.528 +		<button>
   3.529 +			<label>'`gettext "Packages"`'</label>
   3.530 +			<input file icon="tazpkg"></input>
   3.531 +			<action>tazpkgbox &</action>
   3.532 +		</button>
   3.533 +		<button>
   3.534 +			<label>'`gettext "Hardware"`'</label>
   3.535 +			<input file icon="computer"></input>
   3.536 +			<action>tazhw box &</action>
   3.537 +		</button>
   3.538 +		<button>
   3.539 +			<label>'`gettext "Server"`'</label>
   3.540 +			<input file icon="utilities-system-monitor"></input>
   3.541 +			<action>serverbox &</action>
   3.542 +		</button>
   3.543 +		<button>
   3.544 +			<label>'`gettext "Storage"`'</label>
   3.545 +			<input file icon="media-flash"></input>
   3.546 +			<action>mountbox &</action>
   3.547 +		</button>
   3.548 +		<button>
   3.549 +			<label>'`gettext "Exit"`'</label>
   3.550 +			<input file icon="exit"></input>
   3.551 +			<action type="exit">Exit</action>
   3.552 +		</button>
   3.553 +	</hbox>
   3.554 +
   3.555 +</vbox>
   3.556 +
   3.557 +</window>'
   3.558 +
   3.559 +# Script can be called with an arg to exec a function.
   3.560 +if [ -n "$1" ]; then
   3.561 +	$1
   3.562 +else
   3.563 +	gtkdialog --center --program=MAIN_DIALOG >/dev/null
   3.564 +fi
   3.565 +
   3.566 +exit 0
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/oldstuff/gtkdialog/tazctrlbox.desktop	Sat Apr 28 20:13:13 2012 +0200
     4.3 @@ -0,0 +1,10 @@
     4.4 +[Desktop Entry]
     4.5 +Encoding=UTF-8
     4.6 +Name=Control Box
     4.7 +Name[fr]=Boîte de contrôle
     4.8 +Name[pt]=Painel de Controle
     4.9 +Comment=Manage your SliTaz system
    4.10 +Exec=subox tazctrlbox
    4.11 +Icon=tazctrlbox.png
    4.12 +Type=Application
    4.13 +Categories=System;Application;
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/oldstuff/gtkdialog/wifibox	Sat Apr 28 20:13:13 2012 +0200
     5.3 @@ -0,0 +1,686 @@
     5.4 +#!/bin/sh
     5.5 +#
     5.6 +# GTKdialog interface to manage wireless connections in a simple way.
     5.7 +# Use tabs to indent, split commands from the GUI and use functions.
     5.8 +# Favorite networks are also supported
     5.9 +#
    5.10 +# (c) 2010 SliTaz GNU/Linux - GNU gpl v3
    5.11 +#
    5.12 +VERSION=20100118
    5.13 +
    5.14 +# Export script path and others if needed so we can use them in 'quote'.
    5.15 +export BIN=$0
    5.16 +export FAVORITES_WIFI=/etc/wireless
    5.17 +. /etc/network.conf
    5.18 +
    5.19 +# Wifibox is only for root.
    5.20 +if test $(id -u) != 0 ; then
    5.21 +	exec subox wifibox
    5.22 +	exit 0
    5.23 +fi
    5.24 +
    5.25 +# Sanity check
    5.26 +[ -x /usr/sbin/iwconfig ] || tazpkg get-install wireless_tools
    5.27 +[ -d $FAVORITES_WIFI ] || mkdir -p $FAVORITES_WIFI
    5.28 +rm -f $FAVORITES_WIFI/any.conf
    5.29 +
    5.30 +# Catch ESSIDs and format output for GTK tree. We get the list of
    5.31 +# networks by Cell and without spaces.
    5.32 +detect_wifi_networks()
    5.33 +{
    5.34 +	desktopbox notify "Scanning Wireless interface: $WIFI_INTERFACE" &
    5.35 +	if [ -d /sys/class/net/$WIFI_INTERFACE/wireless ]; then
    5.36 +		ifconfig $WIFI_INTERFACE up
    5.37 +		for i in `iwlist $WIFI_INTERFACE scan | sed s/"Cell "/Cell-/ | grep "Cell-" | awk '{print $1}'`
    5.38 +		do
    5.39 +			SCAN=`iwlist $WIFI_INTERFACE scan last | \
    5.40 +				awk '/(Cell|ESS|Qual|Encry|IE: WPA)/ {print}' | \
    5.41 +				sed s/"Cell "/Cell-/ | grep -A 5 "$i"`
    5.42 +			ESSID=`echo $SCAN | cut -d '"' -f 2`
    5.43 +			if echo "$SCAN" | grep -q Quality; then
    5.44 +				QUALITY=`echo $SCAN | sed 's/.*Quality=\([^ ]*\).*/\1/' | sed 's/.*Quality:\([^ ]*\).*/\1/'`
    5.45 +			else
    5.46 +				QUALITY="-"
    5.47 +			fi
    5.48 +			ENCRYPTION=`echo $SCAN | sed 's/.*key:\([^ ]*\).*/\1/'`
    5.49 +			# Check encryption type
    5.50 +			if echo "$SCAN" | grep -q WPA; then
    5.51 +				ENCRYPTION="${ENCRYPTION} (WPA)"
    5.52 +			fi
    5.53 +			# Connected or not connected...
    5.54 +			if ifconfig | grep -A 1 $WIFI_INTERFACE | \
    5.55 +				grep -q inet && iwconfig $WIFI_INTERFACE | \
    5.56 +				grep ESSID | grep -q -w "$ESSID"; then
    5.57 +				STATUS=connected
    5.58 +			else
    5.59 +				STATUS="-"
    5.60 +			fi
    5.61 +			echo -n ""
    5.62 +			echo "$ESSID | $QUALITY | $ENCRYPTION | $STATUS"
    5.63 +		done
    5.64 +	fi
    5.65 +}
    5.66 +
    5.67 +# cmdline functions
    5.68 +
    5.69 +# Toggle Software RF Switch on some laptops
    5.70 +set_rfswitch()
    5.71 +{
    5.72 +	for i in /proc/driver/acerhk/wirelessled /proc/acpi/asus/wled ; do
    5.73 +		[ -e $i ] && echo $1 > $i
    5.74 +	done
    5.75 +}
    5.76 +
    5.77 +# Configure /etc/network.conf and restart connection with init script.
    5.78 +start_wifi_connection()
    5.79 +{
    5.80 +	# Get tmp config created by connect_to_essid() if exists and set 
    5.81 +	# empty value to clean config file.
    5.82 +	if [ -f /tmp/wifi.conf ]; then
    5.83 +		. /tmp/wifi.conf
    5.84 +		WIFI_MODE=""
    5.85 +		WIFI_IWCONFIG_ARGS=""
    5.86 +		WIFI_CHANNEL=""
    5.87 +	fi
    5.88 +	sed -i "s/`grep ^WIFI= /etc/network.conf`/WIFI=\"yes\"/" \
    5.89 +		/etc/network.conf
    5.90 +	sed -i "s/`grep ^WIFI_INTERFACE= /etc/network.conf`/WIFI_INTERFACE=\"$WIFI_INTERFACE\"/" \
    5.91 +		/etc/network.conf
    5.92 +	sed -i "s/`grep ^WIFI_ESSID= /etc/network.conf`/WIFI_ESSID=\"$WIFI_ESSID\"/" \
    5.93 +		/etc/network.conf
    5.94 +	sed -i "s/`grep ^WIFI_KEY= /etc/network.conf`/WIFI_KEY=\"$WIFI_KEY\"/" \
    5.95 +		/etc/network.conf
    5.96 +	sed -i "s/`grep ^WIFI_MODE= /etc/network.conf`/WIFI_MODE=\"$WIFI_MODE\"/" \
    5.97 +		/etc/network.conf
    5.98 +	sed -i "s/`grep ^WIFI_IWCONFIG_ARGS= /etc/network.conf`/WIFI_IWCONFIG_ARGS=\"$WIFI_IWCONFIG_ARGS\"/" \
    5.99 +		/etc/network.conf
   5.100 +	sed -i "s/`grep ^WIFI_KEY_TYPE= /etc/network.conf`/WIFI_KEY_TYPE=\"$WIFI_KEY_TYPE\"/" \
   5.101 +		/etc/network.conf
   5.102 +	sed -i "s/`grep ^WIFI_CHANNEL= /etc/network.conf`/WIFI_CHANNEL=\"$WIFI_CHANNEL\"/" \
   5.103 +		/etc/network.conf	
   5.104 +	[ -s /var/run/udhcpc.$WIFI_INTERFACE.pid ] && kill `cat /var/run/udhcpc.$WIFI_INTERFACE.pid`
   5.105 +	ifconfig $WIFI_INTERFACE down
   5.106 +	set_rfswitch 1 
   5.107 +	iwconfig $WIFI_INTERFACE txpower auto
   5.108 +	/etc/init.d/network.sh restart
   5.109 +	# Remove tmp file (could be used to have wireless profiles)
   5.110 +	rm -f /tmp/wifi.conf
   5.111 +	sleep 2
   5.112 +}
   5.113 +
   5.114 +# We must sleep 4 sec to refresh networks list.
   5.115 +stop_wifi_connexion()
   5.116 +{
   5.117 +	sed -i s/`grep ^WIFI= /etc/network.conf`/WIFI=\"no\"/ \
   5.118 +		/etc/network.conf
   5.119 +	[ -x /etc/init.d/wpa_supplicant ] && /etc/init.d/wpa_supplicant stop
   5.120 +	ifconfig $WIFI_INTERFACE down
   5.121 +	iwconfig $WIFI_INTERFACE txpower off
   5.122 +	set_rfswitch 0 
   5.123 +	[ -s /var/run/udhcpc.$WIFI_INTERFACE.pid ] && kill `cat /var/run/udhcpc.$WIFI_INTERFACE.pid`
   5.124 +	sleep 2
   5.125 +}
   5.126 +
   5.127 +auto_connect_to_favorites_atboot()
   5.128 +{
   5.129 +	. $FAVORITES_WIFI/${FAVNET}.conf
   5.130 +	
   5.131 +	if grep -q "ssid=\"$FAVNET\"" /etc/wpa_supplicant.conf ; then
   5.132 +		# edit configuration
   5.133 +		sed -i "/start ${FAVNET}.conf/,/end ${FAVNET}.conf/s/[^_]ssid=.*/  ssid=\"$WIFI_ESSID\"/  " /etc/wpa_supplicant.conf
   5.134 +		sed -i "/start ${FAVNET}.conf/,/end ${FAVNET}.conf/s/psk=.*/psk=\"$WIFI_KEY\"/ " /etc/wpa_supplicant.conf
   5.135 +	else
   5.136 +		# add new configuration
   5.137 +		echo -e "
   5.138 +# start ${FAVNET}.conf configuration
   5.139 +network={ 
   5.140 +	ssid=\"$WIFI_ESSID\"
   5.141 +	scan_ssid=1 
   5.142 +	key_mgmt=WPA-EAP WPA-PSK IEEE8021X NONE 
   5.143 +	group=CCMP TKIP WEP104 WEP40 
   5.144 +	pairwise=CCMP TKIP 
   5.145 +	psk=\"$WIFI_KEY\" 
   5.146 +	priority=3  
   5.147 +} 
   5.148 +# end ${FAVNET}.conf configuration" >> /etc/wpa_supplicant.conf  
   5.149 +    fi
   5.150 +
   5.151 +}
   5.152 +
   5.153 +# Favorite wireless networks use only 3 values: essid. key and type of
   5.154 +# key
   5.155 +favorites_wifi_list()
   5.156 +{
   5.157 +	for i in $FAVORITES_WIFI/*.conf
   5.158 +	do
   5.159 +		WIFI_ESSID=""
   5.160 +		WIFI_KEY=""
   5.161 +		WIFI_KEY_TYPE=""
   5.162 +		. "$i"
   5.163 +		[ -z "$WIFI_ESSID" ] && WIFI_ESSID="Bad config file: $i"
   5.164 +		[ -z "$WIFI_KEY_TYPE" ] && WIFI_KEY_TYPE="-"
   5.165 +		if [ -n "$WIFI_KEY" ]; then
   5.166 +			WIFI_KEY="********"
   5.167 +		else
   5.168 +			WIFI_KEY="-"
   5.169 +		fi
   5.170 +		echo "$WIFI_ESSID | $WIFI_KEY_TYPE | $WIFI_KEY"
   5.171 +	done
   5.172 +}
   5.173 +
   5.174 +favorite_wifi_actions()
   5.175 +{
   5.176 +	cp -a $FAVORITES_WIFI/"$FAVORITE".conf /tmp/wifi.conf
   5.177 +	. /tmp/wifi.conf
   5.178 +	export CONNECT_FAVORITE="
   5.179 +<window title=\"Connect to: $WIFI_ESSID\" icon-name=\"network-wireless\">
   5.180 +<vbox>
   5.181 +	
   5.182 +	<text width-chars=\"54\">
   5.183 +		<label>
   5.184 +\"
   5.185 +ESSID name: $WIFI_ESSID
   5.186 +\"
   5.187 +		</label>
   5.188 +	</text>
   5.189 +	
   5.190 +	<hbox>
   5.191 +		<button>
   5.192 +			<label>Connect</label>
   5.193 +			<input file icon=\"forward\"></input>	
   5.194 +			<action>$0 start_wifi_connection</action>
   5.195 +			<action type=\"exit\">exit</action>
   5.196 +		</button>
   5.197 +		<button>
   5.198 +			<label>Edit settings</label>
   5.199 +			<input file icon=\"accessories-text-editor\"></input>	
   5.200 +			<action>leafpad $FAVORITES_WIFI/\"$FAVORITE\".conf</action>
   5.201 +			<action>rm -f /tmp/wifi.conf</action>					
   5.202 +		</button>
   5.203 +		<button>
   5.204 +			<label>Save Edits</label>
   5.205 +			<input file icon=\"document-save\"></input>	
   5.206 +			<action>export FAVNET=$WIFI_ESSID; $0 auto_connect_to_favorites_atboot</action>
   5.207 +			<action type=\"exit\">exit</action>					
   5.208 +		</button>
   5.209 +		<button>
   5.210 +			<label>Delete</label>
   5.211 +			<input file icon=\"gtk-delete\"></input>	
   5.212 +			<action>rm -f $FAVORITES_WIFI/\"$FAVORITE\".conf</action>
   5.213 +			<action>sed -i \"/start ${FAVORITE}.conf/,/end ${FAVORITE}.conf/d\" /etc/wpa_supplicant.conf</action>
   5.214 +			<action type=\"exit\">exit</action>
   5.215 +		</button>
   5.216 +		<button cancel></button>
   5.217 +	</hbox>
   5.218 +	
   5.219 +</vbox>
   5.220 +</window>"
   5.221 +	gtkdialog --center --program=CONNECT_FAVORITE >/dev/null
   5.222 +}
   5.223 +
   5.224 +add_favorite_network_box()
   5.225 +{
   5.226 +	ADD_FAVORITE='
   5.227 +<window title="Add new favorite Wireless" icon-name="network-wireless">
   5.228 +<vbox>
   5.229 +	<text width-chars="54">
   5.230 +		<label>
   5.231 +"
   5.232 +Please configure your new favorite Wireless network
   5.233 +"
   5.234 +		</label>
   5.235 +	</text>
   5.236 +	<hbox>
   5.237 +		<text use-markup="true">
   5.238 +			<label>"<b>ESSID:</b>"</label>
   5.239 +		</text>
   5.240 +		<entry>
   5.241 +			<variable>WIFI_ESSID</variable>
   5.242 +		</entry>
   5.243 +	</hbox>
   5.244 +	<hbox>
   5.245 +		<text use-markup="true">
   5.246 +			<label>"<b>Key:   </b>"</label>
   5.247 +		</text>
   5.248 +		<entry>
   5.249 +			<variable>WIFI_KEY</variable>
   5.250 +		</entry>
   5.251 +	</hbox>
   5.252 +	<hbox>
   5.253 +		<text use-markup="true">
   5.254 +			<label>"<b>Key type:</b>"</label>
   5.255 +		</text>
   5.256 +		<combobox>'
   5.257 +	tmp="${ADD_FAVORITE}<item>$WIFI_KEY_TYPE</item>"
   5.258 +	for i in none WEP WPA any; do
   5.259 +		tmp=${tmp}"<item>$i</item>"
   5.260 +	done
   5.261 +	export ADD_FAVORITE=${tmp}'
   5.262 +			<variable>WIFI_KEY_TYPE</variable>
   5.263 +		</combobox>
   5.264 +	</hbox>
   5.265 +	<hbox>
   5.266 +		<button>
   5.267 +			<label>Add to list</label>
   5.268 +			<input file icon="forward"></input>
   5.269 +			<action>echo "# Wireless connection configuration." > $FAVORITES_WIFI/"$WIFI_ESSID".conf</action>
   5.270 +			<action>echo "#" >> /etc/wireless/"$WIFI_ESSID".conf</action>
   5.271 +			<action>echo "WIFI_ESSID=\"$WIFI_ESSID\"" >> $FAVORITES_WIFI/"$WIFI_ESSID".conf</action>
   5.272 +			<action>echo "WIFI_KEY=\"$WIFI_KEY\"" >> $FAVORITES_WIFI/"$WIFI_ESSID".conf</action>
   5.273 +			<action>echo "WIFI_KEY_TYPE=\"$WIFI_KEY_TYPE\"" >> $FAVORITES_WIFI/"$WIFI_ESSID".conf</action>
   5.274 +			<action>export FAVNET=$WIFI_ESSID; $BIN auto_connect_to_favorites_atboot</action>
   5.275 +			<action type="exit">exit</action>
   5.276 +		</button>
   5.277 +		<button cancel></button>
   5.278 +	</hbox>
   5.279 +</vbox>
   5.280 +</window>'
   5.281 +	gtkdialog --center --program=ADD_FAVORITE #>/dev/null
   5.282 +}
   5.283 +
   5.284 +# GUI functions
   5.285 +
   5.286 +helpbutton()
   5.287 +{
   5.288 +	local label;
   5.289 +        label="<label>$3</label>"
   5.290 +	[ -n "$3" ] || label=""
   5.291 +	cat << EOT
   5.292 +<button>
   5.293 +	<input file icon="help"></input>$label
   5.294 +	<action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry $2 -title "$1 help" -e "$(which $1) --help ; echo -e \\"----\\nENTER to continue...\\" && read close"</action>
   5.295 +</button>
   5.296 +EOT
   5.297 +}
   5.298 +
   5.299 +manbutton()
   5.300 +{
   5.301 +	cat << EOT
   5.302 +<button>
   5.303 +	<input file icon="browser"></input>
   5.304 +	<label>man</label>
   5.305 +	<action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x24 -title "$2 man (q to quit)" -e ". /etc/profile; man $1 $2"</action>
   5.306 +</button>
   5.307 +EOT
   5.308 +}
   5.309 +
   5.310 +# Independent dialog to connect to a wireless network. If encryption
   5.311 +# is on we ask for the security key.
   5.312 +connect_to_essid()
   5.313 +{
   5.314 +	SCAN=`iwlist $WIFI_INTERFACE scan | \
   5.315 +		awk '/(Cell|ESS|Qual|Encry|IE: WPA)/ {print}' | \
   5.316 +		grep -B 1 -A 1 "$ESSID_LIST"`
   5.317 +	WIFI_ESSID="$ESSID_LIST"
   5.318 +	ENCRYPTION=`echo $SCAN | sed 's/.*key:\([^ ]*\).*/\1/'`
   5.319 +	# Create tmp file used by active_wifi_connexion()
   5.320 +	cat > /tmp/wifi.conf << _EOF_
   5.321 +# Wireless connexion configuration file.
   5.322 +WIFI_ESSID="$ESSID_LIST"
   5.323 +_EOF_
   5.324 +	CONNECT_ESSID="
   5.325 +<window title=\"Connect to: $WIFI_ESSID\" icon-name=\"network-wireless\">
   5.326 +<vbox>
   5.327 +	<text width-chars=\"54\">
   5.328 +		<label>
   5.329 +\"
   5.330 +Connect $WIFI_INTERFACE to: $WIFI_ESSID
   5.331 +\"
   5.332 +		</label>
   5.333 +	</text>"
   5.334 +	# We maybe need a key to connect
   5.335 +	if [ "$ENCRYPTION" = "on" ] && [ "$ESSID_LIST" != "any" ]; then
   5.336 +		# WPA
   5.337 +		if echo "$SCAN" | grep -q WPA; then
   5.338 +			echo 'WIFI_KEY_TYPE="WPA"' >> /tmp/wifi.conf
   5.339 +			CONNECT_ESSID=${CONNECT_ESSID}'
   5.340 +			<hbox>
   5.341 +				<text use-markup="true">
   5.342 +					<label>"<b>WPA Key:</b>"</label>
   5.343 +				</text>
   5.344 +				<entry>
   5.345 +					<input>. /etc/network.conf; echo "$WIFI_KEY"</input>
   5.346 +					<variable>WIFI_KEY</variable>
   5.347 +				</entry>
   5.348 +			</hbox>'
   5.349 +		else
   5.350 +			# WEP
   5.351 +			echo 'WIFI_KEY_TYPE="WEP"' >> /tmp/wifi.conf
   5.352 +			CONNECT_ESSID=${CONNECT_ESSID}'
   5.353 +			<hbox>
   5.354 +				<text use-markup="true">
   5.355 +					<label>"<b>WEP Key:</b>"</label>
   5.356 +				</text>
   5.357 +				<entry>
   5.358 +					<input>. /etc/network.conf; echo "$WIFI_KEY"</input>
   5.359 +					<variable>WIFI_KEY</variable>
   5.360 +				</entry>
   5.361 +			</hbox>'
   5.362 +		fi
   5.363 +	else
   5.364 +		# No encryption
   5.365 +		echo 'WIFI_KEY=""' >> /tmp/wifi.conf
   5.366 +		echo 'WIFI_KEY_TYPE=""' >> /tmp/wifi.conf
   5.367 +		start_wifi_connection
   5.368 +		exit 0
   5.369 +	fi
   5.370 +	# Add key to config file so active_wifi_connexion() can use it.
   5.371 +	# WIFI_KEY is not exported if we quote with --> "
   5.372 +	export CONNECT_ESSID=${CONNECT_ESSID}'
   5.373 +	<hbox>
   5.374 +		<button>
   5.375 +			<label>Connect</label>
   5.376 +			<input file icon="forward"></input>	
   5.377 +			<action>echo "WIFI_KEY=\"$WIFI_KEY\"" >> /tmp/wifi.conf</action>
   5.378 +			<action>$BIN start_wifi_connection</action>
   5.379 +			<action type="exit">exit</action>
   5.380 +		</button>
   5.381 +		<button cancel></button>
   5.382 +	</hbox>
   5.383 +</vbox>
   5.384 +</window>'
   5.385 +	gtkdialog --center --program=CONNECT_ESSID #>/dev/null
   5.386 +}
   5.387 +
   5.388 +# Wifibox start with Networks tab.
   5.389 +box()
   5.390 +{
   5.391 +	WIFI_DIALOG="
   5.392 +<window title=\"Wireless manager\" icon-name=\"network-wireless\">
   5.393 +<vbox>
   5.394 +	
   5.395 +	<notebook labels=\"Networks|Favorites|Configuration|Drivers\">
   5.396 +	
   5.397 +	<vbox>
   5.398 +		<tree icon=\"network-wireless\">
   5.399 +			<width>520</width><height>160</height>
   5.400 +			<variable>ESSID_LIST</variable>
   5.401 +			<label>ESSID|Quality|Encryption|Status</label>
   5.402 +			<input>$0 detect_wifi_networks</input>
   5.403 +			<item icon=\"network-wireless\">any | * | off | (auto-connect)</item>
   5.404 +			<action>$0 connect_to_essid</action>
   5.405 +			<action>refresh:ESSID_LIST</action>
   5.406 +			<action>refresh:WIFI_ESSID</action>
   5.407 +			<action>refresh:WIFI_KEY</action>
   5.408 +			<action>refresh:WIFI_KEY_TYPE</action>
   5.409 +		</tree>
   5.410 +		<hbox>
   5.411 +			<text width-chars=\"54\">
   5.412 +				<label>
   5.413 +\"Please double click on a network to connect or enter security key\"
   5.414 +				</label>
   5.415 +			</text>
   5.416 +			<button>
   5.417 +				<label>Refresh list</label>
   5.418 +				<input file icon=\"reload\"></input>
   5.419 +				<action>refresh:ESSID_LIST</action>
   5.420 +			</button>
   5.421 +		</hbox>
   5.422 +	</vbox>"
   5.423 +	
   5.424 +	
   5.425 +	# Favorite networks
   5.426 +	WIFI_DIALOG=${WIFI_DIALOG}"	
   5.427 +	<vbox>
   5.428 +	    <tree icon=\"network-wireless\">
   5.429 +			<width>500</width><height>160</height>
   5.430 +			<variable>FAVORITE</variable>
   5.431 +			<label>ESSID|Key Type|Key status</label>
   5.432 +			<input>$0 favorites_wifi_list</input>
   5.433 +			<item icon=\"network-wireless\">any | - | -</item>
   5.434 +			<action>$0 favorite_wifi_actions</action>
   5.435 +			<action>refresh:FAVORITE</action>
   5.436 +			<action>refresh:ESSID_LIST</action>
   5.437 +			<action>refresh:WIFI_ESSID</action>
   5.438 +			<action>refresh:WIFI_KEY</action>
   5.439 +			<action>refresh:WIFI_KEY_TYPE</action>
   5.440 +		</tree>
   5.441 +		<hbox>
   5.442 +			<text width-chars=\"65\">
   5.443 +				<label>
   5.444 +\"Favorite networks connect automatically when the computer is started           \"
   5.445 +				</label>
   5.446 +			</text>
   5.447 +		</hbox>
   5.448 +		<hbox>
   5.449 +			<text width-chars=\"50\">
   5.450 +				<label>
   5.451 +\"Please double click on a network to modify or remove it\"
   5.452 +				</label>
   5.453 +			</text>
   5.454 +			<button>
   5.455 +				<label>Add Network</label>
   5.456 +				<input file icon=\"gtk-add\"></input>
   5.457 +				<action>$0 add_favorite_network_box</action>
   5.458 +				<action>refresh:FAVORITE</action>
   5.459 +			</button>
   5.460 +		</hbox>
   5.461 +	</vbox>"
   5.462 +
   5.463 +	# Configuration tab
   5.464 +	WIFI_DIALOG=${WIFI_DIALOG}'
   5.465 +	<vbox>
   5.466 +		<frame Basic>
   5.467 +			<hbox>
   5.468 +				<text use-markup="true">
   5.469 +					<label>"<b>Interface:</b>"</label>
   5.470 +				</text>
   5.471 +				<entry>
   5.472 +					<input>. /etc/network.conf; echo "$WIFI_INTERFACE"</input>
   5.473 +					<variable>WIFI_INTERFACE</variable>
   5.474 +				</entry>
   5.475 +			</hbox>
   5.476 +			<hbox>
   5.477 +				<text use-markup="true">
   5.478 +					<label>"<b>ESSID:        </b>"</label>
   5.479 +				</text>
   5.480 +				<entry>
   5.481 +					<input>. /etc/network.conf; echo "$WIFI_ESSID"</input>
   5.482 +					<variable>WIFI_ESSID</variable>
   5.483 +				</entry>
   5.484 +			</hbox>
   5.485 +			<hbox>
   5.486 +				<text use-markup="true">
   5.487 +					<label>"<b>Key:           </b>"</label>
   5.488 +				</text>
   5.489 +				<entry>
   5.490 +					<input>. /etc/network.conf; echo "$WIFI_KEY"</input>
   5.491 +					<variable>WIFI_KEY</variable>
   5.492 +				</entry>
   5.493 +				<combobox>'
   5.494 +	tmp2="${WIFI_DIALOG}<item>$WIFI_KEY_TYPE</item>"
   5.495 +	for i in none WEP WPA any; do
   5.496 +		[ "$i" = "$WIFI_KEY_TYPE" ] || tmp2="$tmp2<item>$i</item>"
   5.497 +	done
   5.498 +	tmp3='		<variable>WIFI_KEY_TYPE</variable>
   5.499 +				</combobox>
   5.500 +			</hbox>
   5.501 +		</frame>
   5.502 +		<frame Advanced>
   5.503 +			<hbox>
   5.504 +				<text use-markup="true">
   5.505 +					<label>"<b>Channel/Mode:</b>"</label>
   5.506 +				</text>
   5.507 +				<entry>
   5.508 +					<input>. /etc/network.conf; echo "$WIFI_CHANNEL"</input>
   5.509 +					<variable>WIFI_CHANNEL</variable>
   5.510 +				</entry>
   5.511 +				
   5.512 +				<combobox>
   5.513 +					<variable>WIFI_MODE</variable>'
   5.514 +	tmp2="$tmp2$tmp3<item>$WIFI_MODE</item>"
   5.515 +	for i in managed ad-hoc master repeater secondary monitor; do
   5.516 +		[ "$i" = "$WIFI_MODE" ] || tmp2="$tmp2<item>$i</item>"
   5.517 +	done
   5.518 +	tmp3='		</combobox>
   5.519 +			</hbox>
   5.520 +			<hbox>
   5.521 +				<text use-markup="true">
   5.522 +					<label>"<b>Iwconfig args:</b> "</label>
   5.523 +				</text>
   5.524 +				<entry>
   5.525 +					<input>. /etc/network.conf; echo "$WIFI_IWCONFIG_ARGS"</input>
   5.526 +					<variable>WIFI_IWCONFIG_ARGS</variable>
   5.527 +				</entry>'
   5.528 +	WIFI_DIALOG="$tmp$tmp2$tmp3
   5.529 +	$(helpbutton iwconfig 80x24)
   5.530 +	$(manbutton 8 iwconfig)
   5.531 +			</hbox>
   5.532 +		</frame>"
   5.533 +		
   5.534 +	# Start Button for manual configuration.
   5.535 +	WIFI_DIALOG=${WIFI_DIALOG}'
   5.536 +		<hbox>
   5.537 +		   <button>
   5.538 +				<label>Save to Favorites</label>
   5.539 +				<input file icon="document-save"></input>
   5.540 +				<action>echo "# Wireless connection configuration." > $FAVORITES_WIFI/"$WIFI_ESSID".conf</action>
   5.541 +				<action>echo "#" >> /etc/wireless/"$WIFI_ESSID".conf</action>
   5.542 +				<action>echo "WIFI_ESSID=\"$WIFI_ESSID\"" >> $FAVORITES_WIFI/"$WIFI_ESSID".conf</action>
   5.543 +				<action>echo "WIFI_KEY=\"$WIFI_KEY\"" >> $FAVORITES_WIFI/"$WIFI_ESSID".conf</action>
   5.544 +				<action>echo "WIFI_KEY_TYPE=\"$WIFI_KEY_TYPE\"" >> $FAVORITES_WIFI/"$WIFI_ESSID".conf</action>
   5.545 +				<action>export FAVNET=$WIFI_ESSID; $BIN auto_connect_to_favorites_atboot</action>	
   5.546 +				<action>refresh:FAVORITE</action>
   5.547 +			</button>
   5.548 +			<button>
   5.549 +				<label>Start connection</label>
   5.550 +				<input file icon="forward"></input>
   5.551 +				<action>[ "$WIFI_KEY_TYPE" = "WPA" -a ! -x /usr/bin/wpa_supplicant ] && xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x17 -title "wpa_supplicant install" -e "tazpkg get-install wpa_supplicant ; echo -e \"----\n\nENTER to continue...\" && read close"</action>
   5.552 +				<action>sed -i s/`grep ^WIFI= /etc/network.conf`/WIFI=\"yes\"/ /etc/network.conf</action>
   5.553 +				<action>sed -i s/`grep ^WIFI_INTERFACE= /etc/network.conf`/WIFI_INTERFACE=\"$WIFI_INTERFACE\"/ /etc/network.conf</action>
   5.554 +				<action>sed -i s/`grep ^WIFI_ESSID= /etc/network.conf`/WIFI_ESSID=\"$WIFI_ESSID\"/ /etc/network.conf</action>
   5.555 +				<action>sed -i s/`grep ^WIFI_KEY= /etc/network.conf`/WIFI_KEY=\"$WIFI_KEY\"/ /etc/network.conf</action>
   5.556 +				<action>sed -i s/`grep ^WIFI_MODE= /etc/network.conf`/WIFI_MODE=\"$WIFI_MODE\"/ /etc/network.conf</action>
   5.557 +				<action>sed -i "s/`grep ^WIFI_IWCONFIG_ARGS= /etc/network.conf`/WIFI_IWCONFIG_ARGS=\"$WIFI_IWCONFIG_ARGS\"/" /etc/network.conf</action>
   5.558 +				<action>sed -i s/`grep ^WIFI_KEY_TYPE= /etc/network.conf`/WIFI_KEY_TYPE=\"$WIFI_KEY_TYPE\"/ /etc/network.conf</action>
   5.559 +				<action>sed -i s/`grep ^WIFI_CHANNEL= /etc/network.conf`/WIFI_CHANNEL=\"$WIFI_CHANNEL\"/ /etc/network.conf</action>
   5.560 +				<action>[ -s /var/run/udhcpc.$WIFI_INTERFACE.pid ] && kill `cat /var/run/udhcpc.$WIFI_INTERFACE.pid`</action>
   5.561 +				<action>ifconfig $WIFI_INTERFACE down</action>
   5.562 +				<action>iwconfig $WIFI_INTERFACE txpower auto</action>
   5.563 +				<action>/etc/init.d/network.sh restart</action>
   5.564 +				<action>refresh:ESSID_LIST</action>
   5.565 +				<action>refresh:WIFI_ESSID</action>
   5.566 +				<action>refresh:WIFI_KEY</action>
   5.567 +				<action>refresh:WIFI_KEY_TYPE</action>
   5.568 +			</button>
   5.569 +		</hbox>
   5.570 +	</vbox>'
   5.571 +
   5.572 +	# Kernel Modules, firmware and tazndisbox note + button.
   5.573 +	WIFI_DIALOG=${WIFI_DIALOG}"
   5.574 +	<vbox>
   5.575 +		<hbox>
   5.576 +			<text width-chars=\"64\">
   5.577 +				<label>
   5.578 +\"
   5.579 +Some Wireless Adapters need non-free firmware. Please install the
   5.580 +firmware before loading the corresponding module. Note that you can use 
   5.581 +Tazhw to automatically detect your PCI, PCMCIA or USB Wireless adapter.
   5.582 +\"
   5.583 +				</label>
   5.584 +			</text>
   5.585 +		</hbox>
   5.586 +		<hbox>
   5.587 +			<text use-markup=\"true\">
   5.588 +				<label>\"<b>Tools:</b>\"</label>
   5.589 +			</text>
   5.590 +			<button>
   5.591 +				<input file icon=\"computer\"></input>
   5.592 +				<label>Auto detect devices</label>
   5.593 +				<action>tazhw box</action>
   5.594 +				<action>refresh:ESSID_LIST</action>
   5.595 +			</button>"
   5.596 +			# Display firmware stuff, tazndisbox button if installed and close 
   5.597 +			# tab + notebook
   5.598 +			if [ -x /usr/bin/tazndisbox ]; then
   5.599 +				WIFI_DIALOG=${WIFI_DIALOG}"
   5.600 +			<button>
   5.601 +				<input file icon=\"system-installer\"></input>
   5.602 +				<label>Install Windows driver</label>
   5.603 +				<action>tazndisbox</action>
   5.604 +				<action>refresh:ESSID_LIST</action>
   5.605 +			</button>"
   5.606 +			fi
   5.607 +		WIFI_DIALOG=${WIFI_DIALOG}"
   5.608 +		</hbox>
   5.609 +		<hbox>
   5.610 +			<text use-markup=\"true\">
   5.611 +				<label>\"<b>Module:</b>\"</label>
   5.612 +			</text>
   5.613 +			<combobox>
   5.614 +				<variable>MODULE</variable>"
   5.615 +	WIFI_DIALOG="${WIFI_DIALOG}$(find /lib/modules/$(uname -r)/kernel/drivers/net/wireless -type f 2> /dev/null |  sed 's,/.*/\(.*\).ko.*,<item>\1</item>,')"
   5.616 +	WIFI_DIALOG=${WIFI_DIALOG}'
   5.617 +			</combobox>
   5.618 +			<button>
   5.619 +				<label>Load</label>
   5.620 +				<input file icon="forward"></input>
   5.621 +				<action>modprobe $MODULE</action>
   5.622 +			</button>
   5.623 +			<button>
   5.624 +				<label>Unload</label>
   5.625 +				<input file icon="undo"></input>
   5.626 +				<action>modprobe -r $MODULE</action>
   5.627 +			</button>
   5.628 +			<button>
   5.629 +				<label>Lsmod</label>
   5.630 +				<input file icon="computer"></input>
   5.631 +				<action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x25 -title "Modules (q to quit)" -e "lsmod | less"</action>
   5.632 +			</button>
   5.633 +		</hbox>'
   5.634 +	# Firmware stuff.
   5.635 +	tmp=$(for i in /usr/bin/get*firmware; do
   5.636 +		[ -x $i ] || continue
   5.637 +		[ "$i" = "/usr/bin/get-wifi-firmware" ] && continue
   5.638 +		[ -d /var/lib/tazpkg/installed/${i#/usr/bin/get-} ] && continue
   5.639 +		echo "<item>${i#/usr/bin/get-}</item>"; done)
   5.640 +		[ -n "$tmp" ] && tmp="
   5.641 +		<hbox>
   5.642 +			<text use-markup=\"true\">
   5.643 +				<label>\"<b>Firmware:</b>\"</label>
   5.644 +			</text>
   5.645 +			<combobox><variable>FIRMWARE</variable>$tmp</combobox>
   5.646 +			<button>
   5.647 +				<label>Install</label>
   5.648 +				<input file icon=\"go-jump\"></input>
   5.649 +				<action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x25 -title \"Install \$FIRMWARE\" -e \"get-\$FIRMWARE\"</action>
   5.650 +				<action>refresh:ESSID_LIST</action>
   5.651 +			</button>
   5.652 +			<button>
   5.653 +				<input file icon=\"system-file-manager\"></input>
   5.654 +				<label>List files</label>
   5.655 +				<action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 100x25 -title \"Firmware files (q to quit)\" -e \"find /lib/firmware -exec ls -ld {} \; | less\"</action>
   5.656 +				<action>refresh:ESSID_LIST</action>
   5.657 +			</button>
   5.658 +		</hbox>"
   5.659 +
   5.660 +# Bottom buttons
   5.661 +export WIFI_DIALOG=${WIFI_DIALOG}${tmp}"
   5.662 +		</vbox>
   5.663 +	</notebook>
   5.664 +	<hbox>
   5.665 +		<button>
   5.666 +			<label>Stop connection</label>
   5.667 +			<input file icon=\"stop\"></input>
   5.668 +			<action>$0 stop_wifi_connexion</action>
   5.669 +			<action>refresh:ESSID_LIST</action>
   5.670 +		</button>
   5.671 +		<button>
   5.672 +			<label>Exit</label>
   5.673 +			<input file icon=\"exit\"></input>
   5.674 +			<action type=\"exit\">Exit</action>
   5.675 +		</button>
   5.676 +	</hbox>
   5.677 +	
   5.678 +</vbox>
   5.679 +</window>"
   5.680 +	gtkdialog --center --program=WIFI_DIALOG #>/dev/null 2>&1
   5.681 +}
   5.682 +
   5.683 +if [ -n "$1" ]; then
   5.684 +	$1
   5.685 +else
   5.686 +	box
   5.687 +fi
   5.688 +
   5.689 +exit 0
     6.1 --- a/oldstuff/subox	Sat Apr 28 20:11:25 2012 +0200
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,114 +0,0 @@
     6.4 -#!/bin/sh
     6.5 -#
     6.6 -# Gtkdialog to execute program as root from a WM menu.
     6.7 -# (c) SliTaz GNU/Linux 2008-2010 - GNU gpl.
     6.8 -#
     6.9 -VERSION=20100324
    6.10 -
    6.11 -# Usage.
    6.12 -if [ -z "$1" ]; then
    6.13 -    echo "Slitaz subox version : $VERSION"
    6.14 -    echo -e "\nUsage : subox program\n"
    6.15 -    exit 0
    6.16 -fi
    6.17 -
    6.18 -# Nothing to do if we are root
    6.19 -test $(id -u) = 0 && exec $1
    6.20 -
    6.21 -# Include gettext helper script.
    6.22 -. /usr/bin/gettext.sh
    6.23 -
    6.24 -# Export package name for gettext.
    6.25 -TEXTDOMAIN='subox'
    6.26 -export TEXTDOMAIN
    6.27 -
    6.28 -# Keep command in an exported variable to be used by SU_DIALOG.
    6.29 -export SU_CMD=$1
    6.30 -
    6.31 -# Error window if the pwd is wrong.
    6.32 -export ERROR_DIALOG='
    6.33 -<window title="Subox">
    6.34 -  <vbox>
    6.35 -
    6.36 -    <text use-markup="true">
    6.37 -      <label>"
    6.38 -<b>SliTaz - Subox</b>"
    6.39 -      </label>
    6.40 -    </text>
    6.41 -    <text wrap="true" width-chars="48">
    6.42 -	<label>"'`gettext "Error: wrong password!"`'"</label>
    6.43 -    </text>
    6.44 -
    6.45 -    <hbox>
    6.46 -      <button ok></button>
    6.47 -    </hbox>
    6.48 -</vbox>
    6.49 -</window>
    6.50 -'
    6.51 -
    6.52 -# Main window and root password default entry set to 'root'.
    6.53 -SU_DIALOG='
    6.54 -<window title="Subox" skip_taskbar_hint="true">
    6.55 -<vbox>
    6.56 -
    6.57 -	<text use-markup="true">
    6.58 -		<label>"
    6.59 -<b>SliTaz - Subox</b>"
    6.60 -		</label>
    6.61 -	</text>
    6.62 -	<text wrap="true" width-chars="50">
    6.63 -		<label>"'`gettext "
    6.64 -Please enter root password (default root) to execute :"`'
    6.65 -'$@'
    6.66 -"
    6.67 -		</label>
    6.68 -	</text>
    6.69 -	
    6.70 -	<hbox>
    6.71 -		<text use-markup="true">
    6.72 -			<label>"'`gettext "<b>Admin password :</b>"`'"</label>
    6.73 -		</text>
    6.74 -		<entry visibility="false">'
    6.75 -
    6.76 -# Check if we have a saved passwd.
    6.77 -if [ -s $HOME/.config/slitaz/subox.conf ]; then
    6.78 -	PASSWD=`cat $HOME/.config/slitaz/subox.conf`
    6.79 -	[ -n "$PASSWD" ] && SU_DIALOG="$SU_DIALOG <default>$PASSWD</default>" && AUTO_SAVED_PASSWD=true
    6.80 -else 
    6.81 -AUTO_SAVED_PASSWD=false
    6.82 -fi
    6.83 -
    6.84 -export SU_DIALOG=''${SU_DIALOG}'
    6.85 -			<variable>PASSWD</variable>
    6.86 -		</entry>
    6.87 -	</hbox>
    6.88 -	
    6.89 -	<hbox>
    6.90 -		<checkbox>
    6.91 -			
    6.92 -			<label>"'`gettext "Autosave password"`'"</label>
    6.93 -			<variable>AUTOSAVE</variable>'
    6.94 -if [ $AUTO_SAVED_PASSWD = "true" ]
    6.95 -	then SU_DIALOG="$SU_DIALOG <default>true</default>"
    6.96 -	else SU_DIALOG="$SU_DIALOG <default>false</default>"
    6.97 -fi
    6.98 -
    6.99 -export SU_DIALOG=''${SU_DIALOG}'
   6.100 -			
   6.101 -		</checkbox>
   6.102 -		<button ok>
   6.103 -			<action> echo $PASSWD | su -c "$SU_CMD &" || gtkdialog --center --program=ERROR_DIALOG</action>
   6.104 -			<action>[ $AUTOSAVE == true ] && echo $PASSWD > '$HOME/.config/slitaz/subox.conf'</action>
   6.105 -			<action>[ $AUTOSAVE == true ] && chmod 0600 '$HOME/.config/slitaz/subox.conf'</action>
   6.106 -			<action>[ $AUTOSAVE == false ] && cat /dev/null > '$HOME/.config/slitaz/subox.conf'</action>
   6.107 -			<action type="closewindow">SU_DIALOG</action>
   6.108 -		</button>
   6.109 -		<button cancel></button>
   6.110 -	</hbox>
   6.111 -
   6.112 -</vbox>
   6.113 -</window>'
   6.114 -
   6.115 -gtkdialog --center --program=SU_DIALOG > /dev/null
   6.116 -
   6.117 -exit 0
     7.1 --- a/oldstuff/subox.pot	Sat Apr 28 20:11:25 2012 +0200
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,36 +0,0 @@
     7.4 -# SOME DESCRIPTIVE TITLE.
     7.5 -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
     7.6 -# This file is distributed under the same license as the PACKAGE package.
     7.7 -# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
     7.8 -#
     7.9 -#, fuzzy
    7.10 -msgid ""
    7.11 -msgstr ""
    7.12 -"Project-Id-Version: subox\n"
    7.13 -"Report-Msgid-Bugs-To: \n"
    7.14 -"POT-Creation-Date: 2011-04-29 18:20+0200\n"
    7.15 -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    7.16 -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
    7.17 -"Language-Team: LANGUAGE <LL@li.org>\n"
    7.18 -"Language: \n"
    7.19 -"MIME-Version: 1.0\n"
    7.20 -"Content-Type: text/plain; charset=CHARSET\n"
    7.21 -"Content-Transfer-Encoding: 8bit\n"
    7.22 -
    7.23 -#: tinyutils/subox:39
    7.24 -msgid "Error: wrong password!"
    7.25 -msgstr ""
    7.26 -
    7.27 -#: tinyutils/subox:60
    7.28 -msgid ""
    7.29 -"\n"
    7.30 -"Please enter root password (default root) to execute :"
    7.31 -msgstr ""
    7.32 -
    7.33 -#: tinyutils/subox:69
    7.34 -msgid "<b>Admin password :</b>"
    7.35 -msgstr ""
    7.36 -
    7.37 -#: tinyutils/subox:89
    7.38 -msgid "Autosave password"
    7.39 -msgstr ""
     8.1 --- a/oldstuff/tazctrlbox	Sat Apr 28 20:11:25 2012 +0200
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,563 +0,0 @@
     8.4 -#!/bin/sh
     8.5 -#
     8.6 -# SliTaz Control Box is a tool to configure and manage a SliTaz system.
     8.7 -# The script uses GTKdialog for the UI interface. Some shell functions
     8.8 -# are called by argument. Individual window dialogs are put into 
     8.9 -# functions.
    8.10 -#
    8.11 -# (C) GNU gpl v3 - SliTaz GNU/Linux 2010.
    8.12 -# Author: Christophe Lincoln <pankso@slitaz.org>
    8.13 -#
    8.14 -VERSION=1.1
    8.15 -
    8.16 -# Include gettext helper script.
    8.17 -. /usr/bin/gettext.sh
    8.18 -
    8.19 -# Export package name for gettext.
    8.20 -TEXTDOMAIN='tazctrlbox'
    8.21 -export TEXTDOMAIN
    8.22 -
    8.23 -# Get init configuration.
    8.24 -. /etc/rcS.conf
    8.25 -
    8.26 -# Tazctrlbox is only for root.
    8.27 -if test $(id -u) != 0 ; then
    8.28 -	exec subox $0
    8.29 -	exit 0
    8.30 -fi
    8.31 -
    8.32 -# By default autologin is not configured on an installed system.
    8.33 -if ! grep -q 'auto_login' /etc/slim.conf; then
    8.34 -	echo '# Auto login default user' >> /etc/slim.conf
    8.35 -	echo 'auto_login          no' >> /etc/slim.conf
    8.36 -fi
    8.37 -
    8.38 -# Change Grub menu.lst timeout.
    8.39 -sed_grub_timeout()
    8.40 -{
    8.41 -	CURRENT=`cat /boot/grub/menu.lst | grep ^timeout | cut -d " " -f2`
    8.42 -	sed -i s/"timeout $CURRENT"/"timeout $GRUB_TIMEOUT"/ /boot/grub/menu.lst
    8.43 -}
    8.44 -
    8.45 -# Change Grub menu.lst timeout.
    8.46 -sed_grub_color()
    8.47 -{
    8.48 -	CURRENT=`cat /boot/grub/menu.lst | grep ^color | cut -d " " -f2-3`
    8.49 -	sed -i s#"color $CURRENT"#"color $GRUB_COLOR"# /boot/grub/menu.lst
    8.50 -}
    8.51 -
    8.52 -# Set check fs on boot.
    8.53 -sed_check_fs()
    8.54 -{
    8.55 -	sed -i s#"CHECK_FS=\"$CHECK_FS\""#"CHECK_FS=\"$NEW_CHECK_FS\""# \
    8.56 -		/etc/rcS.conf
    8.57 -}
    8.58 -
    8.59 -# Set loaded modules on boot.
    8.60 -sed_load_modules()
    8.61 -{
    8.62 -	sed -i s/"LOAD_MODULES=\"$LOAD_MODULES\""/"LOAD_MODULES=\"$NEW_MODULES\""/ \
    8.63 -		/etc/rcS.conf
    8.64 -}
    8.65 -
    8.66 -# Set daemons to run on boot.
    8.67 -sed_run_daemons()
    8.68 -{
    8.69 -	sed -i s/"RUN_DAEMONS=\"$RUN_DAEMONS\""/"RUN_DAEMONS=\"$NEW_DAEMONS\""/ \
    8.70 -		/etc/rcS.conf
    8.71 -}
    8.72 -
    8.73 -# Get user list.
    8.74 -get_users()
    8.75 -{
    8.76 -	for i in `cat /etc/passwd | cut -d ":" -f 1`
    8.77 -	do
    8.78 -		if [ -d /home/$i ]; then
    8.79 -			login=$i
    8.80 -			uid=`cat /etc/passwd | grep $i | cut -d ":" -f 3`
    8.81 -			gid=`cat /etc/passwd | grep $i | cut -d ":" -f 4`
    8.82 -			name=`cat /etc/passwd | grep $i | cut -d ":" -f 5 | sed s/,,,//`
    8.83 -			home=`cat /etc/passwd | grep $i | cut -d ":" -f 6`
    8.84 -			shell=`cat /etc/passwd | grep $i | cut -d ":" -f 7`
    8.85 -			echo "system-users | $login | $uid:$gid | $name | $home | $shell"
    8.86 -		fi
    8.87 -	done
    8.88 -}
    8.89 -
    8.90 -# Remove a user or change passwd.
    8.91 -manage_user()
    8.92 -{
    8.93 -	export MANAGE_DIALOG="
    8.94 -<window title=\"`gettext "Manage user: "`$USER\" icon-name=\"computer\">
    8.95 -	<vbox>
    8.96 -		<vbox>
    8.97 -			<text wrap=\"false\" width-chars=\"34\">
    8.98 -				<label>\"
    8.99 -Login name: $USER
   8.100 -				\"</label>
   8.101 -			</text>
   8.102 -		</vbox>
   8.103 -		<hbox>
   8.104 -			<text wrap=\"false\">
   8.105 -				<label>\"`gettext "New password:"`\"</label>
   8.106 -			</text>
   8.107 -			<entry invisible_char=\"*\" visibility=\"false\" max_length=\"8\">
   8.108 -				<variable>PASSWD</variable>
   8.109 -			</entry>
   8.110 -			<button>
   8.111 -				<label>Change</label>
   8.112 -				<input file icon=\"forward\"></input>
   8.113 -				<action>echo \"$USER:$PASSWD\" | chpasswd -m</action>
   8.114 -				<action type=\"closewindow\">MANAGE_USER</action>
   8.115 -			</button>
   8.116 -		</hbox>
   8.117 -		<hbox>
   8.118 -			<button>
   8.119 -				<label>`gettext "Delete user"`</label>
   8.120 -				<input file icon=\"gtk-delete\"></input>
   8.121 -				<action>deluser $USER</action>
   8.122 -				<action type=\"closewindow\">MANAGE_USER</action>
   8.123 -			</button>
   8.124 -			<button cancel>
   8.125 -				<action type=\"closewindow\">MANAGE_USER</action>
   8.126 -			</button>
   8.127 -		</hbox>
   8.128 -	</vbox>
   8.129 -</window>
   8.130 -"
   8.131 -	gtkdialog --center --program=MANAGE_DIALOG >/dev/null
   8.132 -}
   8.133 -
   8.134 -# Add a new user.
   8.135 -add_user()
   8.136 -{
   8.137 -	export ADD_USER_DIALOG='
   8.138 -<window title="New user" icon-name="gtk-add">
   8.139 -	<vbox>
   8.140 -		<vbox>
   8.141 -			<text wrap="false" width-chars="34">
   8.142 -				<label>"'`gettext "
   8.143 -New account information"`'
   8.144 -				"</label>
   8.145 -			</text>
   8.146 -		</vbox>
   8.147 -		<hbox>
   8.148 -			<text wrap="false">
   8.149 -				<label>"'`gettext "Login:"`'      "</label>
   8.150 -			</text>
   8.151 -			<entry>
   8.152 -				<variable>NEW_USER</variable>
   8.153 -			</entry>
   8.154 -		</hbox>
   8.155 -		<hbox>
   8.156 -			<text wrap="false">
   8.157 -				<label>"'`gettext "Password:"`'"</label>
   8.158 -			</text>
   8.159 -			<entry invisible_char="*" visibility="false" max_length="8">
   8.160 -				<variable>PASSWD</variable>
   8.161 -			</entry>
   8.162 -		</hbox>
   8.163 -		<hbox>
   8.164 -			<button ok>
   8.165 -				<action>adduser -D $NEW_USER</action>
   8.166 -				<action>echo "$NEW_USER:$PASSWD" | chpasswd -m</action>
   8.167 -				<action>addgroup $NEW_USER audio</action>
   8.168 -				<action>addgroup $NEW_USER cdrom</action>
   8.169 -				<action>addgroup $NEW_USER floppy</action>
   8.170 -				<action>addgroup $NEW_USER video</action>
   8.171 -				<action>rmdir /home/$NEW_USER</action>
   8.172 -				<action>cp -a /etc/skel /home/$NEW_USER</action>
   8.173 -				<action>cp /root/.xinitrc /home/$NEW_USER</action>
   8.174 -				<action>mkdir -p /home/$NEW_USER/.config/slitaz</action>
   8.175 -				<action>cp -a /etc/slitaz/applications.conf /home/$NEW_USER/.config/slitaz</action>
   8.176 -				<action>chown -R $NEW_USER:$NEW_USER /home/$NEW_USER</action>
   8.177 -				<action type="closewindow">MANAGE_USER</action>
   8.178 -			</button>
   8.179 -			<button cancel>
   8.180 -				<action type="closewindow">MANAGE_USER</action>
   8.181 -			</button>
   8.182 -		</hbox>
   8.183 -	</vbox>
   8.184 -</window>
   8.185 -'
   8.186 -	gtkdialog --center --program=ADD_USER_DIALOG >/dev/null	
   8.187 -}
   8.188 -
   8.189 -# i18n functions.
   8.190 -list_locales()
   8.191 -{
   8.192 -	cd /usr/share/i18n/locales
   8.193 -	for locale in `ls -1 [a-z][a-z]_[A-Z][A-Z]`
   8.194 -	do
   8.195 -		echo "preferences-desktop-locale | $locale | UTF-8"
   8.196 -	done
   8.197 -}
   8.198 -gen_utf8_locale()
   8.199 -{
   8.200 -	rm -rf /usr/lib/locale/$LANGUAGE
   8.201 -	localedef -i $LANGUAGE -c -f UTF-8 /usr/lib/locale/$LANGUAGE
   8.202 -	# System configuration
   8.203 -	echo "LANG=$LANGUAGE" > /etc/locale.conf
   8.204 -	echo "LC_ALL=$LANGUAGE" >> /etc/locale.conf
   8.205 -}
   8.206 -
   8.207 -# Main dialog with notebook.
   8.208 -#
   8.209 -export MAIN_DIALOG='
   8.210 -<window title="'`gettext "SliTaz Control Box"`'" icon-name="computer">
   8.211 -<vbox>
   8.212 -
   8.213 -	<hbox>
   8.214 -		<text use-markup="true">
   8.215 -			<label>"'`gettext "<b>SliTaz Control Box</b>"`'"</label>
   8.216 -		</text>
   8.217 -		<pixmap>
   8.218 -			<input file>/usr/share/pixmaps/tazctrlbox.png</input>
   8.219 -		</pixmap>
   8.220 -	</hbox>
   8.221 -
   8.222 -	<notebook labels="'`gettext "Boot loader|Initialization|Login manager|Time|Language|Users"`'">'
   8.223 -	
   8.224 -# GRUB.
   8.225 -MAIN_DIALOG=${MAIN_DIALOG}"
   8.226 -	<vbox>
   8.227 -		<frame `gettext "Grub boot loader"`>
   8.228 -			<hbox>
   8.229 -				<text wrap=\"false\">
   8.230 -					<label>\"`gettext "Timeout:"`\"</label>
   8.231 -				</text>
   8.232 -				<entry>
   8.233 -					<input>cat /boot/grub/menu.lst | grep ^timeout | cut -d \" \" -f2</input>
   8.234 -					<variable>GRUB_TIMEOUT</variable>
   8.235 -				</entry>
   8.236 -				<button>
   8.237 -					<label>`gettext "Change"`</label>
   8.238 -					<input file icon=\"forward\"></input>
   8.239 -					<action>$0 sed_grub_timeout</action>
   8.240 -				</button>
   8.241 -			</hbox>
   8.242 -			<hbox>
   8.243 -				<text wrap=\"false\">
   8.244 -					<label>\"`gettext "Color:"`    \"</label>
   8.245 -				</text>
   8.246 -				<entry>
   8.247 -					<input>cat /boot/grub/menu.lst | grep ^color | cut -d \" \" -f2-3</input>
   8.248 -					<variable>GRUB_COLOR</variable>
   8.249 -				</entry>
   8.250 -				<button>
   8.251 -					<label>`gettext "Change"`</label>
   8.252 -					<input file icon=\"forward\"></input>
   8.253 -					<action>$0 sed_grub_color</action>
   8.254 -				</button>
   8.255 -			</hbox>
   8.256 -			<hbox>
   8.257 -				<text wrap=\"false\">
   8.258 -					<label>\"`gettext "Configuration file:"`\"</label>
   8.259 -				</text>
   8.260 -				<button>
   8.261 -					<label>/boot/grub/menu.lst</label>
   8.262 -					<input file icon=\"accessories-text-editor\"></input>
   8.263 -					<action>leafpad /boot/grub/menu.lst</action>
   8.264 -					<action>refresh:GRUB_COLOR</action>
   8.265 -					<action>refresh:GRUB_TIMEOUT</action>
   8.266 -				</button>
   8.267 -			</hbox>
   8.268 -		</frame>
   8.269 -	</vbox>"
   8.270 -# Init script.
   8.271 -MAIN_DIALOG=${MAIN_DIALOG}"
   8.272 -	<vbox>
   8.273 -		<frame `gettext "rcS init scripts"`>
   8.274 -			<hbox>
   8.275 -				<text wrap=\"false\">
   8.276 -					<label>\"`gettext "Check filesystems:"`\"</label>
   8.277 -				</text>
   8.278 -				<entry>
   8.279 -					<input>echo $CHECK_FS</input>
   8.280 -					<variable>NEW_CHECK_FS</variable>
   8.281 -				</entry>
   8.282 -				<button>
   8.283 -					<label>Change</label>
   8.284 -					<input file icon=\"forward\"></input>
   8.285 -					<action>$0 sed_check_fs</action>
   8.286 -				</button>
   8.287 -			</hbox>
   8.288 -			<hbox>
   8.289 -				<text wrap=\"false\">
   8.290 -					<label>\"`gettext "Load modules:"`      \"</label>
   8.291 -				</text>
   8.292 -				<entry>
   8.293 -					<input>echo $LOAD_MODULES</input>
   8.294 -					<variable>NEW_MODULES</variable>
   8.295 -				</entry>
   8.296 -				<button>
   8.297 -					<label>`gettext "Change"`</label>
   8.298 -					<input file icon=\"forward\"></input>
   8.299 -					<action>$0 sed_load_modules</action>
   8.300 -				</button>
   8.301 -			</hbox>
   8.302 -			<hbox>
   8.303 -				<text wrap=\"false\">
   8.304 -					<label>\"`gettext "Run daemons:"`       \"</label>
   8.305 -				</text>
   8.306 -				<entry>
   8.307 -					<input>echo $RUN_DAEMONS</input>
   8.308 -					<variable>NEW_DAEMONS</variable>
   8.309 -				</entry>
   8.310 -				<button>
   8.311 -					<label>`gettext "Change"`</label>
   8.312 -					<input file icon=\"forward\"></input>
   8.313 -					<action>$0 sed_run_daemons</action>
   8.314 -				</button>
   8.315 -			</hbox>
   8.316 -			<hbox>
   8.317 -				<text wrap=\"false\">
   8.318 -					<label>\"`gettext "Add local commands:"`\"</label>
   8.319 -				</text>
   8.320 -				<button>
   8.321 -					<label>/etc/init.d/local.sh</label>
   8.322 -					<input file icon=\"accessories-text-editor\"></input>
   8.323 -					<action>leafpad /etc/init.d/local.sh</action>
   8.324 -				</button>
   8.325 -			</hbox>
   8.326 -		</frame>
   8.327 -	</vbox>"
   8.328 -# Slim login.
   8.329 -MAIN_DIALOG=${MAIN_DIALOG}'
   8.330 -	<vbox>
   8.331 -		<frame '`gettext "Slim settings"`'>
   8.332 -			<hbox>
   8.333 -				<text wrap="false">
   8.334 -					<label>"'`gettext "Sessions:"`'                "</label>
   8.335 -				</text>
   8.336 -				<entry>
   8.337 -					<input>cat /etc/slim.conf | grep ^session | sed s/"sessions. *"//</input>
   8.338 -					<variable>SLIM_SESSIONS</variable>
   8.339 -				</entry>
   8.340 -				<button>
   8.341 -					<label>'`gettext "Change"`'</label>
   8.342 -					<input file icon="forward"></input>
   8.343 -					<action>sed -i "s/^sessions.*/sessions            $SLIM_SESSIONS/" /etc/slim.conf</action>
   8.344 -				</button>
   8.345 -			</hbox>
   8.346 -			<hbox>
   8.347 -				<text wrap="false">
   8.348 -					<label>"'`gettext "Default user:"`'           "</label>
   8.349 -				</text>
   8.350 -				<entry>
   8.351 -					<input>cat /etc/slim.conf | grep ^default_user | sed s/"default_user. *"//</input>
   8.352 -					<variable>SLIM_DEF_USER</variable>
   8.353 -				</entry>
   8.354 -				<button>
   8.355 -					<label>'`gettext "Change"`'</label>
   8.356 -					<input file icon="forward"></input>
   8.357 -					<action>sed -i "s/^default_user.*/default_user        $SLIM_DEF_USER/" /etc/slim.conf</action>
   8.358 -				</button>
   8.359 -			</hbox>
   8.360 -			<hbox>
   8.361 -				<text wrap="false">
   8.362 -					<label>"'`gettext "Auto login (yes|no):"`' "</label>
   8.363 -				</text>
   8.364 -				<entry max_length="3">
   8.365 -					<input>cat /etc/slim.conf | grep ^auto_login | sed s/"auto_login. *"//</input>
   8.366 -					<variable>SLIM_AUTO_LOGIN</variable>
   8.367 -				</entry>
   8.368 -				<button>
   8.369 -					<label>'`gettext "Change"`'</label>
   8.370 -					<input file icon="forward"></input>
   8.371 -					<action>sed -i "s/^auto_login.*/auto_login          $SLIM_AUTO_LOGIN/" /etc/slim.conf</action>
   8.372 -				</button>
   8.373 -			</hbox>
   8.374 -			<hbox>
   8.375 -				<text wrap="false">
   8.376 -					<label>"'`gettext "Theme:"`'"</label>
   8.377 -				</text>
   8.378 -				<combobox>
   8.379 -					<variable>NEW_SLIM_THEME</variable>'
   8.380 -# List all installed Slim themes.
   8.381 -for dir in $(ls /usr/share/slim/themes)
   8.382 -do
   8.383 -	THEME_ITEMS="<item>$dir</item>"
   8.384 -	MAIN_DIALOG=${MAIN_DIALOG}${THEME_ITEMS}
   8.385 -done		
   8.386 -MAIN_DIALOG=${MAIN_DIALOG}'
   8.387 -				</combobox>	
   8.388 -				<button>
   8.389 -					<label>'`gettext "Preview"`'</label>
   8.390 -					<input file icon="video-display"></input>
   8.391 -					<action>slim -p /usr/share/slim/themes/$NEW_SLIM_THEME &</action>
   8.392 -				</button>
   8.393 -				<button>
   8.394 -					<label>'`gettext "Change"`'</label>
   8.395 -					<input file icon="forward"></input>
   8.396 -					<action>sed -i "s/^current_theme.*/current_theme       $NEW_SLIM_THEME/" /etc/slim.conf</action>
   8.397 -					<action>refresh:SLIM_THEME</action>
   8.398 -				</button>
   8.399 -			</hbox>
   8.400 -			<hbox>
   8.401 -				<text wrap="false">
   8.402 -					<label>"'`gettext "Configuration file:"`'"</label>
   8.403 -				</text>
   8.404 -				<button>
   8.405 -					<label>/etc/slim.conf</label>
   8.406 -					<input file icon="accessories-text-editor"></input>
   8.407 -					<action>leafpad /etc/slim.conf</action>
   8.408 -					<action>refresh:SLIM_SESSIONS</action>
   8.409 -					<action>refresh:SLIM_DEF_USER</action>
   8.410 -				</button>
   8.411 -			</hbox>
   8.412 -		</frame>
   8.413 -	</vbox>'
   8.414 -# Time settings.
   8.415 -MAIN_DIALOG=${MAIN_DIALOG}'	
   8.416 -	<vbox>
   8.417 -		<frame '`gettext "Date and time"`'>
   8.418 -			<hbox>
   8.419 -				<text wrap="false">
   8.420 -					<label>"'`gettext "System time:"`'   "</label>
   8.421 -				</text>
   8.422 -				<entry editable="false">
   8.423 -					<input>LC_ALL=C date</input>
   8.424 -					<variable>DATE</variable>
   8.425 -				</entry>
   8.426 -				<button>
   8.427 -					<label>'`gettext "Sync online"`'</label>
   8.428 -					<input file icon="reload"></input>
   8.429 -					<action>rdate -s tick.greyware.com</action>
   8.430 -					<action>refresh:DATE</action>
   8.431 -					<action>refresh:HWTIME</action>
   8.432 -				</button>
   8.433 -			</hbox>
   8.434 -			<hbox>
   8.435 -				<text wrap="false">
   8.436 -					<label>"'`gettext "Hardware time:"`'"</label>
   8.437 -				</text>
   8.438 -				<entry editable="false">
   8.439 -					<input>LC_ALL=C hwclock</input>
   8.440 -					<variable>HWTIME</variable>
   8.441 -				</entry>
   8.442 -				<button>
   8.443 -					<label>'`gettext "Set from system"`'</label>
   8.444 -					<input file icon="reload"></input>
   8.445 -					<action>hwclock -w -u</action>
   8.446 -					<action>refresh:HWTIME</action>
   8.447 -					<action>refresh:DATE</action>
   8.448 -				</button>
   8.449 -			</hbox>
   8.450 -			<hbox>
   8.451 -				<text wrap="true">
   8.452 -					<label>"'`gettext "Timezone:"`'       "</label>
   8.453 -				</text>
   8.454 -				<entry>
   8.455 -					<input>cat /etc/TZ</input>
   8.456 -					<variable>NEW_TZ</variable>
   8.457 -				</entry>
   8.458 -				<button>
   8.459 -					<label>'`gettext "Change"`'</label>
   8.460 -					<input file icon="forward"></input>
   8.461 -					<action>echo "$NEW_TZ" > /etc/TZ</action>
   8.462 -				</button>
   8.463 -			</hbox>
   8.464 -		</frame>
   8.465 -	</vbox>'
   8.466 -# Language settings.
   8.467 -MAIN_DIALOG=${MAIN_DIALOG}"
   8.468 -	<vbox>
   8.469 -		<tree>
   8.470 -			<width>600</width><height>210</height>
   8.471 -			<variable>LANGUAGE</variable>
   8.472 -			<label>`gettext "Language|Charmap"`</label>
   8.473 -			<input icon_column=\"0\">$0 list_locales</input>
   8.474 -			<action>$0 gen_utf8_locale</action>
   8.475 -		</tree>
   8.476 -		<hbox>
   8.477 -		<text width-chars=\"60\">
   8.478 -			<label>
   8.479 -\"`gettext "To change the system language you can double-click on the locale name."`\"
   8.480 -			</label>
   8.481 -		</text>
   8.482 -		<button>
   8.483 -			<label>`gettext "Keymap"`</label>
   8.484 -			<input file icon=\"input-keyboard\"></input>
   8.485 -			<action>tazkeymap &</action>
   8.486 -		</button>
   8.487 -	</hbox>
   8.488 -	</vbox>"
   8.489 -# Display users list through get_users.
   8.490 -MAIN_DIALOG=${MAIN_DIALOG}"
   8.491 -	<vbox>
   8.492 -		<tree>
   8.493 -			<width>600</width><height>210</height>
   8.494 -			<variable>USER</variable>
   8.495 -			<label>`gettext "Login|uid:gid|Name|Home|SHell"`</label>
   8.496 -			<input icon_column=\"0\">$0 get_users</input>
   8.497 -			<action>$0 manage_user</action>
   8.498 -			<action>refresh:USER</action>
   8.499 -		</tree>
   8.500 -		<hbox>
   8.501 -		<text width-chars=\"60\">
   8.502 -			<label>
   8.503 -\"`gettext "To change passwords or delete users you can double-click on the user name."`\"
   8.504 -			</label>
   8.505 -		</text>
   8.506 -		<button>
   8.507 -			<label>`gettext "Add newuser"`</label>
   8.508 -			<input file icon=\"gtk-add\"></input>
   8.509 -			<action>$0 add_user</action>
   8.510 -			<action>refresh:USER</action>
   8.511 -		</button>
   8.512 -	</hbox>
   8.513 -	</vbox>"
   8.514 -export MAIN_DIALOG=${MAIN_DIALOG}'	
   8.515 -	</notebook>
   8.516 -
   8.517 -	<hbox>
   8.518 -		<button>
   8.519 -			<label>'`gettext "Network"`'</label>
   8.520 -			<input file icon="netbox"></input>
   8.521 -			<action>netbox &</action>
   8.522 -		</button>
   8.523 -		<button>
   8.524 -			<label>'`gettext "Wireless"`'</label>
   8.525 -			<input file icon="network-wireless"></input>
   8.526 -			<action>wifibox &</action>
   8.527 -		</button>
   8.528 -		<button>
   8.529 -			<label>'`gettext "Packages"`'</label>
   8.530 -			<input file icon="tazpkg"></input>
   8.531 -			<action>tazpkgbox &</action>
   8.532 -		</button>
   8.533 -		<button>
   8.534 -			<label>'`gettext "Hardware"`'</label>
   8.535 -			<input file icon="computer"></input>
   8.536 -			<action>tazhw box &</action>
   8.537 -		</button>
   8.538 -		<button>
   8.539 -			<label>'`gettext "Server"`'</label>
   8.540 -			<input file icon="utilities-system-monitor"></input>
   8.541 -			<action>serverbox &</action>
   8.542 -		</button>
   8.543 -		<button>
   8.544 -			<label>'`gettext "Storage"`'</label>
   8.545 -			<input file icon="media-flash"></input>
   8.546 -			<action>mountbox &</action>
   8.547 -		</button>
   8.548 -		<button>
   8.549 -			<label>'`gettext "Exit"`'</label>
   8.550 -			<input file icon="exit"></input>
   8.551 -			<action type="exit">Exit</action>
   8.552 -		</button>
   8.553 -	</hbox>
   8.554 -
   8.555 -</vbox>
   8.556 -
   8.557 -</window>'
   8.558 -
   8.559 -# Script can be called with an arg to exec a function.
   8.560 -if [ -n "$1" ]; then
   8.561 -	$1
   8.562 -else
   8.563 -	gtkdialog --center --program=MAIN_DIALOG >/dev/null
   8.564 -fi
   8.565 -
   8.566 -exit 0
     9.1 --- a/oldstuff/tazctrlbox.desktop	Sat Apr 28 20:11:25 2012 +0200
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,10 +0,0 @@
     9.4 -[Desktop Entry]
     9.5 -Encoding=UTF-8
     9.6 -Name=Control Box
     9.7 -Name[fr]=Boîte de contrôle
     9.8 -Name[pt]=Painel de Controle
     9.9 -Comment=Manage your SliTaz system
    9.10 -Exec=subox tazctrlbox
    9.11 -Icon=tazctrlbox.png
    9.12 -Type=Application
    9.13 -Categories=System;Application;
    10.1 --- a/oldstuff/wifibox	Sat Apr 28 20:11:25 2012 +0200
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,686 +0,0 @@
    10.4 -#!/bin/sh
    10.5 -#
    10.6 -# GTKdialog interface to manage wireless connections in a simple way.
    10.7 -# Use tabs to indent, split commands from the GUI and use functions.
    10.8 -# Favorite networks are also supported
    10.9 -#
   10.10 -# (c) 2010 SliTaz GNU/Linux - GNU gpl v3
   10.11 -#
   10.12 -VERSION=20100118
   10.13 -
   10.14 -# Export script path and others if needed so we can use them in 'quote'.
   10.15 -export BIN=$0
   10.16 -export FAVORITES_WIFI=/etc/wireless
   10.17 -. /etc/network.conf
   10.18 -
   10.19 -# Wifibox is only for root.
   10.20 -if test $(id -u) != 0 ; then
   10.21 -	exec subox wifibox
   10.22 -	exit 0
   10.23 -fi
   10.24 -
   10.25 -# Sanity check
   10.26 -[ -x /usr/sbin/iwconfig ] || tazpkg get-install wireless_tools
   10.27 -[ -d $FAVORITES_WIFI ] || mkdir -p $FAVORITES_WIFI
   10.28 -rm -f $FAVORITES_WIFI/any.conf
   10.29 -
   10.30 -# Catch ESSIDs and format output for GTK tree. We get the list of
   10.31 -# networks by Cell and without spaces.
   10.32 -detect_wifi_networks()
   10.33 -{
   10.34 -	desktopbox notify "Scanning Wireless interface: $WIFI_INTERFACE" &
   10.35 -	if [ -d /sys/class/net/$WIFI_INTERFACE/wireless ]; then
   10.36 -		ifconfig $WIFI_INTERFACE up
   10.37 -		for i in `iwlist $WIFI_INTERFACE scan | sed s/"Cell "/Cell-/ | grep "Cell-" | awk '{print $1}'`
   10.38 -		do
   10.39 -			SCAN=`iwlist $WIFI_INTERFACE scan last | \
   10.40 -				awk '/(Cell|ESS|Qual|Encry|IE: WPA)/ {print}' | \
   10.41 -				sed s/"Cell "/Cell-/ | grep -A 5 "$i"`
   10.42 -			ESSID=`echo $SCAN | cut -d '"' -f 2`
   10.43 -			if echo "$SCAN" | grep -q Quality; then
   10.44 -				QUALITY=`echo $SCAN | sed 's/.*Quality=\([^ ]*\).*/\1/' | sed 's/.*Quality:\([^ ]*\).*/\1/'`
   10.45 -			else
   10.46 -				QUALITY="-"
   10.47 -			fi
   10.48 -			ENCRYPTION=`echo $SCAN | sed 's/.*key:\([^ ]*\).*/\1/'`
   10.49 -			# Check encryption type
   10.50 -			if echo "$SCAN" | grep -q WPA; then
   10.51 -				ENCRYPTION="${ENCRYPTION} (WPA)"
   10.52 -			fi
   10.53 -			# Connected or not connected...
   10.54 -			if ifconfig | grep -A 1 $WIFI_INTERFACE | \
   10.55 -				grep -q inet && iwconfig $WIFI_INTERFACE | \
   10.56 -				grep ESSID | grep -q -w "$ESSID"; then
   10.57 -				STATUS=connected
   10.58 -			else
   10.59 -				STATUS="-"
   10.60 -			fi
   10.61 -			echo -n ""
   10.62 -			echo "$ESSID | $QUALITY | $ENCRYPTION | $STATUS"
   10.63 -		done
   10.64 -	fi
   10.65 -}
   10.66 -
   10.67 -# cmdline functions
   10.68 -
   10.69 -# Toggle Software RF Switch on some laptops
   10.70 -set_rfswitch()
   10.71 -{
   10.72 -	for i in /proc/driver/acerhk/wirelessled /proc/acpi/asus/wled ; do
   10.73 -		[ -e $i ] && echo $1 > $i
   10.74 -	done
   10.75 -}
   10.76 -
   10.77 -# Configure /etc/network.conf and restart connection with init script.
   10.78 -start_wifi_connection()
   10.79 -{
   10.80 -	# Get tmp config created by connect_to_essid() if exists and set 
   10.81 -	# empty value to clean config file.
   10.82 -	if [ -f /tmp/wifi.conf ]; then
   10.83 -		. /tmp/wifi.conf
   10.84 -		WIFI_MODE=""
   10.85 -		WIFI_IWCONFIG_ARGS=""
   10.86 -		WIFI_CHANNEL=""
   10.87 -	fi
   10.88 -	sed -i "s/`grep ^WIFI= /etc/network.conf`/WIFI=\"yes\"/" \
   10.89 -		/etc/network.conf
   10.90 -	sed -i "s/`grep ^WIFI_INTERFACE= /etc/network.conf`/WIFI_INTERFACE=\"$WIFI_INTERFACE\"/" \
   10.91 -		/etc/network.conf
   10.92 -	sed -i "s/`grep ^WIFI_ESSID= /etc/network.conf`/WIFI_ESSID=\"$WIFI_ESSID\"/" \
   10.93 -		/etc/network.conf
   10.94 -	sed -i "s/`grep ^WIFI_KEY= /etc/network.conf`/WIFI_KEY=\"$WIFI_KEY\"/" \
   10.95 -		/etc/network.conf
   10.96 -	sed -i "s/`grep ^WIFI_MODE= /etc/network.conf`/WIFI_MODE=\"$WIFI_MODE\"/" \
   10.97 -		/etc/network.conf
   10.98 -	sed -i "s/`grep ^WIFI_IWCONFIG_ARGS= /etc/network.conf`/WIFI_IWCONFIG_ARGS=\"$WIFI_IWCONFIG_ARGS\"/" \
   10.99 -		/etc/network.conf
  10.100 -	sed -i "s/`grep ^WIFI_KEY_TYPE= /etc/network.conf`/WIFI_KEY_TYPE=\"$WIFI_KEY_TYPE\"/" \
  10.101 -		/etc/network.conf
  10.102 -	sed -i "s/`grep ^WIFI_CHANNEL= /etc/network.conf`/WIFI_CHANNEL=\"$WIFI_CHANNEL\"/" \
  10.103 -		/etc/network.conf	
  10.104 -	[ -s /var/run/udhcpc.$WIFI_INTERFACE.pid ] && kill `cat /var/run/udhcpc.$WIFI_INTERFACE.pid`
  10.105 -	ifconfig $WIFI_INTERFACE down
  10.106 -	set_rfswitch 1 
  10.107 -	iwconfig $WIFI_INTERFACE txpower auto
  10.108 -	/etc/init.d/network.sh restart
  10.109 -	# Remove tmp file (could be used to have wireless profiles)
  10.110 -	rm -f /tmp/wifi.conf
  10.111 -	sleep 2
  10.112 -}
  10.113 -
  10.114 -# We must sleep 4 sec to refresh networks list.
  10.115 -stop_wifi_connexion()
  10.116 -{
  10.117 -	sed -i s/`grep ^WIFI= /etc/network.conf`/WIFI=\"no\"/ \
  10.118 -		/etc/network.conf
  10.119 -	[ -x /etc/init.d/wpa_supplicant ] && /etc/init.d/wpa_supplicant stop
  10.120 -	ifconfig $WIFI_INTERFACE down
  10.121 -	iwconfig $WIFI_INTERFACE txpower off
  10.122 -	set_rfswitch 0 
  10.123 -	[ -s /var/run/udhcpc.$WIFI_INTERFACE.pid ] && kill `cat /var/run/udhcpc.$WIFI_INTERFACE.pid`
  10.124 -	sleep 2
  10.125 -}
  10.126 -
  10.127 -auto_connect_to_favorites_atboot()
  10.128 -{
  10.129 -	. $FAVORITES_WIFI/${FAVNET}.conf
  10.130 -	
  10.131 -	if grep -q "ssid=\"$FAVNET\"" /etc/wpa_supplicant.conf ; then
  10.132 -		# edit configuration
  10.133 -		sed -i "/start ${FAVNET}.conf/,/end ${FAVNET}.conf/s/[^_]ssid=.*/  ssid=\"$WIFI_ESSID\"/  " /etc/wpa_supplicant.conf
  10.134 -		sed -i "/start ${FAVNET}.conf/,/end ${FAVNET}.conf/s/psk=.*/psk=\"$WIFI_KEY\"/ " /etc/wpa_supplicant.conf
  10.135 -	else
  10.136 -		# add new configuration
  10.137 -		echo -e "
  10.138 -# start ${FAVNET}.conf configuration
  10.139 -network={ 
  10.140 -	ssid=\"$WIFI_ESSID\"
  10.141 -	scan_ssid=1 
  10.142 -	key_mgmt=WPA-EAP WPA-PSK IEEE8021X NONE 
  10.143 -	group=CCMP TKIP WEP104 WEP40 
  10.144 -	pairwise=CCMP TKIP 
  10.145 -	psk=\"$WIFI_KEY\" 
  10.146 -	priority=3  
  10.147 -} 
  10.148 -# end ${FAVNET}.conf configuration" >> /etc/wpa_supplicant.conf  
  10.149 -    fi
  10.150 -
  10.151 -}
  10.152 -
  10.153 -# Favorite wireless networks use only 3 values: essid. key and type of
  10.154 -# key
  10.155 -favorites_wifi_list()
  10.156 -{
  10.157 -	for i in $FAVORITES_WIFI/*.conf
  10.158 -	do
  10.159 -		WIFI_ESSID=""
  10.160 -		WIFI_KEY=""
  10.161 -		WIFI_KEY_TYPE=""
  10.162 -		. "$i"
  10.163 -		[ -z "$WIFI_ESSID" ] && WIFI_ESSID="Bad config file: $i"
  10.164 -		[ -z "$WIFI_KEY_TYPE" ] && WIFI_KEY_TYPE="-"
  10.165 -		if [ -n "$WIFI_KEY" ]; then
  10.166 -			WIFI_KEY="********"
  10.167 -		else
  10.168 -			WIFI_KEY="-"
  10.169 -		fi
  10.170 -		echo "$WIFI_ESSID | $WIFI_KEY_TYPE | $WIFI_KEY"
  10.171 -	done
  10.172 -}
  10.173 -
  10.174 -favorite_wifi_actions()
  10.175 -{
  10.176 -	cp -a $FAVORITES_WIFI/"$FAVORITE".conf /tmp/wifi.conf
  10.177 -	. /tmp/wifi.conf
  10.178 -	export CONNECT_FAVORITE="
  10.179 -<window title=\"Connect to: $WIFI_ESSID\" icon-name=\"network-wireless\">
  10.180 -<vbox>
  10.181 -	
  10.182 -	<text width-chars=\"54\">
  10.183 -		<label>
  10.184 -\"
  10.185 -ESSID name: $WIFI_ESSID
  10.186 -\"
  10.187 -		</label>
  10.188 -	</text>
  10.189 -	
  10.190 -	<hbox>
  10.191 -		<button>
  10.192 -			<label>Connect</label>
  10.193 -			<input file icon=\"forward\"></input>	
  10.194 -			<action>$0 start_wifi_connection</action>
  10.195 -			<action type=\"exit\">exit</action>
  10.196 -		</button>
  10.197 -		<button>
  10.198 -			<label>Edit settings</label>
  10.199 -			<input file icon=\"accessories-text-editor\"></input>	
  10.200 -			<action>leafpad $FAVORITES_WIFI/\"$FAVORITE\".conf</action>
  10.201 -			<action>rm -f /tmp/wifi.conf</action>					
  10.202 -		</button>
  10.203 -		<button>
  10.204 -			<label>Save Edits</label>
  10.205 -			<input file icon=\"document-save\"></input>	
  10.206 -			<action>export FAVNET=$WIFI_ESSID; $0 auto_connect_to_favorites_atboot</action>
  10.207 -			<action type=\"exit\">exit</action>					
  10.208 -		</button>
  10.209 -		<button>
  10.210 -			<label>Delete</label>
  10.211 -			<input file icon=\"gtk-delete\"></input>	
  10.212 -			<action>rm -f $FAVORITES_WIFI/\"$FAVORITE\".conf</action>
  10.213 -			<action>sed -i \"/start ${FAVORITE}.conf/,/end ${FAVORITE}.conf/d\" /etc/wpa_supplicant.conf</action>
  10.214 -			<action type=\"exit\">exit</action>
  10.215 -		</button>
  10.216 -		<button cancel></button>
  10.217 -	</hbox>
  10.218 -	
  10.219 -</vbox>
  10.220 -</window>"
  10.221 -	gtkdialog --center --program=CONNECT_FAVORITE >/dev/null
  10.222 -}
  10.223 -
  10.224 -add_favorite_network_box()
  10.225 -{
  10.226 -	ADD_FAVORITE='
  10.227 -<window title="Add new favorite Wireless" icon-name="network-wireless">
  10.228 -<vbox>
  10.229 -	<text width-chars="54">
  10.230 -		<label>
  10.231 -"
  10.232 -Please configure your new favorite Wireless network
  10.233 -"
  10.234 -		</label>
  10.235 -	</text>
  10.236 -	<hbox>
  10.237 -		<text use-markup="true">
  10.238 -			<label>"<b>ESSID:</b>"</label>
  10.239 -		</text>
  10.240 -		<entry>
  10.241 -			<variable>WIFI_ESSID</variable>
  10.242 -		</entry>
  10.243 -	</hbox>
  10.244 -	<hbox>
  10.245 -		<text use-markup="true">
  10.246 -			<label>"<b>Key:   </b>"</label>
  10.247 -		</text>
  10.248 -		<entry>
  10.249 -			<variable>WIFI_KEY</variable>
  10.250 -		</entry>
  10.251 -	</hbox>
  10.252 -	<hbox>
  10.253 -		<text use-markup="true">
  10.254 -			<label>"<b>Key type:</b>"</label>
  10.255 -		</text>
  10.256 -		<combobox>'
  10.257 -	tmp="${ADD_FAVORITE}<item>$WIFI_KEY_TYPE</item>"
  10.258 -	for i in none WEP WPA any; do
  10.259 -		tmp=${tmp}"<item>$i</item>"
  10.260 -	done
  10.261 -	export ADD_FAVORITE=${tmp}'
  10.262 -			<variable>WIFI_KEY_TYPE</variable>
  10.263 -		</combobox>
  10.264 -	</hbox>
  10.265 -	<hbox>
  10.266 -		<button>
  10.267 -			<label>Add to list</label>
  10.268 -			<input file icon="forward"></input>
  10.269 -			<action>echo "# Wireless connection configuration." > $FAVORITES_WIFI/"$WIFI_ESSID".conf</action>
  10.270 -			<action>echo "#" >> /etc/wireless/"$WIFI_ESSID".conf</action>
  10.271 -			<action>echo "WIFI_ESSID=\"$WIFI_ESSID\"" >> $FAVORITES_WIFI/"$WIFI_ESSID".conf</action>
  10.272 -			<action>echo "WIFI_KEY=\"$WIFI_KEY\"" >> $FAVORITES_WIFI/"$WIFI_ESSID".conf</action>
  10.273 -			<action>echo "WIFI_KEY_TYPE=\"$WIFI_KEY_TYPE\"" >> $FAVORITES_WIFI/"$WIFI_ESSID".conf</action>
  10.274 -			<action>export FAVNET=$WIFI_ESSID; $BIN auto_connect_to_favorites_atboot</action>
  10.275 -			<action type="exit">exit</action>
  10.276 -		</button>
  10.277 -		<button cancel></button>
  10.278 -	</hbox>
  10.279 -</vbox>
  10.280 -</window>'
  10.281 -	gtkdialog --center --program=ADD_FAVORITE #>/dev/null
  10.282 -}
  10.283 -
  10.284 -# GUI functions
  10.285 -
  10.286 -helpbutton()
  10.287 -{
  10.288 -	local label;
  10.289 -        label="<label>$3</label>"
  10.290 -	[ -n "$3" ] || label=""
  10.291 -	cat << EOT
  10.292 -<button>
  10.293 -	<input file icon="help"></input>$label
  10.294 -	<action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry $2 -title "$1 help" -e "$(which $1) --help ; echo -e \\"----\\nENTER to continue...\\" && read close"</action>
  10.295 -</button>
  10.296 -EOT
  10.297 -}
  10.298 -
  10.299 -manbutton()
  10.300 -{
  10.301 -	cat << EOT
  10.302 -<button>
  10.303 -	<input file icon="browser"></input>
  10.304 -	<label>man</label>
  10.305 -	<action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x24 -title "$2 man (q to quit)" -e ". /etc/profile; man $1 $2"</action>
  10.306 -</button>
  10.307 -EOT
  10.308 -}
  10.309 -
  10.310 -# Independent dialog to connect to a wireless network. If encryption
  10.311 -# is on we ask for the security key.
  10.312 -connect_to_essid()
  10.313 -{
  10.314 -	SCAN=`iwlist $WIFI_INTERFACE scan | \
  10.315 -		awk '/(Cell|ESS|Qual|Encry|IE: WPA)/ {print}' | \
  10.316 -		grep -B 1 -A 1 "$ESSID_LIST"`
  10.317 -	WIFI_ESSID="$ESSID_LIST"
  10.318 -	ENCRYPTION=`echo $SCAN | sed 's/.*key:\([^ ]*\).*/\1/'`
  10.319 -	# Create tmp file used by active_wifi_connexion()
  10.320 -	cat > /tmp/wifi.conf << _EOF_
  10.321 -# Wireless connexion configuration file.
  10.322 -WIFI_ESSID="$ESSID_LIST"
  10.323 -_EOF_
  10.324 -	CONNECT_ESSID="
  10.325 -<window title=\"Connect to: $WIFI_ESSID\" icon-name=\"network-wireless\">
  10.326 -<vbox>
  10.327 -	<text width-chars=\"54\">
  10.328 -		<label>
  10.329 -\"
  10.330 -Connect $WIFI_INTERFACE to: $WIFI_ESSID
  10.331 -\"
  10.332 -		</label>
  10.333 -	</text>"
  10.334 -	# We maybe need a key to connect
  10.335 -	if [ "$ENCRYPTION" = "on" ] && [ "$ESSID_LIST" != "any" ]; then
  10.336 -		# WPA
  10.337 -		if echo "$SCAN" | grep -q WPA; then
  10.338 -			echo 'WIFI_KEY_TYPE="WPA"' >> /tmp/wifi.conf
  10.339 -			CONNECT_ESSID=${CONNECT_ESSID}'
  10.340 -			<hbox>
  10.341 -				<text use-markup="true">
  10.342 -					<label>"<b>WPA Key:</b>"</label>
  10.343 -				</text>
  10.344 -				<entry>
  10.345 -					<input>. /etc/network.conf; echo "$WIFI_KEY"</input>
  10.346 -					<variable>WIFI_KEY</variable>
  10.347 -				</entry>
  10.348 -			</hbox>'
  10.349 -		else
  10.350 -			# WEP
  10.351 -			echo 'WIFI_KEY_TYPE="WEP"' >> /tmp/wifi.conf
  10.352 -			CONNECT_ESSID=${CONNECT_ESSID}'
  10.353 -			<hbox>
  10.354 -				<text use-markup="true">
  10.355 -					<label>"<b>WEP Key:</b>"</label>
  10.356 -				</text>
  10.357 -				<entry>
  10.358 -					<input>. /etc/network.conf; echo "$WIFI_KEY"</input>
  10.359 -					<variable>WIFI_KEY</variable>
  10.360 -				</entry>
  10.361 -			</hbox>'
  10.362 -		fi
  10.363 -	else
  10.364 -		# No encryption
  10.365 -		echo 'WIFI_KEY=""' >> /tmp/wifi.conf
  10.366 -		echo 'WIFI_KEY_TYPE=""' >> /tmp/wifi.conf
  10.367 -		start_wifi_connection
  10.368 -		exit 0
  10.369 -	fi
  10.370 -	# Add key to config file so active_wifi_connexion() can use it.
  10.371 -	# WIFI_KEY is not exported if we quote with --> "
  10.372 -	export CONNECT_ESSID=${CONNECT_ESSID}'
  10.373 -	<hbox>
  10.374 -		<button>
  10.375 -			<label>Connect</label>
  10.376 -			<input file icon="forward"></input>	
  10.377 -			<action>echo "WIFI_KEY=\"$WIFI_KEY\"" >> /tmp/wifi.conf</action>
  10.378 -			<action>$BIN start_wifi_connection</action>
  10.379 -			<action type="exit">exit</action>
  10.380 -		</button>
  10.381 -		<button cancel></button>
  10.382 -	</hbox>
  10.383 -</vbox>
  10.384 -</window>'
  10.385 -	gtkdialog --center --program=CONNECT_ESSID #>/dev/null
  10.386 -}
  10.387 -
  10.388 -# Wifibox start with Networks tab.
  10.389 -box()
  10.390 -{
  10.391 -	WIFI_DIALOG="
  10.392 -<window title=\"Wireless manager\" icon-name=\"network-wireless\">
  10.393 -<vbox>
  10.394 -	
  10.395 -	<notebook labels=\"Networks|Favorites|Configuration|Drivers\">
  10.396 -	
  10.397 -	<vbox>
  10.398 -		<tree icon=\"network-wireless\">
  10.399 -			<width>520</width><height>160</height>
  10.400 -			<variable>ESSID_LIST</variable>
  10.401 -			<label>ESSID|Quality|Encryption|Status</label>
  10.402 -			<input>$0 detect_wifi_networks</input>
  10.403 -			<item icon=\"network-wireless\">any | * | off | (auto-connect)</item>
  10.404 -			<action>$0 connect_to_essid</action>
  10.405 -			<action>refresh:ESSID_LIST</action>
  10.406 -			<action>refresh:WIFI_ESSID</action>
  10.407 -			<action>refresh:WIFI_KEY</action>
  10.408 -			<action>refresh:WIFI_KEY_TYPE</action>
  10.409 -		</tree>
  10.410 -		<hbox>
  10.411 -			<text width-chars=\"54\">
  10.412 -				<label>
  10.413 -\"Please double click on a network to connect or enter security key\"
  10.414 -				</label>
  10.415 -			</text>
  10.416 -			<button>
  10.417 -				<label>Refresh list</label>
  10.418 -				<input file icon=\"reload\"></input>
  10.419 -				<action>refresh:ESSID_LIST</action>
  10.420 -			</button>
  10.421 -		</hbox>
  10.422 -	</vbox>"
  10.423 -	
  10.424 -	
  10.425 -	# Favorite networks
  10.426 -	WIFI_DIALOG=${WIFI_DIALOG}"	
  10.427 -	<vbox>
  10.428 -	    <tree icon=\"network-wireless\">
  10.429 -			<width>500</width><height>160</height>
  10.430 -			<variable>FAVORITE</variable>
  10.431 -			<label>ESSID|Key Type|Key status</label>
  10.432 -			<input>$0 favorites_wifi_list</input>
  10.433 -			<item icon=\"network-wireless\">any | - | -</item>
  10.434 -			<action>$0 favorite_wifi_actions</action>
  10.435 -			<action>refresh:FAVORITE</action>
  10.436 -			<action>refresh:ESSID_LIST</action>
  10.437 -			<action>refresh:WIFI_ESSID</action>
  10.438 -			<action>refresh:WIFI_KEY</action>
  10.439 -			<action>refresh:WIFI_KEY_TYPE</action>
  10.440 -		</tree>
  10.441 -		<hbox>
  10.442 -			<text width-chars=\"65\">
  10.443 -				<label>
  10.444 -\"Favorite networks connect automatically when the computer is started           \"
  10.445 -				</label>
  10.446 -			</text>
  10.447 -		</hbox>
  10.448 -		<hbox>
  10.449 -			<text width-chars=\"50\">
  10.450 -				<label>
  10.451 -\"Please double click on a network to modify or remove it\"
  10.452 -				</label>
  10.453 -			</text>
  10.454 -			<button>
  10.455 -				<label>Add Network</label>
  10.456 -				<input file icon=\"gtk-add\"></input>
  10.457 -				<action>$0 add_favorite_network_box</action>
  10.458 -				<action>refresh:FAVORITE</action>
  10.459 -			</button>
  10.460 -		</hbox>
  10.461 -	</vbox>"
  10.462 -
  10.463 -	# Configuration tab
  10.464 -	WIFI_DIALOG=${WIFI_DIALOG}'
  10.465 -	<vbox>
  10.466 -		<frame Basic>
  10.467 -			<hbox>
  10.468 -				<text use-markup="true">
  10.469 -					<label>"<b>Interface:</b>"</label>
  10.470 -				</text>
  10.471 -				<entry>
  10.472 -					<input>. /etc/network.conf; echo "$WIFI_INTERFACE"</input>
  10.473 -					<variable>WIFI_INTERFACE</variable>
  10.474 -				</entry>
  10.475 -			</hbox>
  10.476 -			<hbox>
  10.477 -				<text use-markup="true">
  10.478 -					<label>"<b>ESSID:        </b>"</label>
  10.479 -				</text>
  10.480 -				<entry>
  10.481 -					<input>. /etc/network.conf; echo "$WIFI_ESSID"</input>
  10.482 -					<variable>WIFI_ESSID</variable>
  10.483 -				</entry>
  10.484 -			</hbox>
  10.485 -			<hbox>
  10.486 -				<text use-markup="true">
  10.487 -					<label>"<b>Key:           </b>"</label>
  10.488 -				</text>
  10.489 -				<entry>
  10.490 -					<input>. /etc/network.conf; echo "$WIFI_KEY"</input>
  10.491 -					<variable>WIFI_KEY</variable>
  10.492 -				</entry>
  10.493 -				<combobox>'
  10.494 -	tmp2="${WIFI_DIALOG}<item>$WIFI_KEY_TYPE</item>"
  10.495 -	for i in none WEP WPA any; do
  10.496 -		[ "$i" = "$WIFI_KEY_TYPE" ] || tmp2="$tmp2<item>$i</item>"
  10.497 -	done
  10.498 -	tmp3='		<variable>WIFI_KEY_TYPE</variable>
  10.499 -				</combobox>
  10.500 -			</hbox>
  10.501 -		</frame>
  10.502 -		<frame Advanced>
  10.503 -			<hbox>
  10.504 -				<text use-markup="true">
  10.505 -					<label>"<b>Channel/Mode:</b>"</label>
  10.506 -				</text>
  10.507 -				<entry>
  10.508 -					<input>. /etc/network.conf; echo "$WIFI_CHANNEL"</input>
  10.509 -					<variable>WIFI_CHANNEL</variable>
  10.510 -				</entry>
  10.511 -				
  10.512 -				<combobox>
  10.513 -					<variable>WIFI_MODE</variable>'
  10.514 -	tmp2="$tmp2$tmp3<item>$WIFI_MODE</item>"
  10.515 -	for i in managed ad-hoc master repeater secondary monitor; do
  10.516 -		[ "$i" = "$WIFI_MODE" ] || tmp2="$tmp2<item>$i</item>"
  10.517 -	done
  10.518 -	tmp3='		</combobox>
  10.519 -			</hbox>
  10.520 -			<hbox>
  10.521 -				<text use-markup="true">
  10.522 -					<label>"<b>Iwconfig args:</b> "</label>
  10.523 -				</text>
  10.524 -				<entry>
  10.525 -					<input>. /etc/network.conf; echo "$WIFI_IWCONFIG_ARGS"</input>
  10.526 -					<variable>WIFI_IWCONFIG_ARGS</variable>
  10.527 -				</entry>'
  10.528 -	WIFI_DIALOG="$tmp$tmp2$tmp3
  10.529 -	$(helpbutton iwconfig 80x24)
  10.530 -	$(manbutton 8 iwconfig)
  10.531 -			</hbox>
  10.532 -		</frame>"
  10.533 -		
  10.534 -	# Start Button for manual configuration.
  10.535 -	WIFI_DIALOG=${WIFI_DIALOG}'
  10.536 -		<hbox>
  10.537 -		   <button>
  10.538 -				<label>Save to Favorites</label>
  10.539 -				<input file icon="document-save"></input>
  10.540 -				<action>echo "# Wireless connection configuration." > $FAVORITES_WIFI/"$WIFI_ESSID".conf</action>
  10.541 -				<action>echo "#" >> /etc/wireless/"$WIFI_ESSID".conf</action>
  10.542 -				<action>echo "WIFI_ESSID=\"$WIFI_ESSID\"" >> $FAVORITES_WIFI/"$WIFI_ESSID".conf</action>
  10.543 -				<action>echo "WIFI_KEY=\"$WIFI_KEY\"" >> $FAVORITES_WIFI/"$WIFI_ESSID".conf</action>
  10.544 -				<action>echo "WIFI_KEY_TYPE=\"$WIFI_KEY_TYPE\"" >> $FAVORITES_WIFI/"$WIFI_ESSID".conf</action>
  10.545 -				<action>export FAVNET=$WIFI_ESSID; $BIN auto_connect_to_favorites_atboot</action>	
  10.546 -				<action>refresh:FAVORITE</action>
  10.547 -			</button>
  10.548 -			<button>
  10.549 -				<label>Start connection</label>
  10.550 -				<input file icon="forward"></input>
  10.551 -				<action>[ "$WIFI_KEY_TYPE" = "WPA" -a ! -x /usr/bin/wpa_supplicant ] && xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x17 -title "wpa_supplicant install" -e "tazpkg get-install wpa_supplicant ; echo -e \"----\n\nENTER to continue...\" && read close"</action>
  10.552 -				<action>sed -i s/`grep ^WIFI= /etc/network.conf`/WIFI=\"yes\"/ /etc/network.conf</action>
  10.553 -				<action>sed -i s/`grep ^WIFI_INTERFACE= /etc/network.conf`/WIFI_INTERFACE=\"$WIFI_INTERFACE\"/ /etc/network.conf</action>
  10.554 -				<action>sed -i s/`grep ^WIFI_ESSID= /etc/network.conf`/WIFI_ESSID=\"$WIFI_ESSID\"/ /etc/network.conf</action>
  10.555 -				<action>sed -i s/`grep ^WIFI_KEY= /etc/network.conf`/WIFI_KEY=\"$WIFI_KEY\"/ /etc/network.conf</action>
  10.556 -				<action>sed -i s/`grep ^WIFI_MODE= /etc/network.conf`/WIFI_MODE=\"$WIFI_MODE\"/ /etc/network.conf</action>
  10.557 -				<action>sed -i "s/`grep ^WIFI_IWCONFIG_ARGS= /etc/network.conf`/WIFI_IWCONFIG_ARGS=\"$WIFI_IWCONFIG_ARGS\"/" /etc/network.conf</action>
  10.558 -				<action>sed -i s/`grep ^WIFI_KEY_TYPE= /etc/network.conf`/WIFI_KEY_TYPE=\"$WIFI_KEY_TYPE\"/ /etc/network.conf</action>
  10.559 -				<action>sed -i s/`grep ^WIFI_CHANNEL= /etc/network.conf`/WIFI_CHANNEL=\"$WIFI_CHANNEL\"/ /etc/network.conf</action>
  10.560 -				<action>[ -s /var/run/udhcpc.$WIFI_INTERFACE.pid ] && kill `cat /var/run/udhcpc.$WIFI_INTERFACE.pid`</action>
  10.561 -				<action>ifconfig $WIFI_INTERFACE down</action>
  10.562 -				<action>iwconfig $WIFI_INTERFACE txpower auto</action>
  10.563 -				<action>/etc/init.d/network.sh restart</action>
  10.564 -				<action>refresh:ESSID_LIST</action>
  10.565 -				<action>refresh:WIFI_ESSID</action>
  10.566 -				<action>refresh:WIFI_KEY</action>
  10.567 -				<action>refresh:WIFI_KEY_TYPE</action>
  10.568 -			</button>
  10.569 -		</hbox>
  10.570 -	</vbox>'
  10.571 -
  10.572 -	# Kernel Modules, firmware and tazndisbox note + button.
  10.573 -	WIFI_DIALOG=${WIFI_DIALOG}"
  10.574 -	<vbox>
  10.575 -		<hbox>
  10.576 -			<text width-chars=\"64\">
  10.577 -				<label>
  10.578 -\"
  10.579 -Some Wireless Adapters need non-free firmware. Please install the
  10.580 -firmware before loading the corresponding module. Note that you can use 
  10.581 -Tazhw to automatically detect your PCI, PCMCIA or USB Wireless adapter.
  10.582 -\"
  10.583 -				</label>
  10.584 -			</text>
  10.585 -		</hbox>
  10.586 -		<hbox>
  10.587 -			<text use-markup=\"true\">
  10.588 -				<label>\"<b>Tools:</b>\"</label>
  10.589 -			</text>
  10.590 -			<button>
  10.591 -				<input file icon=\"computer\"></input>
  10.592 -				<label>Auto detect devices</label>
  10.593 -				<action>tazhw box</action>
  10.594 -				<action>refresh:ESSID_LIST</action>
  10.595 -			</button>"
  10.596 -			# Display firmware stuff, tazndisbox button if installed and close 
  10.597 -			# tab + notebook
  10.598 -			if [ -x /usr/bin/tazndisbox ]; then
  10.599 -				WIFI_DIALOG=${WIFI_DIALOG}"
  10.600 -			<button>
  10.601 -				<input file icon=\"system-installer\"></input>
  10.602 -				<label>Install Windows driver</label>
  10.603 -				<action>tazndisbox</action>
  10.604 -				<action>refresh:ESSID_LIST</action>
  10.605 -			</button>"
  10.606 -			fi
  10.607 -		WIFI_DIALOG=${WIFI_DIALOG}"
  10.608 -		</hbox>
  10.609 -		<hbox>
  10.610 -			<text use-markup=\"true\">
  10.611 -				<label>\"<b>Module:</b>\"</label>
  10.612 -			</text>
  10.613 -			<combobox>
  10.614 -				<variable>MODULE</variable>"
  10.615 -	WIFI_DIALOG="${WIFI_DIALOG}$(find /lib/modules/$(uname -r)/kernel/drivers/net/wireless -type f 2> /dev/null |  sed 's,/.*/\(.*\).ko.*,<item>\1</item>,')"
  10.616 -	WIFI_DIALOG=${WIFI_DIALOG}'
  10.617 -			</combobox>
  10.618 -			<button>
  10.619 -				<label>Load</label>
  10.620 -				<input file icon="forward"></input>
  10.621 -				<action>modprobe $MODULE</action>
  10.622 -			</button>
  10.623 -			<button>
  10.624 -				<label>Unload</label>
  10.625 -				<input file icon="undo"></input>
  10.626 -				<action>modprobe -r $MODULE</action>
  10.627 -			</button>
  10.628 -			<button>
  10.629 -				<label>Lsmod</label>
  10.630 -				<input file icon="computer"></input>
  10.631 -				<action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x25 -title "Modules (q to quit)" -e "lsmod | less"</action>
  10.632 -			</button>
  10.633 -		</hbox>'
  10.634 -	# Firmware stuff.
  10.635 -	tmp=$(for i in /usr/bin/get*firmware; do
  10.636 -		[ -x $i ] || continue
  10.637 -		[ "$i" = "/usr/bin/get-wifi-firmware" ] && continue
  10.638 -		[ -d /var/lib/tazpkg/installed/${i#/usr/bin/get-} ] && continue
  10.639 -		echo "<item>${i#/usr/bin/get-}</item>"; done)
  10.640 -		[ -n "$tmp" ] && tmp="
  10.641 -		<hbox>
  10.642 -			<text use-markup=\"true\">
  10.643 -				<label>\"<b>Firmware:</b>\"</label>
  10.644 -			</text>
  10.645 -			<combobox><variable>FIRMWARE</variable>$tmp</combobox>
  10.646 -			<button>
  10.647 -				<label>Install</label>
  10.648 -				<input file icon=\"go-jump\"></input>
  10.649 -				<action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x25 -title \"Install \$FIRMWARE\" -e \"get-\$FIRMWARE\"</action>
  10.650 -				<action>refresh:ESSID_LIST</action>
  10.651 -			</button>
  10.652 -			<button>
  10.653 -				<input file icon=\"system-file-manager\"></input>
  10.654 -				<label>List files</label>
  10.655 -				<action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 100x25 -title \"Firmware files (q to quit)\" -e \"find /lib/firmware -exec ls -ld {} \; | less\"</action>
  10.656 -				<action>refresh:ESSID_LIST</action>
  10.657 -			</button>
  10.658 -		</hbox>"
  10.659 -
  10.660 -# Bottom buttons
  10.661 -export WIFI_DIALOG=${WIFI_DIALOG}${tmp}"
  10.662 -		</vbox>
  10.663 -	</notebook>
  10.664 -	<hbox>
  10.665 -		<button>
  10.666 -			<label>Stop connection</label>
  10.667 -			<input file icon=\"stop\"></input>
  10.668 -			<action>$0 stop_wifi_connexion</action>
  10.669 -			<action>refresh:ESSID_LIST</action>
  10.670 -		</button>
  10.671 -		<button>
  10.672 -			<label>Exit</label>
  10.673 -			<input file icon=\"exit\"></input>
  10.674 -			<action type=\"exit\">Exit</action>
  10.675 -		</button>
  10.676 -	</hbox>
  10.677 -	
  10.678 -</vbox>
  10.679 -</window>"
  10.680 -	gtkdialog --center --program=WIFI_DIALOG #>/dev/null 2>&1
  10.681 -}
  10.682 -
  10.683 -if [ -n "$1" ]; then
  10.684 -	$1
  10.685 -else
  10.686 -	box
  10.687 -fi
  10.688 -
  10.689 -exit 0