#!/bin/bash
#libstardust
#
#This box shows two button (Yes / No), one icon, and textstring(s)
#markup/span is valid
#
#usage :
# box_yesno HEADING "textstring1" "textstring2" "..."
#
# HEADING is a short description. Maybe the app-name of the sender.
# MSG-TYPE sets icon of icon and window. one of the following: complete, info, error or warning
# ICON is a svg file. If path is not defined, /usr/share/pixmaps/puppy/ will be used
# 
#Sigmund Berglund, apr 2014
#GPL

export TEXTDOMAIN=libstardust

HEADING="$1"


S='
<window title="'$HEADING'" icon-name="'$ICON_WM'">
<vbox space-expand="true" space-fill="true">
  <frame '$HEADING'>
    <hbox homogeneous="true">
      '"`/usr/lib/gtkdialog/xml_pixmap "dialog-question" popup`"'
    </hbox>
    <hbox border-width="10" homogeneous="true">
      <vbox space-expand="false" space-fill="false">'
        [ "$2" ] && S=$S'<text xalign="0" use-markup="true"><label>"'$2'"</label></text>'
        [ "$3" ] && S=$S'<text xalign="0" use-markup="true"><label>"'$3'"</label></text>'
        [ "$4" ] && S=$S'<text xalign="0" use-markup="true"><label>"'$4'"</label></text>'
        [ "$5" ] && S=$S'<text xalign="0" use-markup="true"><label>"'$5'"</label></text>'
        S=$S'</vbox>
     </hbox>
  </frame>
  <hbox space-expand="false" space-fill="false">
    <button>
      '"`/usr/lib/gtkdialog/xml_button-icon no`"'
      <label>" '$(gettext 'No')' "</label>
      <action>EXIT:no</action>
    </button>
    <button>
      '"`/usr/lib/gtkdialog/xml_button-icon yes`"'
      <label>" '$(gettext 'Yes')' "</label>
      <action>EXIT:yes</action>
    </button>
  </hbox>
</vbox>
</window>'

export box_yesno="$S"

I=$IFS; IFS=""
for STATEMENTS in  $(gtkdialog --center -p box_yesno); do
	eval $STATEMENTS
done
IFS=$I
