#!/bin/bash
#
# i18n - Internationalization
export TEXTDOMAIN="t_solutions"
export TEXTDOMAINDIR="/usr/share/locale"
# editor
if [ -f /usr/bin/gedit ];then
EDITOR=gedit
elif  [ -f /usr/bin/featherpad ];then
EDITOR=featherpad
elif [ -f /usr/bin/kwrite ];then
EDITOR=kwrite
elif [ -f /usr/bin/mouse-pad ];then
EDITOR=mouse-pad
elif [ -f /usr/bin/leafpad ];then
EDITOR=leafpad
elif [ -f /usr/bin/pluma ];then
EDITOR=pluma
else
EDITOR='xterm -c cat'
fi
# web browser
if [ -f /usr/bin/google-chrome-stable ];then
WEB=google-chrome-stable
elif [ -f /usr/bin/firefox ];then
WEB=firefox
elif [ -f /usr/bin/konqueror ];then
WEB=konqueror
elif [ -f /usr/bin/midori ];then
WEB=midori
else
WEB=opera
fi
# icon
ICON=/usr/share/icons/touchpad_s.png

{
export TouchpadSolution='
<window window_position="1" icon-name="input-touchpad"  title="Texstar´sTouchpadSolution" width-request="880" resizable="false">
 <vbox>
  <frame '$"Configure your touchpad with the new xorg 1.10.2. "'>
   <hbox tooltip-text="'$"The control file for your touchpad is called 50-synaptics.conf and is located in the /etc/X11/xorg.conf.d folder. I have set this file up in default mode with the x11-driver-input-synaptics-1.4.1-2pclos2011.i586.rpm package mainly because I'm tired of tinking with the default config file. Seems if I set in one way it works for some people and not for others. So here are some possible solutions for you. One of these should work for you."'">
   <text><label>'$"Visit Forum"'</label></text>
      <button>
       <input file stock="gtk-home"></input>
       <action>'$WEB' http://www.pclinuxos.com/forum/index.php/topic,93782.0.html &</action>
      </button>
   </hbox>

   <hbox>
   <hbox tooltip-text="'$"Choose your solution... To display a solution, click on View button below."'" homogeneous="True" width-request="850" height-request="150">
    <tree column-visible ="false|true">
    <variable>Solution</variable>
    <label>|'$"Information"'</label>
      <item>/usr/share/Touchpad-Solutions/solution1|'$"Solution 1 - Use the default mode and configure your touchpad from the KDE Configure your Desktop"'</item>     
      <item>/usr/share/Touchpad-Solutions/solution2|'$"Solution 2 - Used by Opensuse and works for most people"'</item>
      <item>/usr/share/Touchpad-Solutions/solution3|'$"Solution 3 - Click on View button below..."'</item>
      <item>/usr/share/Touchpad-Solutions/solution4|'$"Solution 4 - Elantech touchpad"'</item>
      <item>/usr/share/Touchpad-Solutions/solution5|'$"Solution 5 - Acer Aspire One 150 ZG5 netbook"'</item>
      <item>/usr/share/Touchpad-Solutions/solution6|'$"Solution 6 - An another touchpad file"'</item>
    </tree>
   </hbox> 
   </hbox>


   <hbox>
   
   <hbox tooltip-text="'$"Edit current touchpad settings... Note: You should know what you do!"'">    
      <button><input file icon="gtk-execute"></input>
       <label>Edit</label>
       <action>xterm  -title "Touchpad-EDIT" -e  su -c "'$EDITOR' /etc/X11/xorg.conf.d/50-synaptics.conf && yad --info --button=ok --title='"TouchpadSolution"' --text='$"'Note: the new configuration will be used after a restart of xserver!'"' --window-icon='$ICON'"&</action>
      </button>
  </hbox> 
   
  <hbox tooltip-text="'$"View selected solution..."'">    
      <button><input file icon="filefind"></input>
       <label>View</label>
       <action>'$EDITOR' $Solution &</action>
      </button>
  </hbox> 
  
  <hbox tooltip-text="'$"Set solution, needs root password..."'">    
      <button><input file icon="gtk-ok"></input>
       <label>Apply</label>
       <action>xterm -title "Add Touchpad-Solution" -e su -c "rm -rf /etc/X11/xorg.conf.d/50-synaptics.conf; cp $Solution /etc/X11/xorg.conf.d/50-synaptics.conf && yad --info --button=ok --title='"TouchpadSolution"' --text='$"'Note: the new configuration will be used after a restart of xserver!'"' --window-icon='$ICON'" &</action>
      </button>
  </hbox>
      
      <button>
       <label>Close</label>
       <input file stock="gtk-quit"></input>
       <action type="exit">TouchpadSolution</action>
      </button>
   </hbox>  
  </frame>
 </vbox>
</window>
'
}

export GUI="`echo "$TouchpadSolution" | sed -e 's/##.*//'`" 
gtkdialog -p GUI
