#!/bin/sh
#(c) Copyright Barry Kauler, Oct 2010
#License GPL v2 (/usr/share/doc/legal/gpl-2.0.txt)
#101027 try improve window geometry and placement on small screens.
# 6jan11 shinobar: i18n
export TEXTDOMAIN=welcome
export TEXTDOMAINDIR=/usr/share/locale
export OUTPUT_CHARSET=UTF-8
export LANGORG=$LANG

WINHEIGHT=555      #525 rodin.s: changed for russian locale
WINWIDTH=690
SIZEFREEM=`df -m | grep ' /$' | tr -s ' ' | cut -f 4 -d ' '`
if [ $SIZEFREEM -gt 60 ];then
 #MEMMSG="<text wrap=\"false\" use-markup=\"true\"><label>\"<big>$(gettext 'This is the first time you are running Puppy!')</big>\"</label></text>"
 MEMMSG="<text width-chars=\"50\" use-markup=\"true\"><label>\"<big>$(gettext 'This is the first time you are running Puppy!')</big>\"</label></text>"
else
 MEMMSG="<text width-chars=\"70\" use-markup=\"true\"><label>\"<b><span color='"'red'"' background='"'yellow'"'>$(gettext 'WARNING: This computer has low RAM. It is recommended that you do not run big apps like SeaMonkey, instead shudown now -- you will be offered to create a save file (and swap file) and there will be more working space at next boot')</span></b>\"</label></text>"
 WINHEIGHT=`expr $WINHEIGHT + 40`
 WINWIDTH=715
fi

#101027
WINPOS="1" #center.
ROOTHEIGHT=`xwininfo -root | grep -o '\-geometry [^+]*' | cut -f 2 -d 'x'`
if [ $ROOTHEIGHT -lt 650 ];then
 WINPOS="0" #top-left screen.
 WINHEIGHT=`expr $WINHEIGHT + 30` # was 20
 WINWIDTH=715
fi

# MEMMSG="<text wrap=\"false\" use-markup=\"true\"><label>\"<big>As this is the first time that you have started Puppy, he is running totally in RAM!</big>\"</label></text>"
#<!--    <text width-chars=\"80\" use-markup=\"true\"><label>\"Click on the 'connect' button on the right, or icon at left of the screen (one click only -- do not double-click!). You will then see some buttons for choosing how you wish to connect to the Internet -- click the most appropriate. Configuration of Puppy for Internet access will in most cases be very straightforward...\"</label></text> -->
#  <text use-markup=\"true\"><label>\"<small>Regards, The Puppy Team</small>\"</label></text>
#   <text use-markup=\"true\"><label>\"<small>Note, a 'partition' is known by a drive letter in dos/windows, such as C:, D:, but Linux uses a more rigorous naming scheme, such as sda1, sda2. If you are unfamiliar with these different types of partitions (and the Linux naming), don't worry, as Puppy will automatically detect and offer you a choice of suitable partitions in which to save the session. Puppy will only create a single file in the partition and this will not affect your current installation of Windows (but of course we have to make a full disclaimer of any responsibility if something does go wrong!) and next time you boot Puppy from CD the save-file will get automatically read -- so, there is really no need to install Puppy onto the hard drive, and you can just keep booting Puppy from CD indefinitely.</small>\"</label></text>
#    <pixmap><input file>/usr/share/doc/menu2.png</input></pixmap>
# window_position=\"${WINPOS}\"

menu2="${TEXTDOMAINDIR}/`echo $LANG | cut -d '_' -f1`/pixmaps/menu2.png"
[ ! -f "$menu2" ] && menu2="`dirname $0`/menu2.png" 

