tazpkg annotate 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
rev   line source
pankso@541 1 #!/bin/sh
pankso@541 2 #
pankso@555 3 # Small GTK boxes to TazPKG for deep desktop integration. PcmanFM 0.5.x have a
pankso@555 4 # patch to extract TazPKG file but not Thunar and othet FM. TazPKGbox try to
pankso@541 5 # follow freedesktop standards.
pankso@541 6 #
pankso@541 7 # Copyright (C) 2012 SliTaz GNU/Linux - GNU gpl v2
pankso@541 8 #
pankso@541 9 # Authors : Christophe Lincoln <pankso@slitaz.org>
pankso@541 10 #
pankso@541 11
pankso@555 12 icon="/usr/share/pixmaps/tazpkg.png"
pankso@555 13
pankso@541 14 # Main GUI box function with pure Yad spec
pankso@541 15 actions_main() {
pankso@541 16 title=$(gettext "TazPKG actions")
pankso@555 17 text=$(gettext "Package name:")
pankso@555 18 yad --text="$text <b>${pkg%.tazpkg}</b>" \
pankso@555 19 --title="$title" --width=480 --height=100 \
pankso@555 20 --center --on-top --window-icon=$icon \
pankso@541 21 --image="tazpkg" --image-on-top \
pankso@541 22 --button="Install:3" --button="Extract:2" \
pankso@541 23 --button="gtk-close:1"
pankso@541 24 }
pankso@541 25
pankso@541 26 # Actions user can do when clicking on a package.
pankso@541 27 actions() {
pankso@541 28 # Store box results
pankso@541 29 main=$(actions_main)
pankso@541 30 ret=$?
pankso@541 31 # Deal with --button values
pankso@541 32 case $ret in
pankso@541 33 1) exit 0 ;;
pankso@555 34 2) tazpkg extract $pkg | $0 output ;;
pankso@555 35 3) tazpkg -i $pkg --forced | $0 output ;;
pankso@541 36 esac
pankso@541 37 }
pankso@541 38
pankso@541 39 #
pankso@541 40 # Script commands
pankso@541 41 #
pankso@541 42
pankso@541 43 case "$1" in
pankso@555 44 usage|help|-u|-h)
pankso@555 45 echo "Usage: $(basename $0) [command] [pkg|cmd]" ;;
pankso@555 46 output)
pankso@555 47 # Nice GTK output for install and extract.
pankso@555 48 sed -e s'/\[^Gm]*./ /g' -e s'/^=.*//' | \
pankso@555 49 yad --text-info \
pankso@555 50 --width=480 --height=260 --center --on-top \
pankso@555 51 --title="TazPKG" --window-icon=$icon \
pankso@555 52 --fore="#ffffff" --back="#000000" --wrap \
pankso@555 53 --margins=4 --button="gtk-close:0" ;;
pankso@541 54 actions)
pankso@555 55 pkg=$(basename $2)
pankso@555 56 cd $(dirname $2)
pankso@541 57 actions ;;
pankso@541 58 esac
pankso@541 59
pankso@541 60 exit 0
pankso@541 61