#!/bin/sh
#Lesser GPL licence v2 (/usr/share/doc/legal/lgpl-2.1.txt). 2007 www.puppylinux.com
#120201 internationalized.
#120226 01micko: test screensize and set SCROLLABLE variable.
#120706 change gtkdialog3 to gtkdialog4.
#120724 alsaconf does not work on arm boards. refer 3builddistro.
#131210 zigbert: gui (gtkdialog) improvements.

export TEXTDOMAIN=alsawizard
export OUTPUT_CHARSET=UTF-8

. /etc/rc.d/BOOTCONSTRAINED #120724

export ASKDIALOG='
<window title="'$(gettext 'Sound Wizard')'" icon-name="gtk-preferences">
<vbox>
  <frame '$(gettext 'Sound wizard')'>
    '"`/usr/lib/gtkdialog/xml_info 0 sound_config.svg 60 "$(gettext "Presumably you are here because sound does not work? If so, here are steps to follow, to hopefully fix sound")..."`"'
    <hbox border-width="7" space-expand="true" space-fill="true">
      <vbox space-expand="false" space-fill="false">
        <pixmap>
          <input file>/usr/share/pixmaps/puppy/nr_1.svg</input>
          <height>40</height>
        </pixmap>
      </vbox>
      <text space-expand="false" space-fill="false"><label>""</label></text>
      <text xalign="0" use-markup="true" space-expand="true" space-fill="true"><label>"'$(gettext '<b>Adjust levels</b>
Often non-working sound is just a matter of unmuting (tick a checkbox) and/or bring up a level in the audio mixer. Click this button to run the mixer.')'"</label></text>
      <vbox space-expand="false" space-fill="false">
        <button>
          '"`/usr/lib/gtkdialog/xml_button-icon sound_mixer.svg big`"'
          <action>/usr/local/bin/defaultaudiomixer & </action>
        </button>
      </vbox>
    </hbox>
    <hseparator></hseparator>
    <hbox border-width="7" space-expand="true" space-fill="true">
      <vbox space-expand="false" space-fill="false">
        <pixmap>
          <input file>/usr/share/pixmaps/puppy/nr_2.svg</input>
          <height>40</height>
        </pixmap>
      </vbox>
      <text space-expand="false" space-fill="false"><label>""</label></text>
      <text xalign="0" use-markup="true" space-expand="true" space-fill="true"><label>"'$(gettext '<b>Play test sound</b>
Having adjusted the levels, click this button to play a test sound.')'"</label></text>
      <vbox space-expand="false" space-fill="false">
        <button>
          '"`/usr/lib/gtkdialog/xml_button-icon speaker_3.svg big`"'
          <action>/usr/bin/aplay /usr/share/audio/2barks.au & </action>
        </button>
      </vbox>
    </hbox>
    <hbox border-width="7" space-expand="true" space-fill="true">
      <text width-request="40" space-expand="false" space-fill="false"><label>""</label></text>
      <text space-expand="false" space-fill="false"><label>""</label></text>
      <text xalign="0" use-markup="true" space-expand="true" space-fill="true"><label>"'$(gettext 'On some hardware (very rare fortunately) sound plays but does not always stop! If your Puppy will not stop barking, click this button.')'"</label></text>
      <vbox space-expand="false" space-fill="false">
        <button>
          '"`/usr/lib/gtkdialog/xml_button-icon speaker_0.svg big`"'
          <action>/usr/bin/killall aplay</action>
        </button>
      </vbox>
    </hbox>
    <hseparator></hseparator>
    <hbox border-width="7" space-expand="true" space-fill="true">
      <vbox space-expand="false" space-fill="false">
        <pixmap>
          <input file>/usr/share/pixmaps/puppy/nr_3.svg</input>
          <height>40</height>
        </pixmap>
      </vbox>
      <text space-expand="false" space-fill="false"><label>""</label></text>
      <text xalign="0" use-markup="true" space-expand="true" space-fill="true"><label>"'$(gettext "<b>Multiple cards</b>
Linux may have detected more than one audio interface or 'card', and has set the wrong one as default. Run Kirk's Multiple Sound Card Wizard to investigate this (note, a reboot is required for change to take effect).")'"</label></text>
      <vbox space-expand="false" space-fill="false">
        <button>
         '"`/usr/lib/gtkdialog/xml_button-icon sound_config.svg big`"'
         <action>/usr/bin/Multiple-Sound-Card-Wizard & </action>
        </button>
      </vbox>
    </hbox>
  </frame>
  
  
    <hbox space-expand="false" space-fill="false">
     <button>
       '"`/usr/lib/gtkdialog/xml_button-icon quit`"'
       <label>'$(gettext 'Quit')'</label>
       <action type="exit">EXIT</action>
     </button>
    </hbox>

  </vbox>
</window>'

. /usr/lib/gtkdialog/xml_info gtk #build bg_pixmap for gtk-theme
RETVAL="`gtkdialog -p ASKDIALOG 2>/dev/null`"
eval "$RETVAL"
[ "$EXIT" != "RUNALSA" ] && exit

#/usr/sbin/alsaconf #101015
rxvt -geometry 60x3 -bg orange -e /usr/sbin/alsaconf

#depmod
