#! /bin/sh

export TEXTDOMAIN=find_n_run
export OUTPUT_CHARSET=UTF-8

[ "$DISPLAY" ] || exit

APP_TITLE="$(gettext 'Find'\''N'\''Run')"
MYPATH="$(dirname "$(readlink -f "$0")")"

# -----------------------------------------------------------------------------
# Add shortcut on the pinboard (if in use) and/or in $HOME/Desktop/ (if exists)
# -----------------------------------------------------------------------------

if [ -e "$HOME/Choices/ROX-Filer/PuppyPin" ] || [ -d "$HOME/Desktop" ]; then

  Xdialog -center -title "$APP_TITLE" --yesno "$(gettext 'Create a shortcut on the desktop?')" 0 0
  if [ $? -eq 0 ]; then

    [ -e "$HOME/Choices/ROX-Filer/PuppyPin" ] &&
    rox --RPC << EOF
<?xml version="1.0"?>
<env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope">
 <env:Body xmlns="http://rox.sourceforge.net/SOAP/ROX-Filer">
  <PinboardAdd>
   <Path>${MYPATH}</Path>
   <Label>${APP_TITLE}</Label>
  </PinboardAdd>
 </env:Body>
</env:Envelope>
EOF

    [ -d "$HOME/Desktop" ] && {
    cp -f "/usr/share/applications/findnrun.desktop" "$HOME/Desktop/Find'N'Run.desktop"
    }

  fi

fi

# -----------------------------------------------------------------------------
