#!/bin/sh

[ -z $GTKDIALOG ] && GTKDIALOG=gtkdialog

# Get the filenames of the first three images in /usr/share/icons
IMAGEFILES="`find /usr/share/icons -maxdepth 1 -type f | head -3`"
index=0
for f in $IMAGEFILES; do
	eval IMAGEFILE$index="$f"
	index=$((index + 1))
done

MAIN_DIALOG='
<window title="MenuBar" resizable="false" width-request="360"
	height-request="240" border-width="0">
	<vbox spacing="0">
		<menubar>
			<menu label="_Stock Images" use-underline="true">
				<menuitem stock-id="gtk-about"></menuitem>
				<menuitem stock-id="gtk-add"></menuitem>
				<menuitemseparator></menuitemseparator>
				<menuitem stock-id="gtk-quit" accel-key="0x51" accel-mods="4">
					<action>exit:Quit</action>
				</menuitem>
			</menu>
			<menu use-underline="true">
				<menuitem icon-name="abiword" label="AbiWord"></menuitem>
				<menuitem icon-name="gnumeric" label="Gnumeric 32px">
					<height>32</height>
				</menuitem>
				<menuitem icon-name="gimp" label="_Gimp 48px" use-underline="true">
					<height>48</height>
				</menuitem>
				<label>"_Theme Images"</label>
			</menu>
			<menu use-underline="true">
				<menuitem image-name="'"$IMAGEFILE0"'" label="Original Size"></menuitem>
				<menuitem image-name="'"$IMAGEFILE1"'">
					<label>32px</label>
					<height>32</height>
					<width>32</width>
				</menuitem>
				<menuitem image-name="'"$IMAGEFILE2"'" label="48px">
					<height>48</height>
					<width>48</width>
				</menuitem>
				<label>"_File Images"</label>
			</menu>
		</menubar>
	</vbox>
</window>
'
export MAIN_DIALOG

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