Reputation: 127
I am attempting to open a config file for editing with geany by pressing a button within a gtkdialog form. I am new to bash and gtkdialog but would appreciate a push in the right direction.
#! /bin/bash
processconfig () {
geany config
}
export script='
<vbox>
<hbox>
<button>
<input file>settings_VV_small.png</input>
<variable>button1</variable>
</button>
</hbox>
</vbox>
'
I=$IFS;
IFS='
'
for STATEMENTS in $(gtkdialog --program=script); do
eval $STATEMENTS
done
if [[ $BUTTON1 == "true" ]]
then
echo "Opening Config File"
processconfig
fi
IFS=$I
[ $EXIT = sure ]
Upvotes: 0
Views: 581
Reputation: 6335
I don't know what is your Linux Distribution, but gtkdialog in Debian is no longer available and has been removed from Debian at 2009 with reason "unmaintained, better alternatives libraries".
Talking about "better alternatives" nowdays we have yad (apt-get install yad) , which is a fork of zenity but much more advanced.
As a result, your whole script can be replaced by two lines:
$ filetoopen=$(yad --file)
$ geany ""$filetoopen"
Studying the yad man pages, you will find million of options to tweak this gtk tool and customize your dialogs.
You can have an idea about yad dialogs here: http://smokey01.com/yad/
Upvotes: 1
Reputation: 127
Solved it.
if [ "$EXIT" = "OK" ]; then
echo "Opening Config File"
processconfig
else
echo "You pressed the Cancel button."
fi
Upvotes: 1