Here's a sample:
Code: Select all
DEVICE_FILE="/root/my-applications/bin/activeMTPdevices.txt"
export DEVICE_DIALOG_LIST='
<window title="The list">
<vbox>
<comboboxtext active="0">
<variable>RESULT</variable>
<input file>'${DEVICE_FILE}'</input>
</comboboxtext>
<hbox>
<button ok>
<action>exit:PROCEED</action>
</button>
<button cancel>
<action>exit:CANCEL</action>
</button>
</hbox>
</vbox>
</window>'
# In order to access returned variables, we have to evaluate them first
eval `gtkdialog --program DEVICE_DIALOG_LIST`
# EXIT states "PROCEED" and "CANCEL" are defined above, but "abort" is internal
if [ "$EXIT" = "PROCEED" ]; then
xmessage "$RESULT" #show the result
elif [ "$EXIT" = "CANCEL" ]; then
xmessage "Cancelled"
elif [ "$EXIT" = "abort" ]; then
xmessage "Window closed via X"
fi