#!/bin/bash

#
# The <input> tags can have attributes setting which input column holds the
# icon information:
#   o stock-column
#   o icon-column
#

# This example requires bash.

[ -z $GTKDIALOG ] && GTKDIALOG=gtkdialog

funcInputstock() {
	echo "gtk-open | | gtk-open | 2 "
	echo "gtk-about | | gtk-about | 2 "
	echo "gtk-add | | gtk-add | 2 "
	echo "gtk-apply | | gtk-apply | 2 "
	echo "gtk-bold | | gtk-bold | 2 "
	echo "gtk-cancel | | gtk-cancel | 2 "
	echo "gtk-cdrom | | gtk-cdrom | 2 "
	echo "gtk-clear | | gtk-clear | 2 "
	echo "gtk-close | | gtk-close | 2 "
	echo "gtk-color-picker | | gtk-color-picker | 2 "
	echo "gtk-convert | | gtk-convert | 2 "
}; export -f funcInputstock

funcInputicon() {
	echo "gimp | | gimp | 2 "
	echo "gnumeric | | gnumeric | 2 "
	echo "geany | | geany | 2 "
	echo "viewnior | | viewnior | 2 "
	echo "xarchive | | xarchive | 2 "
	echo "scribus | | scribus | 2 "
	echo "inkscape | | inkscape | 2 "
	echo "html | | html | 2 "
	echo "top | | top | 2 "
	echo "midori | | midori | 2 "
	echo "abiword | | abiword | 2 "
}; export -f funcInputicon

export MAIN_DIALOG='
<window>
	<vbox>
		<hbox>
			<frame Stock icons from input command>
				<tree>
					<variable>TREE1</variable>
					<height>300</height>
					<width>200</width>
					<label>0 | 1 | 2</label>
					<input stock-column="0">bash -c funcInputstock</input>
				</tree>
			</frame>
			<frame Theme icons from input command>
				<tree>
					<variable>TREE2</variable>
					<height>300</height>
					<width>200</width>
					<label>0 | 1 | 2</label>
					<input icon-column="0">bash -c funcInputicon</input>
				</tree>
			</frame>
		</hbox>
		<hbox homogeneous="true">
			<button ok></button>
		</hbox>
	</vbox>
</window>
'

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