tazpkg view 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
line source
1 #!/bin/sh
2 #
3 # Small GTK boxes to TazPKG for deep desktop integration. PcmanFM 0.5.x has a
4 # patch to extract a TazPKG file but not Thunar and other FM. TazPKGbox tries
5 # to follow freedesktop standards.
6 #
7 # Copyright (C) 2012 SliTaz GNU/Linux - GNU gpl v2
8 #
9 # Authors : Christophe Lincoln <pankso@slitaz.org>
10 #
12 # Internationalization.
13 . /usr/bin/gettext.sh
14 TEXTDOMAIN='tazpkg'
15 export TEXTDOMAIN
17 title=$(gettext "TazPKG Action")
18 icon="/usr/share/pixmaps/tazpkg.png"
19 opts="--image=tazpkg --image-on-top --width=520 --center --on-top"
21 # Nice GTK output for install and extract.
22 output() {
23 yad --text-info $opts --text="<b>$title</b>" \
24 --height=260 --title="$title" --window-icon=$icon \
25 --tail --margins=4 --button="gtk-close:0"
26 }
28 # Main GUI box function with pure Yad spec
29 actions_main() {
30 pkgname=${pkg%.tazpkg}
31 text=$(eval_gettext 'Package name: <b>$pkgname</b>')
32 yad --text="$text" $opts \
33 --title="$title" --height=100 \
34 --window-icon=$icon --image-on-top \
35 --button="$(gettext 'Install'):3" --button="$(gettext 'Extract'):2" \
36 --button="gtk-close:1"
37 }
39 # Actions user can do when clicking on a package.
40 actions() {
41 # Store box results
42 main=$(actions_main)
43 ret=$?
44 # Deal with --button values
45 case $ret in
46 1) exit 0 ;;
47 2) tazpkg extract $pkg . --output="raw" | output ;;
48 3) tazpkg -i $pkg . --forced --output="raw" | output ;;
49 esac
50 }
52 # TazPKG URL Handler.
53 dl_inst() {
54 pkg=$(basename $url)
55 eval_gettext "Downloading: \$pkg"; echo -e "\n"
56 cd /tmp && wget $url 2>&1
57 tazpkg -i $pkg --forced --output="raw" 2>&1
58 rm -f $pkg
59 }
61 #
62 # Script commands
63 #
65 case "$1" in
66 usage|help|-u|-h)
67 progname=$(basename $0)
68 eval_gettext "Usage: \$progname [actions|url] [pkg]" ;;
69 tazpkg://*)
70 # TazPKG URL's handler.
71 url="http://${1#tazpkg://}"
72 dl_inst | output ;;
73 actions)
74 pkg=$(basename $2)
75 cd $(dirname $2)
76 actions ;;
77 esac
79 exit 0