#! /bin/bash

# Pwget created by Lobster with thanks to Zigbert
# for Puppy Dingo and Linux Tmxxine
# Jan 2008 GPL v3 License
# http://tmxxine.com
# Translated into Japanese: TaDa

export Pwget='
<window title="Pwget - ファイルダウンロードユーティリティ">
<vbox>
 <hbox>
  <text><label>アドレス欄にURLをカット＆ペーストして下さい。保存先ディレクトリを入力して "OK" をクリック！</label></text>
 </hbox>
 <hbox>
  <text><label>アドレス</label></text>
  <entry accept="directory"><variable>SOURCE</variable><input>/tmp/pm_source_dir</input></entry>
 </hbox>
 <hbox>
  <text><label>保存先ディレクトリ</label></text>
  <entry accept="directory"><variable>DEST</variable><input>/tmp/pm_mirror_dir</input></entry>
  <button>
   <input file icon="gtk-open"></input>
   <action type="fileselect">DEST</action>
   <action>refresh:DEST</action>
  </button>
 </hbox>
 <hbox>
  <button help>
   <action>`Xdialog --wrap --screencenter --left --title "Pwget - ヘルプ" --msgbox "Pwgetはwgetユーティリティの為のシンプルなフロントエンドです。 WgetはISOファイルの様に大きなファイルをインターネットからダウンロードする為に使用されます。\nそのファイルはダウンロードの間に確認されます。 ISOや他のファイルがチェックされてダウンロードが再開されるので、md5sumのチェックを必要としません。\nダウンロードしたいファイルのURLをカット＆ペーストして下さい。 保存先ディレクトリを選択する為にファイルセレクタを使用して下さい。\n\n Lobster, Jan 2008" 600x0`</action>
  </button>
  <button cancel></button>
  <text><label>ダウンロード</label></text>
  <button ok></button>
 </hbox>
</vbox>
</window>'

I=$IFS; IFS=""
for STATEMENTS in  $(gtkdialog3 --program=Pwget --center); do
   eval $STATEMENTS
done
IFS=$I
if [ $EXIT = OK ]; then
  rxvt -name Xwget -bg "#F3F2DF" -e wget -c -P "$DEST" $SOURCE
  rox -d "$DEST"
fi 