#!/bin/bash
#
#
#check editors
if [ -f /usr/bin/geany ];then
EDITOR=geany
elif [ -f /usr/bin/gedit ];then
EDITOR=gedit
elif [ -f /usr/bin/kate ];then
EDITOR=kate
elif [ -f /usr/bin/kwrite ];then
EDITOR=kwrite
else
EDITOR=leafpad
fi
#
# i18n - Internationalization - Internationalisierung
export TEXTDOMAIN=lxdiff
export TEXTDOMAINDIR="/usr/share/locale"
#
LXDIFF='
<window window_position="1" icon-name="/usr/share/icons/package_multimedia.png"  title="LXDiff"> ##Fenster
   <vbox>
     <hbox tooltip-text="'$"Load a original file"'">
      <text><label>'$"1. File"'</label></text>
      <entry accept="filename">
        <label>'$"Select an Existing File"'</label>
        <variable>ORIGFILE</variable>
      </entry>
      <button>
        <input file stock="gtk-open"></input>
        <variable>FILE_BROWSE_FILENAME</variable>
        <action type="fileselect">ORIGFILE</action>
      </button>
     </hbox>
 
     <hbox tooltip-text="'$"Load here a different file"'"> 										##different file load 
      <text><label>'$"2. File"'</label></text>
      <entry accept="filename">
        <label>'$"Select an Existing File"'</label>
        <variable>DIFFFILE</variable>
	  </entry>
      <button>
        <input file stock="gtk-open"></input>
        <variable>FILE_BROWSE_FILENAME</variable>
        <action type="fileselect">DIFFFILE</action>
	  </button>      
     </hbox>
     
   <frame '$"Save Outputfile"'>
     <hbox>
      <entry accept="savefilename">
        <label>'$"Select a Filename"'</label>
        <variable>SAVEFILE</variable>
      </entry>
      <button>
        <input file stock="gtk-open"></input>
        <variable>FILE_BROWSE_SAVEFILENAME</variable>
        <action type="fileselect">SAVEFILE</action>
      </button>
     </hbox>     
   </frame>
   
   <frame>
    <hbox>
     <hbox>
      <button>
        <label>Diff</label>
        <input file icon="search"></input> ##Beenden  
        <action>diff -uNr $'ORIGFILE' $'DIFFFILE' > $'SAVEFILE'.diff</action>
        <action><'$EDITOR' $'SAVEFILE'.diff &</action>
      </button>
     </hbox>
     
     <hbox>
      <button>
        <label>Close</label>
        <input file icon="exit"></input> ##Beenden  
        <action type="closewindow">LXDIFF</action>
      </button>
     </hbox> 
    </hbox>  
   </frame>
   </vbox>
</window>
'
export GUI="`echo "$LXDIFF" | sed -e 's/##.*//'`" 
gtkdialog -p GUI
