tazpkg diff tazpkg-box @ rev 555

tazpkg-box: Improove desktop integration, output tazpkg cmd to a GTK box
author Christophe Lincoln <pankso@slitaz.org>
date Fri Mar 02 11:21:19 2012 +0100 (2012-03-02)
parents 25ebb1a6e665
children da3bd3962a3e
line diff
     1.1 --- a/tazpkg-box	Thu Mar 01 18:22:00 2012 +0000
     1.2 +++ b/tazpkg-box	Fri Mar 02 11:21:19 2012 +0100
     1.3 @@ -1,7 +1,7 @@
     1.4  #!/bin/sh
     1.5  #
     1.6 -# Small GTK boxes to TazPKG for deep desktop integration. PcmanFM 0.5.x has a
     1.7 -# patch to extract TazPKG file but not Thunar and other FM. TazPKGbox tries to
     1.8 +# Small GTK boxes to TazPKG for deep desktop integration. PcmanFM 0.5.x have a
     1.9 +# patch to extract TazPKG file but not Thunar and othet FM. TazPKGbox try to
    1.10  # follow freedesktop standards.
    1.11  #
    1.12  # Copyright (C) 2012 SliTaz GNU/Linux - GNU gpl v2
    1.13 @@ -9,13 +9,15 @@
    1.14  # Authors : Christophe Lincoln <pankso@slitaz.org>
    1.15  #
    1.16  
    1.17 +icon="/usr/share/pixmaps/tazpkg.png"
    1.18 +
    1.19  # Main GUI box function with pure Yad spec
    1.20  actions_main() {
    1.21  	title=$(gettext "TazPKG actions")
    1.22 -	text=$(gettext "Package file name:")
    1.23 -	yad --text="$text <b>$pkg</b>" \
    1.24 -		--width=520 --height=80 --dialog-sep \
    1.25 -		--center --on-top --window-icon="tazpkg" \
    1.26 +	text=$(gettext "Package name:")
    1.27 +	yad --text="$text <b>${pkg%.tazpkg}</b>" \
    1.28 +		--title="$title" --width=480 --height=100 \
    1.29 +		--center --on-top --window-icon=$icon \
    1.30  		--image="tazpkg" --image-on-top \
    1.31  		--button="Install:3" --button="Extract:2" \
    1.32  		--button="gtk-close:1"
    1.33 @@ -29,8 +31,8 @@
    1.34  	# Deal with --button values
    1.35  	case $ret in
    1.36  		1) exit 0 ;;
    1.37 -		2) terminal -e "tazpkg extract $pkg" && exit 0 ;;
    1.38 -		3) terminal -e "tazpkg -i $pkg --forced" && exit 0 ;;
    1.39 +		2) tazpkg extract $pkg | $0 output ;;
    1.40 +		3) tazpkg -i $pkg --forced | $0 output ;;
    1.41  	esac
    1.42  }
    1.43  
    1.44 @@ -39,10 +41,19 @@
    1.45  #
    1.46  
    1.47  case "$1" in
    1.48 -	usage)
    1.49 -		echo "Usage: $(basename $0) [command]" ;;
    1.50 +	usage|help|-u|-h)
    1.51 +		echo "Usage: $(basename $0) [command] [pkg|cmd]" ;;
    1.52 +	output)
    1.53 +		# Nice GTK output for install and extract.
    1.54 +		sed	-e s'/\[^Gm]*./ /g' -e s'/^=.*//' | \
    1.55 +		yad --text-info \
    1.56 +			--width=480 --height=260 --center --on-top \
    1.57 +			--title="TazPKG" --window-icon=$icon \
    1.58 +			--fore="#ffffff" --back="#000000" --wrap \
    1.59 +			--margins=4 --button="gtk-close:0" ;;
    1.60  	actions)
    1.61 -		pkg="$2"
    1.62 +		pkg=$(basename $2)
    1.63 +		cd $(dirname $2)
    1.64  		actions ;;
    1.65  esac
    1.66