#! /bin/sh
# 
# Gtkdialog box to dl a torrent file with ctorrent throught a Xterm.
# - SliTaz GNU/Linux 2008.
#
VERSION=2008041

mkdir -p ~/Downloads
cd ~/Downloads

# We need at least devive, speed and ISO image path.
#
export MOUNT_DIALOG='
<window title="Torrentbox" icon-name="drive-optical">
  <vbox>

    <text use-markup="true">
      <label>
"
<b>SliTaz - Torrentbox</b>"
      </label>
    </text>
    <text wrap="true" width-chars="54" use-markup="true">
      <label>
"
Download a torrent file with ctorrent.
"
      </label>
    </text>
    
    <frame Ctorrent options>
      <hbox>
        <text use-markup="true">
          <label>"<b>Options :</b>"</label>
        </text>
        <entry>
          <variable>DL_OPTS</variable>
        </entry>
        <button>
        <input file icon="help"></input>
	  <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x46 -T "ctorrent help" -e "ctorrent -h ; echo -e \"----\nENTER to continue...\" && read close"</action>
        </button>
      </hbox>
    </frame>
   
    <frame Download Torrent>
      <hbox>
        <text use-markup="true">
          <label>"<b>File         :</b>"</label>
        </text>
        <entry>
          <variable>TORRENT</variable>
        </entry>
        <button>
          <input file stock="gtk-open"></input>
          <action type="fileselect">TORRENT</action>
        </button>
      </hbox>
    </frame>
    
    <hbox>
      <button>
        <label>Download</label>
        <input file icon="forward"></input>
        <action>exec xterm -T "Ctorrent download" -e "ctorrent $DL_OPTS \"$TORRENT\" ; echo -e \"----\nENTER to close window...\" && read close"</action>
      </button>
      <button>
        <input file icon="exit"></input>
        <action type="exit">Exit</action>
      </button>
    </hbox>
  
  </vbox>
</window>
'

# Execute main dialog.
gtkdialog --program=MOUNT_DIALOG

exit 0
