tazpkg rev 174

tazpkgbox: add double click for depends & suggested
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Oct 20 16:34:19 2008 +0000 (2008-10-20)
parents e47a62082826
children 81e4b898f741
files lib/tazpkgbox/package_infos
line diff
     1.1 --- a/lib/tazpkgbox/package_infos	Mon Oct 20 10:55:16 2008 +0000
     1.2 +++ b/lib/tazpkgbox/package_infos	Mon Oct 20 16:34:19 2008 +0000
     1.3 @@ -43,6 +43,52 @@
     1.4  	exit 0
     1.5  fi
     1.6  
     1.7 +if [ "$1" = "list_packages" ]; then
     1.8 +	PKG="$2"
     1.9 +	if [ -n "$3" ]; then
    1.10 +		shift
    1.11 +		export LIST_PKGS='
    1.12 +<window title="Packages" icon-name="tazpkg">
    1.13 +  <vbox>
    1.14 +     <tree>
    1.15 +	<width>600</width><height>160</height>
    1.16 +	<label>Package|Version|Size|Description</label>
    1.17 +	<variable>PKG</variable>
    1.18 +'
    1.19 +		for i in "$@"; do
    1.20 +			if [ -d /var/lib/tazpkg/installed/$i ]; then
    1.21 +				. /var/lib/tazpkg/installed/$i/receipt
    1.22 +				LIST_PKGS="$LIST_PKGS
    1.23 +	<item icon=\"tazpkg\">$i|$VERSION|Installed|$SHORT_DESC</item>
    1.24 +"
    1.25 +			else
    1.26 +				RES=`grep "^$i " /var/lib/tazpkg/packages.desc`
    1.27 +				PACKAGE=`echo "$RES" | cut -d "|" -f 1`
    1.28 +				VERSION=`echo "$RES" | cut -d "|" -f 2`
    1.29 +				SHORT_DESC=`echo "$RES" | cut -d "|" -f 3`
    1.30 +				SIZE=`grep -A 3 "^$(echo $PACKAGE)$" /var/lib/tazpkg/packages.txt | tail -1 | sed 's/.*(\(.*\) .*/\1/'`
    1.31 +				LIST_PKGS="$LIST_PKGS
    1.32 +	<item icon=\"tazpkg\">$i|$VERSION|$SIZE|$SHORT_DESC</item>
    1.33 +"
    1.34 +			fi
    1.35 +		done
    1.36 +		LIST_PKGS="$LIST_PKGS
    1.37 +     </tree>
    1.38 +     <hbox>
    1.39 +	<button ok>
    1.40 +	</button>
    1.41 +	<button cancel>
    1.42 +		<action type=\"closewindow\">LIST_PKGS</action>
    1.43 +	</button>
    1.44 +     </hbox>
    1.45 +  </vbox>
    1.46 +</window>
    1.47 +"
    1.48 +		eval `gtkdialog --center --program=LIST_PKGS`
    1.49 +		[ "$EXIT" = "OK" ] || exit 0
    1.50 +	fi
    1.51 +fi
    1.52 +
    1.53  export LIST_FILES="
    1.54  <window title=\"$PKG files\" icon-name=\"system-file-manager\">
    1.55    <vbox>
    1.56 @@ -94,7 +140,7 @@
    1.57  <vbox>
    1.58  
    1.59  	<tree>
    1.60 -		<width>460</width><height>160</height>
    1.61 +		<width>460</width><height>200</height>
    1.62  		<label>$PKG|$SHORT_DESC</label>
    1.63  		<variable>FIELD</variable>
    1.64  		<item icon=\"tazpkg\">Version: | $VERSION</item>
    1.65 @@ -111,7 +157,7 @@
    1.66  		<item icon=\"error\">Bugs: | $BUGS</item>"
    1.67  PACKAGE_INFOS="$PACKAGE_INFOS
    1.68  		<item icon=\"applications-internet\">Web site: | $WEB_SITE</item>
    1.69 -		<action>case \$FIELD in Web*) firefox $WEB_SITE &;; esac</action>
    1.70 +		<action>case \$FIELD in Web*) firefox $WEB_SITE &;; Sug*) $0 list_packages $SUGGESTED;; Dep*) $0 list_packages $DEPENDS;; esac</action>
    1.71  	</tree>
    1.72  
    1.73  	<hbox>"
    1.74 @@ -194,7 +240,7 @@
    1.75  <vbox>
    1.76  
    1.77  	<tree>
    1.78 -		<width>460</width><height>140</height>
    1.79 +		<width>460</width><height>160</height>
    1.80  		<label>$PKG|$SHORT_DESC</label>
    1.81  		<item icon=\"tazpkg\">Name: | $PACKAGE</item>
    1.82  		<item icon=\"tazpkg\">Version: | $VERSION</item>