a new spin on gtkdialog NOT using export
Posted: 26 Apr 2012, 14:09
After a lot of thinking about how gtkdialog exports an enormous string into global memory
and most of the time as MAIN_DIALOG= I decided to try another "local" way of handling strings instead
this is a modular approach in little blocks that you add
# a new spin on gtkdialog by Joe Arose bigbass
# 1.) We won't export a large string into global memory now this acts as "local" variables instead
# 2.) We will take input -s, --stdin Get the GUI description from standard input.
#--------------------------
# original example of using gtkdialog
#--------------------------
#!/bin/bash
export MAIN_DIALOG='
<vbox>
<text>
<label>This is a static text.</label>
</text>
<hbox>
<button ok></button>
<button cancel></button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG
# here is another example trying to maintain a readable XML format
#--------------------------
# a new way of using gtkdialog without export
#--------------------------
and most of the time as MAIN_DIALOG= I decided to try another "local" way of handling strings instead
this is a modular approach in little blocks that you add
# a new spin on gtkdialog by Joe Arose bigbass
# 1.) We won't export a large string into global memory now this acts as "local" variables instead
# 2.) We will take input -s, --stdin Get the GUI description from standard input.
Code: Select all
TEXT='Hello'
echo '<text><label>Content of variable is: '"$TEXT"'</label></text>' | gtkdialog -s
Code: Select all
TEXT2='Hello again '
echo '<text><label>Content of variable is: '"$TEXT2"'</label></text>' | gtkdialog -s
# original example of using gtkdialog
#--------------------------
#!/bin/bash
export MAIN_DIALOG='
<vbox>
<text>
<label>This is a static text.</label>
</text>
<hbox>
<button ok></button>
<button cancel></button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG
# here is another example trying to maintain a readable XML format
#--------------------------
# a new way of using gtkdialog without export
#--------------------------
Code: Select all
echo ' <vbox>
<text>
<label>This is a static text.</label>
</text>
<hbox>
<button ok>
</button>
<button cancel>
</button>
</hbox>
</vbox>'| gtkdialog -s