#!/bin/ash
#Barry Kauler www.puppylinux.com
#2007 Lesser GPL licence v2 (http://www.fsf.org/licensing/licenses/lgpl.html)
#v411 modified network-connect button.
#100215 fix exit button.
#101019 added video upgrade wizard.
#120202 BK: internationalized.
#130216 BK: change text for mouse.
#131210 zigbert: gui (gtkdialog) improvements.

export TEXTDOMAIN=wizardwizard
export OUTPUT_CHARSET=UTF-8
export APPDIR=/usr/local/pwizardwizard

[ ! -f /usr/share/icons/hicolor/48x48/apps/puppy_config.svg ] && \
ln -sf /usr/share/pixmaps/puppy/puppy_config.svg /usr/share/icons/hicolor/48x48/apps && gtk-update-icon-cache -f -i /usr/share/icons/hicolor 2>/dev/null

if [ -s /usr/sbin/pdesktop ]; then
  BUTTON_22='<button image-position="2">
               <label>'$(gettext 'Desktop')'</label>
               '"`/usr/lib/gtkdialog/xml_button-icon windows.svg huge`"'
               <action>/usr/sbin/pdesktop &</action>
             </button>'
else
  BUTTON_22='<button image-position="2">
               <label>'$(gettext 'Menu Manager')'</label>
               '"`/usr/lib/gtkdialog/xml_button-icon menu.svg huge`"'
               <action>/usr/local/pmenumanager/menumanager &</action>
             </button>'
fi

# set header
mkdir -p /tmp/wizardwizard
. /etc/DISTRO_SPECS
XML_INFO_COLOR='#EDEBD7' # background color
XML_INFO_OPACITY=0.5 # background opacity
. $APPDIR/xml_info_wizardwizard gtk > /dev/null # build bg_pixmap for gtk-theme

BOX_HEIGHT=90 # HEADER
ICON=/usr/share/pixmaps/puppy/puppy_config.svg
ICON_HEIGHT=85
MSG_1="<b><span size='"'x-large'"'>$(gettext "Puppy Setup")</span></b>"
MSG_2="<b>$(gettext "Basic configuration guide")</b>"
MSG_3="<b>$DISTRO_NAME $DISTRO_VERSION</b>"
ALIGN=center # center or left
HEADER="
   <hbox height-request="'"${BOX_HEIGHT}"'">
   $(. $APPDIR/xml_info_wizardwizard "$ICON" "$ICON_HEIGHT" "$MSG_1" "$MSG_2" "$MSG_3" "$ALIGN")
   </hbox>"

export WizardWizard='
<window title="'$(gettext 'Puppy Setup')'" icon-name="puppy_config" default_width="500">
<vbox space-expand="true" space-fill="true">
  '$HEADER'
  <vbox spacing="10" space-expand="true" space-fill="true">
  <frame '$(gettext 'Wizards')'>
    <hbox spacing="10" homogeneous="true" space-expand="true" space-fill="true">
      <button image-position="2">
        <label>'$(gettext 'Language / Country')'</label>
        '"`/usr/lib/gtkdialog/xml_button-icon country.svg huge`"'
        <action>/usr/sbin/countrywizard &</action>
      </button>
      <button image-position="2">
        <label>'$(gettext 'Startup')'</label>
        '"`/usr/lib/gtkdialog/xml_button-icon startup_services.svg huge`"'
        <action>/usr/sbin/bootmanager &</action>
      </button>
      <button image-position="2">
        <label>'$(gettext 'Mouse / Keyboard')'</label>
         '"`/usr/lib/gtkdialog/xml_button-icon mouse_keyboard.svg huge`"'
        <action>/usr/sbin/input-wizard &</action>
      </button>
    </hbox>
  
    <hbox spacing="10" homogeneous="true" space-expand="true" space-fill="true">
      <button image-position="2">
        <label>'$(gettext 'Sound')'</label>
        '"`/usr/lib/gtkdialog/xml_button-icon sound.svg huge`"'
        <action>command -v pulseaudio pipewire-pulse > /dev/null 2>&1 && pavucontrol || /usr/sbin/alsawizard &</action>
      </button>
      '$BUTTON_22'
      <button image-position="2">
        <label>'$(gettext 'Graphics / Screen')'</label>
        '"`/usr/lib/gtkdialog/xml_button-icon graphics.svg huge`"'
        <action>/usr/sbin/xserverwizard &</action>
      </button>
    </hbox>

    <hbox spacing="10" homogeneous="true" space-expand="true" space-fill="true">
      <button image-position="2">
        <label>'$(gettext 'Internet')'</label>
        '"`/usr/lib/gtkdialog/xml_button-icon internet_connect.svg huge`"'
        <action>/usr/sbin/connectwizard &</action>
      </button>
      <button image-position="2">
        <sensitive>'$(command -v cupsd > /dev/null && echo true || echo false)'</sensitive>
        <label>'$(gettext 'Printer')'</label>
        '"`/usr/lib/gtkdialog/xml_button-icon print.svg huge`"'
        <action>/usr/sbin/cups_shell &</action>
      </button>
      <button image-position="2">
        <label>'$(gettext 'Date / Time')'</label>
        '"`/usr/lib/gtkdialog/xml_button-icon date_time.svg huge`"'
        <action>/usr/sbin/timewizard &</action>
      </button>
    </hbox>
  </frame>
  </vbox>

  <hbox space-expand="false" space-fill="false">
    <button>'"`/usr/lib/gtkdialog/xml_button-icon quit`"'<label>'$(gettext 'Quit')'</label></button>
  </hbox>
 </vbox>
</window>'

gtkdialog -p WizardWizard --styles=/tmp/wizardwizard/gtkrc_xml_info.css

unset WizardWizard
