#!/bin/bash

# This example requires bash.

GTKDIALOG=gtkdialog

funcList() {
	ls -lha | grep ^d | awk '{print "dir_o|" $1 "|" $8}'
	ls -lha | grep ^- | awk '{print "gexec|" $1 "|" $8}'
}; export -f funcList

export MAIN_DIALOG='
<window>
	<vbox>
		<tree>
			<label>Permissions|Filename</label>
			<variable>TREE1</variable>
			<height>150</height>
			<width>400</width>
			<input icon-column="0">bash -c funcList</input>
		</tree>
		<hseparator></hseparator>
		<tree stock-id="gtk-file">
			<label>Icon Name|Permissions|Filename</label>
			<variable>TREE2</variable>
			<height>150</height>
			<width>400</width>
			<input>bash -c funcList</input>
		</tree>
		<hseparator></hseparator>
		<tree>
			<variable>TREE3</variable>
			<height>150</height>
			<width>400</width>
			<label>Device                           | Directory | File</label>
			<item stock-id="gtk-floppy">Floppy Disk | /floppy/  | ak.tex</item>
			<item stock-id="gtk-floppy">Floppy Disk | /floppy/  | ak.dvi</item>
			<item stock-id="gtk-floppy">Floppy Disk | /floppy/  | ak.ps</item>
			<item stock-id="gtk-floppy">Floppy Disk | /floppy/  | ak.pdf</item>
			<item stock-id="gtk-cdrom">CD_ROM Drive | /cdrom/   | </item>
		</tree>
		<hseparator></hseparator>
		<hbox homogeneous="true">
			<button ok></button>
		</hbox>
	</vbox>
</window>
'

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