slitaz-tools diff boxes/wifi-box @ rev 939

tazbox: fix subox icon when ~/.local/share/applications is absent; fix working with freegeoip; write full list of icons used; all other files: 2015 and insert blank lines.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Fri Apr 17 07:35:02 2015 +0300 (2015-04-17)
parents 720dfc98b497
children 0f57e55885af
line diff
     1.1 --- a/boxes/wifi-box	Mon Mar 17 22:23:32 2014 +0100
     1.2 +++ b/boxes/wifi-box	Fri Apr 17 07:35:02 2015 +0300
     1.3 @@ -4,10 +4,11 @@
     1.4  # is most important, this tool provides a quick way to connect or change Wi-Fi
     1.5  # settings while full network configuration is done in TazPanel.
     1.6  #
     1.7 -# Copyright (C) 2012-2014 SliTaz GNU/Linux - GNU GPL v2
     1.8 +# Copyright (C) 2012-2015 SliTaz GNU/Linux - GNU GPL v2
     1.9  #
    1.10  # Authors: Christophe Lincoln <pankso@slitaz.org>
    1.11  #
    1.12 +
    1.13  . /lib/libtaz.sh
    1.14  export TEXTDOMAIN='slitaz-boxes' #i18n
    1.15  
    1.16 @@ -18,7 +19,9 @@
    1.17  	newline
    1.18  }
    1.19  
    1.20 +
    1.21  # Start a Wi-Fi connection
    1.22 +
    1.23  start_wifi() {
    1.24  	sed -i \
    1.25  		-e s'/^DHCP=.*/DHCP="yes"/' \
    1.26 @@ -30,8 +33,10 @@
    1.27  	/etc/init.d/network.sh start
    1.28  }
    1.29  
    1.30 +
    1.31  # Catch ESSIDs and format output for GTK tree. We get the list of
    1.32  # networks by Cell and without spaces.
    1.33 +
    1.34  detect_wifi() {
    1.35  	if [ -d /sys/class/net/$WIFI_INTERFACE/wireless ]; then
    1.36  		ifconfig $WIFI_INTERFACE up
    1.37 @@ -69,7 +74,9 @@
    1.38  	fi
    1.39  }
    1.40  
    1.41 +
    1.42  # Prompt for password or connect
    1.43 +
    1.44  connect_main() {
    1.45  	case $keytype in
    1.46  		WPA)	label="$(_n 'WPA Password:')" ;;
    1.47 @@ -78,7 +85,7 @@
    1.48  	esac
    1.49  	case $keytype in
    1.50  		WPA|WEP)
    1.51 -			icon=network-wireless
    1.52 +			icon='network-wireless'
    1.53  			yad --title="$(_n 'Wi-Fi connection')" --window-icon=$icon \
    1.54  				--width=520 --height=140 --on-top --center \
    1.55  				--image=$icon --image-on-top \
    1.56 @@ -90,6 +97,7 @@
    1.57  	esac
    1.58  }
    1.59  
    1.60 +
    1.61  connect() {
    1.62  	main=$(connect_main)
    1.63  	ret=$?
    1.64 @@ -109,9 +117,11 @@
    1.65  	start_wifi
    1.66  }
    1.67  
    1.68 +
    1.69  # Main GUI box function with pure Yad spec
    1.70 +
    1.71  wifi_main() {
    1.72 -	icon=network-wireless
    1.73 +	icon='network-wireless'
    1.74  	detect_wifi | yad --title="$(_n 'Wi-Fi network')" --window-icon=$icon \
    1.75  		--width=520 --height=300 --on-top --center \
    1.76  		--image=$icon --image-on-top \
    1.77 @@ -123,7 +133,9 @@
    1.78  		--button="gtk-preferences:2" --button="gtk-close:1"
    1.79  }
    1.80  
    1.81 +
    1.82  # Main function
    1.83 +
    1.84  wifi() {
    1.85  	# Store box results
    1.86  	main=$(wifi_main)
    1.87 @@ -143,6 +155,7 @@
    1.88  	fi
    1.89  }
    1.90  
    1.91 +
    1.92  #
    1.93  # Script commands
    1.94  #