#!/bin/sh

#
# The <tree> tag can hold the following attributes for using as a default icon:
#   o stock or stock-id
#   o icon or icon-name
#

GTKDIALOG=gtkdialog

TMPDIR=/tmp/gtkdialog/examples/"`basename $0`"
mkdir -p "$TMPDIR"

cat <<EOF > "$TMPDIR"/inputfile
gtk-cdrom    | CD_ROM Drive  | /cdrom/    | ak.tex
gtk-floppy   | Floppy Disk   | /floppy/   | ak.dvi
gtk-harddisk | Hard Disk     | /harddisk/ | ak.ps
gtk-network  | Network Drive | /network/  | ak.pdf
gtk-delete   | Trash         | /trash/    | 
EOF

MAIN_DIALOG='
<window>
	<vbox>
		<text label="Default stock icon is gtk-apply"></text>
		<tree stock-id="gtk-apply">
			<variable>TREE1</variable>
			<height>250</height>
			<width>400</width>
			<label>Device                        | Directory | File</label>
			<item>Floppy Disk | /floppy/  | ak.tex</item>
			<item>Floppy Disk | /floppy/  | ak.dvi</item>
			<item icon-name="scribus">Floppy Disk | /floppy/  | ak.ps</item>
			<item icon-name="top">Floppy Disk | /floppy/  | ak.pdf</item>
			<item stock-id="gtk-cdrom">CD_ROM Drive | /cdrom/   | </item>
			<input file stock-column="0">'"$TMPDIR"'/inputfile</input>
		</tree>
		<hseparator></hseparator>
		<text label="Default theme icon is gimp"></text>
		<tree icon-name="gimp">
			<variable>TREE2</variable>
			<height>250</height>
			<width>400</width>
			<label>Device                        | Directory | File</label>
			<item>Floppy Disk | /floppy/  | ak.tex</item>
			<item>Floppy Disk | /floppy/  | ak.dvi</item>
			<item icon-name="abiword">Floppy Disk | /floppy/  | ak.ps</item>
			<item icon-name="geany">Floppy Disk | /floppy/  | ak.pdf</item>
			<item stock-id="gtk-cdrom">CD_ROM Drive | /cdrom/   | </item>
			<input file stock-column="0">'"$TMPDIR"'/inputfile</input>
		</tree>
		<hseparator></hseparator>
		<hbox homogeneous="true">
			<button ok></button>
		</hbox>
	</vbox>
</window>
'
export MAIN_DIALOG

case $1 in
	-d | --dump) echo "$MAIN_DIALOG" ;;
	*) $GTKDIALOG --program=MAIN_DIALOG ;;
esac
