You right. But thereis no easy way to solve it as i see. becouse gtkdialog does not give you the entered command line args.
what works fine is a helper-script.
Code: Select all
#!/bin/bash
export ORIGIFILE="$@"
`./ppdf`
Code: Select all
#!/bin/bash
export ORIGIFILE="$@"
`./ppdf`
Code: Select all
ORIGIEXT=${ORIGIFILE##*.}
export ORIGIEXT
Code: Select all
export MAIN_DIALOG='
<vbox>
<entry>
<input>echo $ORIGINALFILE</input>
<variable>ORIGINALFILE</variable>
######<action>change_pdf</action>######
<action>refresh:PDFFILE</action>
</entry>
<entry>
<input>change_pdf</input>
<variable>PDFFILE</variable>
</entry>
Code: Select all
export test="
<entry accept=\"directory\" width-request=\"300\">
<default>Drag a directory from Rox</default>
</entry>"
gtkdialog3 -p test
Code: Select all
#!/bin/sh
move (){
PRESS_EVENT="`cat /tmp/PRESS_EVENT`"
grep -Fv "$PRESS_EVENT" /tmp/list > /tmp/tmp
grep -Fm1 -B500 "$TREE" /tmp/tmp | grep -v "$TREE" > /tmp/tmp1
echo "$PRESS_EVENT" >> /tmp/tmp1
grep -Fm1 -A500 "$TREE" /tmp/tmp >> /tmp/tmp1
mv -f /tmp/tmp1 /tmp/list
}
export -f move
ls -1 /usr/share/backgrounds > /tmp/list
export test="
<tree rules_hint=\"true\" hover-selection=\"true\" tooltip-text=\"Drag'n drop items to move them in list\">
<label>Backgrounds</label>
<input>cat /tmp/list</input>
<variable>TREE</variable>
<height>300</height><width>200</width>
<action signal=\"button-press-event\">echo \$TREE > /tmp/PRESS_EVENT</action>
<action signal=\"button-release-event\">move</action>
<action signal=\"button-release-event\">refresh:TREE</action>
</tree>"
gtkdialog3 -p test
Code: Select all
#!/bin/sh
export TITLE="Kernel messages"
export TAILFILE=/var/log/messages
echo 99 > /tmp/tailbox_progress
echo " " > /tmp/tailbox_text
tailing (){
I=`cat /tmp/tailbox_progress`
echo $TITLE
echo $I
sleep 1
[ -s "$TAILFILE" ] && tail -n 20 "$TAILFILE" | tr '\r' '\n' | tail -n 20 > /tmp/tailbox_text
echo 100 > /tmp/tailbox_progress
}
export -f tailing
export tailbox="
<window title=\"tailbox\">
<vbox>
<progressbar>
<input>"'while [ A != B ]; do tailing; done'"</input>
<action>refresh:TAIL</action>
<action>echo 99 > /tmp/tailbox_progress</action>
</progressbar>
<edit>
<variable>TAIL</variable>
<input file>/tmp/tailbox_text</input>
<width>300</width><height>380</height>
</edit>
</vbox>
</window>"
I=$IFS; IFS=""
for STATEMENTS in $(gtkdialog3 -p tailbox); do
eval $STATEMENTS
done
IFS=$I
Code: Select all
<radiobutton>
<variable>VAR</variable>
<label>some text</label>
<default>true</default>
</radiobutton>
Code: Select all
VAR1=true
VAR2=false
Code: Select all
<radiobutton>
<variable>VAR1</variable>
<label>some text</label>
<default>$VAR1</default>
<radiobutton>
<variable>VAR2</variable>
<label>some other text</label>
<default>$VAR2</default>
</radiobutton>
Code: Select all
#!/bin/bash
WORKDIR="/root/radiobutton-test"
. $WORKDIR/variables
export radiobuttonfun="
<window title=\"fun?\">
<vbox>
<frame Having fun yet?>
<radiobutton>
<variable>VAR1</variable>
<label>Yes I am</label>
<default>$VAR1</default>
</radiobutton>
<radiobutton>
<variable>VAR2</variable>
<label>No I'm not</label>
<default>$VAR2</default>
</radiobutton>
</frame>
<hbox>
<button ok></button>
</hbox>
</vbox>
</window>"
gtkdialog3 --program=radiobuttonfun > $WORKDIR/variables
Code: Select all
VAR1=true
VAR2=false
Code: Select all
COMBOBOX="item 3"
ENTRY="default text"
RADIOBUTTON1="false"
RADIOBUTTON2="true"
Code: Select all
#!/bin/bash
. $HOME/.testrc
#in case no testc file (first run), build the file
[ ! -s $HOME/.testrc ] && echo -n 'COMBOBOX="item 3"\nENTRY="default text"\nRADIOBUTTON1="false"\nRADIOBUTTON2="true"'
#define combobox list items
COMBOBOX_ITEMS="<item>$COMBOBOX</item>" #stored value should be first in list
for I in 1 2 3 4; do COMBOBOX_ITEMS=`echo "$COMBOBOX_ITEMS<item>item $I</item>"`; done
export test="
<window title=\"The benefits of a config file\">
<vbox>
<frame The first item of list is the default choice in a Combobox>
<combobox>
<variable>COMBOBOX</variable>
$COMBOBOX_ITEMS
</combobox>
</frame>
<frame If nothing else is set, the first radiobutton is the active one>
<radiobutton>
<variable>RADIOBUTTON1</variable>
<label>Yes I am</label>
<default>$RADIOBUTTON1</default>
</radiobutton>
<radiobutton>
<variable>RADIOBUTTON2</variable>
<label>No I'm not</label>
<default>$RADIOBUTTON2</default>
</radiobutton>
</frame>
<frame Fetch entry-value from config file>
<entry>
<variable>ENTRY</variable>
<default>$ENTRY</default>
</entry>
</frame>
<hbox>
<button ok></button>
</hbox>
</vbox>
</window>"
gtkdialog3 -p test > $HOME/.testrc