#!/bin/sh
#Barry Kauler 2005 www.puppylinux.com
#2007 Lesser GPL licence v2 (http://www.fsf.org/licensing/licenses/lgpl.html)
#w019 apr2009: updated for woof.
#100215 fixes.
#110807 changed to gtkdialog3.
#111019 screen out Xdialog.
#120203 BK: internationalized.
#151105 change gtkdialog3 to gtkdialog.

export TEXTDOMAIN=xserverwizard
export OUTPUT_CHARSET=UTF-8

VIDEOINFO="`cat /proc/pci | grep "VGA" | cut -f 2-4 -d ':'`"
WHATXS="`ls -1 /usr/bin/X?* | grep -v 'Xdialog' | sed -e 's/\/usr\/bin\///g' | tr "\n" " "`"
CURRENTX="`readlink /usr/bin/X`"

XVESATXT=""
if [ -e /usr/bin/Xvesa ];then
 XVESATXT="    <hbox>
     <text><label>$(gettext 'Xvesa Kdrive server. This has been in most live-CDs, and works on the widest range of video hardware. The single biggest disadvantage is that the screen refresh frequency cannot be changed (which does not matter for LCD monitors, it is only a problem for CRT monitors where low frequency causes noticeable flicker). Click button to run the Xvesa video Wizard:')</label></text>
     <vbox><button>
      <input file>/usr/local/lib/X11/pixmaps/x24.png</input>
      <action>video-wizard & </action>
      <action type=\"exit\">exited xserver wizard</action>
     </button></vbox>
    </hbox>
"
fi

export MAINDIALOG="
<window title=\"$(gettext 'Puppy X server chooser Wizard')\" icon-name=\"gtk-preferences\">
  <hbox>
  <vbox>
   <text><label>\"
$(gettext 'These X servers are currently installed:')
$WHATXS

$(gettext 'The currently running X server is:')
$CURRENTX\"</label></text>
  </vbox>

  <vbox>
   <frame $(gettext 'X server Wizards')>
   
    ${XVESATXT}

    <hbox>
     <text><label>$(gettext 'Xorg X server. This is the big fella, large, sophisticated, accelerated rendering, Xinerama, supports many input devices. Click button to run the Xorg Video Wizard:')</label></text>
     <vbox><button>
      <input file>/usr/local/lib/X11/pixmaps/x24.png</input>
      <action>xorgwizard & </action>
      <action type=\"exit\">exited xserver wizard</action>
     </button></vbox>
    </hbox>

   </frame>
  </vbox>
  </hbox>
</window>
"

#echo "$MAINDIALOG" | gtkdialog2 --stdin
gtkdialog --program=MAINDIALOG

###END###
