tazpkg diff tazpkg-box @ rev 541

Add tazpkg-box (replace tazpkgbox-install to perform actions on package from file managers)
author Christophe Lincoln <pankso@slitaz.org>
date Wed Feb 29 15:02:07 2012 +0100 (2012-02-29)
parents
children 552f89fab93a
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tazpkg-box	Wed Feb 29 15:02:07 2012 +0100
     1.3 @@ -0,0 +1,50 @@
     1.4 +#!/bin/sh
     1.5 +#
     1.6 +# Small GTK boxes to TazPKG for deep desktop integration. PcmanFM 0.5.x have a
     1.7 +# patch to extract TazPKG file but not Thunar and othet FM. TazPKGbox try to
     1.8 +# follow freedesktop standards.
     1.9 +#
    1.10 +# Copyright (C) 2012 SliTaz GNU/Linux - GNU gpl v2
    1.11 +#
    1.12 +# Authors : Christophe Lincoln <pankso@slitaz.org>
    1.13 +#
    1.14 +
    1.15 +# Main GUI box function with pure Yad spec
    1.16 +actions_main() {
    1.17 +	title=$(gettext "TazPKG actions")
    1.18 +	text=$(gettext "Package file name:")
    1.19 +	yad --text="$text <b>$pkg</b>" \
    1.20 +		--width=520 --height=80 --dialog-sep \
    1.21 +		--center --on-top --window-icon="tazpkg" \
    1.22 +		--image="tazpkg" --image-on-top \
    1.23 +		--button="Install:3" --button="Extract:2" \
    1.24 +		--button="gtk-close:1"
    1.25 +}
    1.26 +
    1.27 +# Actions user can do when clicking on a package.
    1.28 +actions() {
    1.29 +	# Store box results
    1.30 +	main=$(actions_main)
    1.31 +	ret=$?
    1.32 +	# Deal with --button values
    1.33 +	case $ret in
    1.34 +		1) exit 0 ;;
    1.35 +		2) tazpkg extract $pkg && exit 0 ;;
    1.36 +		3) tazpkg -i $pkg --forced | tazbox out && exit 0 ;;
    1.37 +	esac
    1.38 +}
    1.39 +
    1.40 +#
    1.41 +# Script commands
    1.42 +#
    1.43 +
    1.44 +case "$1" in
    1.45 +	usage)
    1.46 +		echo "Usage: $(basename $0) [command]" ;;
    1.47 +	actions)
    1.48 +		pkg="$2"
    1.49 +		actions ;;
    1.50 +esac
    1.51 +
    1.52 +exit 0
    1.53 +