tazpkg annotate tazpkg-box @ rev 633
Add Polish translation (thanks Pawel Pyrczak); merge tazpkg, tazpkg-notify and other *pkg* translations into one; simplify plural translations using $num; normalize name (Tazpkg, TazPKG -> TazPkg); move markup outside translations; re-use categories names in tazpkg and tazpanel; other tiny improvements.
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Thu Jul 25 01:47:48 2013 +0300 (2013-07-25) |
parents | de952705379e |
children | 192b971ccc93 |
rev | line source |
---|---|
pankso@541 | 1 #!/bin/sh |
pankso@541 | 2 # |
al@633 | 3 # Small GTK boxes to TazPkg for deep desktop integration. PcmanFM 0.5.x has a |
al@633 | 4 # patch to extract a TazPkg file but not Thunar and other FM. TazPkgBox tries |
paul@579 | 5 # to follow freedesktop standards. |
pankso@541 | 6 # |
al@633 | 7 # Copyright (C) 2011-2013 SliTaz GNU/Linux - GNU GPL v2 |
pankso@541 | 8 # |
al@633 | 9 # Authors: Christophe Lincoln <pankso@slitaz.org> |
pankso@541 | 10 # |
pankso@541 | 11 |
al@603 | 12 # Internationalization. |
al@603 | 13 . /usr/bin/gettext.sh |
al@603 | 14 TEXTDOMAIN='tazpkg' |
al@603 | 15 export TEXTDOMAIN |
al@603 | 16 |
al@633 | 17 title=$(gettext "TazPkg Action") |
pankso@555 | 18 icon="/usr/share/pixmaps/tazpkg.png" |
al@633 | 19 opts="--image=tazpkg --image-on-top --center --on-top" |
pankso@589 | 20 |
pankso@589 | 21 # Nice GTK output for install and extract. |
pankso@589 | 22 output() { |
pankso@589 | 23 yad --text-info $opts --text="<b>$title</b>" \ |
al@633 | 24 --height=260 --width=520 --title="$title" --window-icon=$icon \ |
pankso@589 | 25 --tail --margins=4 --button="gtk-close:0" |
pankso@589 | 26 } |
pankso@555 | 27 |
pankso@541 | 28 # Main GUI box function with pure Yad spec |
pankso@541 | 29 actions_main() { |
al@603 | 30 pkgname=${pkg%.tazpkg} |
al@603 | 31 text=$(eval_gettext 'Package name: <b>$pkgname</b>') |
al@603 | 32 yad --text="$text" $opts \ |
al@633 | 33 --title="$title" \ |
al@633 | 34 --window-icon=$icon \ |
al@603 | 35 --button="$(gettext 'Install'):3" --button="$(gettext 'Extract'):2" \ |
al@633 | 36 --button="gtk-cancel:1" |
pankso@541 | 37 } |
pankso@541 | 38 |
pankso@541 | 39 # Actions user can do when clicking on a package. |
pankso@541 | 40 actions() { |
pankso@541 | 41 # Store box results |
pankso@541 | 42 main=$(actions_main) |
pankso@541 | 43 ret=$? |
pankso@541 | 44 # Deal with --button values |
pankso@541 | 45 case $ret in |
pankso@541 | 46 1) exit 0 ;; |
al@603 | 47 2) tazpkg extract $pkg . --output="raw" | output ;; |
al@603 | 48 3) tazpkg -i $pkg . --forced --output="raw" | output ;; |
pankso@541 | 49 esac |
pankso@541 | 50 } |
pankso@541 | 51 |
al@633 | 52 # TazPkg URL Handler. |
pankso@589 | 53 dl_inst() { |
pankso@589 | 54 pkg=$(basename $url) |
al@603 | 55 eval_gettext "Downloading: \$pkg"; echo -e "\n" |
pankso@589 | 56 cd /tmp && wget $url 2>&1 |
pankso@595 | 57 tazpkg -i $pkg --forced --output="raw" 2>&1 |
pankso@589 | 58 rm -f $pkg |
pankso@589 | 59 } |
pankso@589 | 60 |
pankso@541 | 61 # |
pankso@541 | 62 # Script commands |
pankso@541 | 63 # |
pankso@541 | 64 |
pankso@541 | 65 case "$1" in |
pankso@555 | 66 usage|help|-u|-h) |
al@633 | 67 echo "$(gettext 'Usage:') $(basename $0) [actions|$(gettext 'URL')] \ |
al@633 | 68 [$(gettext 'package')]" ;; |
pankso@589 | 69 tazpkg://*) |
al@633 | 70 # TazPkg URL's handler. |
pankso@589 | 71 url="http://${1#tazpkg://}" |
pankso@589 | 72 dl_inst | output ;; |
pankso@541 | 73 actions) |
pankso@555 | 74 pkg=$(basename $2) |
pankso@555 | 75 cd $(dirname $2) |
pankso@541 | 76 actions ;; |
pankso@541 | 77 esac |
pankso@541 | 78 |
pankso@541 | 79 exit 0 |
pankso@541 | 80 |