Sophie

Sophie

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

gtkdialog-0.8.3-1.mga5.x86_64.rpm

#!/bin/bash

# This example requires bash.

# Notice that the function print_this() is also being executed using /bin/bash
# within the action directive and the reason for this is that Gtkdialog is a
# C program and the C library will execute a system command using /bin/sh.
# Ubuntu users whose /bin/sh links to dash especially should be aware of this.

GTKDIALOG=gtkdialog

print_this() {
	echo "print: $1"
}; export -f print_this

export MAIN_DIALOG='
<window>
	<vbox>
		<button>
			<label>function</label>
			<action>bash -c "print_this button"</action>
		</button>
		<button>
			<label>Exit</label>
		</button>
	</vbox>
</window>
'

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