ssfs rev 51

ssfs-box: improve user experience :-)
author Christophe Lincoln <pankso@slitaz.org>
date Sun Jun 12 20:29:39 2011 +0200 (2011-06-12)
parents 0409a8244cb8
children 524ab2a0ce70
files ssfs-box
line diff
     1.1 --- a/ssfs-box	Sun Jun 12 19:19:39 2011 +0200
     1.2 +++ b/ssfs-box	Sun Jun 12 20:29:39 2011 +0200
     1.3 @@ -8,6 +8,7 @@
     1.4  
     1.5  app=$(basename $0)
     1.6  config=$HOME/.config/ssfs/client.lua
     1.7 +pixmap=/usr/share/pixmaps/ssfs.png
     1.8  
     1.9  #
    1.10  # Functions
    1.11 @@ -15,12 +16,14 @@
    1.12  
    1.13  info() {
    1.14  	size=$(du -sh $HOME/Sync | awk '{print $1}')
    1.15 +	files=$(find $HOME/Sync | wc -l)
    1.16  	host=$(fgrep 'host' $config | cut -d '"' -f 2)
    1.17  	login=${host%@*}
    1.18  	host=${host#*@}
    1.19  	echo -e "Login\n$login
    1.20  Host\n$host
    1.21  Size\n$size
    1.22 +Files\n$files
    1.23  RSA Key\n~/.ssh/id_rsa"
    1.24  }
    1.25  
    1.26 @@ -29,12 +32,14 @@
    1.27  	if [ ! -s "$config" ]; then
    1.28  		$0 setup && exit 0
    1.29  	fi
    1.30 +	[ "$opts" ] || opts="--width=460 --height=320"
    1.31  	text=$(gettext "<b>Welcome to the Ssfs GTK user interface</b>")
    1.32 -	info | yad \
    1.33 -		--list --title="Ssfs GTK tools" \
    1.34 -		--width=460 --height=280 --image-on-top \
    1.35 -		--text="$text" --image="slitaz-menu" \
    1.36 +	info | yad $opts \
    1.37 +		--list --title="Ssfs Box" \
    1.38 +		--image-on-top --window-icon=$pixmap \
    1.39 +		--text="$text" --image=$pixmap \
    1.40  		--column "Ssfs" --column "$(gettext "Value")" \
    1.41 +		--button="$(gettext "Setup client"):4" \
    1.42  		--button="$(gettext "Edit config"):3" \
    1.43  		--button="$(gettext "Browse files"):2" \
    1.44  		--button="gtk-close:1"
    1.45 @@ -49,15 +54,16 @@
    1.46  		1) exit 0 ;;
    1.47  		2) file-manager $HOME/Sync ;;
    1.48  		3) editor $config ;;
    1.49 +		4) $0 setup ;;
    1.50  		*) continue ;;
    1.51  	esac
    1.52  	case $main in
    1.53  		RSA*)
    1.54  			yad --text-info --title="RSA Key" \
    1.55 -				--width=560 --height=380 \
    1.56 +				--width=560 --height=420 \
    1.57  				--filename=$HOME/.ssh/id_rsa ;;
    1.58  		*)
    1.59 -			echo "TODO: $main" ;;
    1.60 +			continue ;;
    1.61  	esac
    1.62  }
    1.63  
    1.64 @@ -68,8 +74,9 @@
    1.65  Any account on a server yet ? You can vist www.slitaz.org
    1.66  services or setup your own server in a few minutes!\n")
    1.67  	yad --form --title="Ssfs GTK Setup" \
    1.68 +		--window-icon=$pixmap \
    1.69  		--width=460 --height=200 --image-on-top \
    1.70 -		--text="$text" --image="slitaz-menu" \
    1.71 +		--text="$text" --image=$pixmap \
    1.72  		--field="Login" --field="Server"
    1.73  }
    1.74  
    1.75 @@ -86,6 +93,13 @@
    1.76  		-e "ssfs setup --login=$login --host=$host"
    1.77  }
    1.78  
    1.79 +# Notification mode.
    1.80 +notify() {
    1.81 +	export opts="--geometry=460x320-40+40 --timeout=6 --skip-taskbar"
    1.82 +	yad --notification --image=$pixmap --command=$0 \
    1.83 +		--text="$(gettext "Ssfs Live Sync storage")"
    1.84 +}
    1.85 +
    1.86  #
    1.87  # Commands
    1.88  #
    1.89 @@ -95,7 +109,9 @@
    1.90  		echo "Usage: $app [command]" ;;
    1.91  	setup)
    1.92  		setup ;;
    1.93 -	*) 
    1.94 +	notify)
    1.95 +		notify ;;
    1.96 +	*)
    1.97  		tools ;;
    1.98  esac
    1.99  exit 0