#!/bin/sh
export TEXTDOMAIN=pburn

cd $HOME

export savebox='
<window title="pBurn - '$(gettext 'Save')'" icon-name="gtk-save">
 <vbox>
  <frame '$(gettext 'Save')'>
   <hbox>
    <entry '$ATTR' width-request="300" fs-title="Pmusic - '$(gettext 'Save')'" space-expand="true" space-fill="true">
     <variable>SAVEFILE</variable>
     <default>'"$(<$WORKDIR/SAVEFILE)"'</default>
    </entry>
     <button space-expand="false" space-fill="false">
      <input file stock="gtk-open"></input>
      <action type="fileselect">SAVEFILE</action>
     </button>
   </hbox>
  </frame>
  <hbox>
   <button>'"
    <input file stock=\"gtk-cancel\">
    </input><label>$(gettext 'Cancel')</label>
   </button>
   <button can-default=\"true\" has-default=\"true\" use-stock=\"true\">
    <input file stock=\"gtk-save\"></input>
    <label>$(gettext 'Save')</label>
    <action type=\"exit\">save</action>
   </button>
  </hbox>
 </vbox>
</window>"
I=$IFS; IFS=""
for STATEMENTS in  $($GTKDIALOG -p savebox --center); do
	eval $STATEMENTS
done
IFS=$I

if [ "$EXIT" = "save" ]; then
	echo "$SAVEFILE" > $WORKDIR/SAVEFILE
	#checks
	if [ "$EXPORT_ISO" = "true" ]; then
		cp -f $WORKDIR/SAVEFILE $WORKDIR/isofile
	else
		if [ -s "$SAVEFILE" ] && [ -f "$SAVEFILE" ]; then #file already exist
			IMG=warning
			FRAME=Warning
			TXT1="<b>$(gettext 'File already exists.')</b>"
			TXT2="$(gettext 'Do you want to overwrite existing file?')"
			. "$APPDIR"/box -yesno
			if [ ! $EXIT = Yes ]; then 
				echo -n > $WORKDIR/SAVEFILE
			fi
		fi
	fi
else
	echo -n > $WORKDIR/SAVEFILE
fi

	