export WELCOME_DLG="
<window decorated=\"false\">
 <vbox>
  <hbox>
   <pixmap><input file>/usr/share/doc/puppylogo96.png</input></pixmap>
   <vbox>
    <text><label>\" \"</label></text>
    <text use-markup=\"true\"><label>\"<b><big><big><big>$(gettext 'Welcome, woof, woof')            </big></big></big></b>\"</label></text>
    ${MEMMSG}
   </vbox>
   <vbox><button><input file icon=\"mini-cross\"></input><action type=\"exit\">Exit on click close-box</action></button></vbox>
  </hbox>
  <hbox>
   <vbox>
    <text use-markup=\"true\"><label>\"<b><big>$(gettext 'Internet connection')</big></b>\"</label></text>
    <text width-chars=\"80\"><label>\"$(gettext "Click on the 'connect' button on the right, or icon at left of the screen (one click only -- do not double-click!). You will then see some buttons for choosing how you wish to connect to the Internet -- click the most appropriate. It is easy...")\"</label></text>
   </vbox>
   <vbox>
    <button><input file>/usr/local/lib/X11/pixmaps/connect48.png</input><action>/usr/sbin/connectwizard & </action><action type=\"exit\">EXIT</action></button>
    <text use-markup=\"true\"><label>\"<b>$(gettext 'connect')</b>\"</label></text>
   </vbox>
  </hbox>

  <hbox>
   <vbox>
    <text use-markup=\"true\"><label>\"<b><big>$(gettext 'I need help!')</big></b>\"</label></text>
    <text width-chars=\"80\"><label>\"$(gettext "Explore the 'Menu' -- see bottom-left of screen. Lots of local help is available -- select 'Help' in the menu. The local Help page also has the Release Notes for this version of Puppy -- well worth checking out! When you get online, the web browser home page has many more links.")\"</label></text>
    <hbox>
     <pixmap><input file>/usr/share/doc/tray.png</input></pixmap>
     <text><label>\"$(gettext '...mouse-over and click the tray applets, very helpful!')\"</label></text>
    </hbox>
   </vbox>
  </hbox>
  
  <hbox>
   <pixmap><input file>${menu2}</input></pixmap>
   <vbox>
    <text use-markup=\"true\"><label>\"<b><big>$(gettext 'Saving a session')</big></b>\"</label></text>
    <text width-chars=\"60\"><label>\"$(gettext 'At first shutdown, you are asked where you want to save your personal files/data/settings to, and this can be any FAT (as used for MSDOS or Windows 9x) partition, NTFS (as used by Windows XP) partition or Linux partition in the hard drive, or any plugin drive (USB Flash pen drive for example).')\"</label></text>
   </vbox>
   <vbox>
    <button><input file>/usr/local/lib/X11/mini-icons/info16.xpm</input><action>/usr/bin/yaf-splash -bg yellow -close box -fontsize small -text \"$(gettext "A 'partition' is known by a drive letter in dos/windows, such as C:, D:, but Linux uses a more rigorous naming scheme, such as sda1, sda2. If you are unfamiliar with these different types of partitions (and the Linux naming), don't worry, as Puppy will automatically detect and offer you a choice of suitable partitions in which to save the session. Puppy will only create a single file in the partition and this will not affect your current installation of Windows (but of course we have to make a full disclaimer of any responsibility if something does go wrong!) and next time you boot Puppy from CD the save-file will get automatically read -- so, there is really no need to install Puppy onto the hard drive, and you can just keep booting Puppy from CD indefinitely.")\" & </action></button>
   </vbox>
  </hbox>
  
  <hbox>
   <vbox>
    <text use-markup=\"true\"><label>\"<b><big>$(gettext 'Setup your pup')</big></b>\"</label></text>
    <text><label>\"$(gettext "Want to install an upgraded video driver? Country localization? Printing? Sound? Click here (or 'setup' icon at top of screen)"):\"</label></text>
   </vbox>
   <vbox>
    <button><input file>/usr/local/lib/X11/pixmaps/configuration48.png</input><action>/usr/sbin/wizardwizard & </action><action type=\"exit\">EXIT</action></button>
    <text use-markup=\"true\"><label>\"<b>$(gettext 'setup')</b>\"</label></text>
   </vbox>
  </hbox>
  
 </vbox>
</window>
"

case $WINPOS in
 0)
  gtkdialog3 --geometry=${WINWIDTH}x${WINHEIGHT}+0+0 --program=WELCOME_DLG
 ;;
 *)
  gtkdialog3 --geometry=${WINWIDTH}x${WINHEIGHT} --center --program=WELCOME_DLG
 ;;
esac



###END###
