tazpkg annotate tazpkg-box @ rev 603

**tazpkg**: add common output functions: action, title, footer; change the way category translate, localized categories can include spaces; implement boldify, emsg & confirm functions from new libtaz; rename log function to log_pkg; fix check_root invocation; fix convert_rpm function; implement plural i18n messages; list-mirror: --text|--txt|--raw|* produces same output; extract: check for errors in final message; list-config --box: do we need it?; repack-config: date/time in receipt in local format; '--help-up' changed to 'help-up' due to error with new libtaz. **tazpkg-box**: add i18n preamble; fix actions. **tazpkg-notify**: implement plural. **Makefile**: support new functions & tazpkg-box. **po/**: Make pot & msgmerge. Add Russian translation. Add Spanish translation for tazpkg-notify (thanks Kevin Fabian Quintero).
author Aleksej Bobylev <al.bobylev@gmail.com>
date Sat Jun 23 00:51:57 2012 +0000 (2012-06-23)
parents 90038f19958b
children 5317ffe7bfbb
rev   line source
pankso@541 1 #!/bin/sh
pankso@541 2 #
paul@579 3 # Small GTK boxes to TazPKG for deep desktop integration. PcmanFM 0.5.x has a
paul@579 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 #
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
al@603 12 # Internationalization.
al@603 13 . /usr/bin/gettext.sh
al@603 14 TEXTDOMAIN='tazpkg'
al@603 15 export TEXTDOMAIN
al@603 16
pankso@589 17 title=$(gettext "TazPKG Action")
pankso@555 18 icon="/usr/share/pixmaps/tazpkg.png"
pankso@589 19 opts="--image=tazpkg --image-on-top --width=520 --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>" \
pankso@589 24 --height=260 --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 \
pankso@589 33 --title="$title" --height=100 \
pankso@589 34 --window-icon=$icon --image-on-top \
al@603 35 --button="$(gettext 'Install'):3" --button="$(gettext 'Extract'):2" \
pankso@541 36 --button="gtk-close: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
pankso@589 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@603 67 progname=$(basename $0)
al@603 68 eval_gettext "Usage: \$progname [actions|url] [pkg]" ;;
pankso@589 69 tazpkg://*)
pankso@589 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