In my latest version of puppy clock I warn the user that
a feature needs an update of GTKDIALOG to work
At the bottom of this page there is a discussion
by Thunor on warning a user that an update is needed.
First of all all scripts should begin with this code to
create a variable GTKDIALOG
Code: Select all
for P in gtkdialog4 gtkdialog3 gtkdialog; do
GTKDIALOG=$(which $P) && break
done
Code: Select all
function funcGTKDVGet() {
GTKDV=( $($GTKDIALOG -v) )
GTKDV=${GTKDV[2]}
echo "Gtkdialog version: $GTKDV"
}
When the button is clicked( to launch the new feature
i.e. a World Clock) a function is called that has this
if statement to launch a warning message using yaf-spash
Code: Select all
CHECK_VERSION=`funcGTKDVGet | awk '{ print $3 }'`
if [ ${CHECK_VERSION:2:1} -gt 7 ] ; then
...
else
yaf-splash -bg_gradient false -fontsize large -bg orange -close box -deco "Puppy Clock" -text "
You must update your version of GTKDIALOG
to use the World Clock feature.
" &
fi
The code that thunor gives is better to make the comparison
of versions since I simply check if version 8 has been installed.
Code: Select all
function funcGTKDVGet() {
GTKDV=( $($GTKDIALOG -v) )
GTKDV=${GTKDV[2]}
echo "Gtkdialog version: $GTKDV"
GTKDV=( ${GTKDV//./ } )
if [ ${GTKDV[1]} -lt 10 ]; then GTKDV[1]=${GTKDV[1]}0; fi
if [ ${GTKDV[2]} -lt 10 ]; then GTKDV[2]=0${GTKDV[2]}; fi
}; funcGTKDVGet
if [ ${GTKDV[1]}${GTKDV[2]} -lt "7021" ]; then
echo "This application requires at least gtkdialog-0.7.21"
exit
fi
_____________________________________________