Sophie

Sophie

distrib > Mageia > 5 > x86_64 > media > core-release > by-pkgid > 13f5dcef5358e9d5a2a5a1ae6baf28fc > files > 70

gtkdialog-0.8.3-1.mga5.x86_64.rpm

#!/bin/sh

GTKDIALOG=gtkdialog

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

printf "First item\nSecond item\nThird item" > "$TMPDIR"/inputfile

funcbtnCreate() {
	echo '<button>
				<label>'$2'</label>
				<action>echo "'$3' '$1'"</action>
				<action function="'$2'">'$1'</action>
			</button>'
}

MAIN_DIALOG='
<window>
	<vbox>
		<list>
			<variable>LIST</variable>
			<width>350</width>
			<height>150</height>
			<input file>'"$TMPDIR"'/inputfile</input>
			<output file>'"$TMPDIR"'/outputfile</output>
			<action>echo "The chosen item is \"$LIST\""</action>
		</list>
		<hbox>
			'"`funcbtnCreate LIST Disable Disabling`"'
			'"`funcbtnCreate LIST Enable Enabling`"'
			'"`funcbtnCreate LIST Hide Hiding`"'
			'"`funcbtnCreate LIST Show Showing`"'
		</hbox>
		<hbox>
			'"`funcbtnCreate LIST Save Saving`"'
			'"`funcbtnCreate LIST Refresh Refreshing`"'
			'"`funcbtnCreate LIST Clear Clearing`"'
			'"`funcbtnCreate LIST Removeselected Deleting`"'
		</hbox>
		<hseparator space-expand="false" space-fill="false"></hseparator>
		<hbox space-expand="false" space-fill="false">
			<button cancel></button>
			<button ok></button>
		</hbox>
	</vbox>
</window>
'
export MAIN_DIALOG

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