#!/bin/bash

set -e

if [ "$1" = "remove" ]; then
  # Removes the fix for the MATE 1.4.x problem with the Network icon in Places menu
  if [ -L /usr/share/applications/network-scheme.desktop ]; then
    rm -f /usr/share/applications/network-scheme.desktop
  fi
  # Removing Vino file we created on install
  if [ -f /usr/share/applications/pointlinux-vino-preferences.desktop ]; then
    rm /usr/share/applications/pointlinux-vino-preferences.desktop
  fi
  # Removing Vino from autostart
  if [ -f /usr/share/mate/autostart/vino-server.desktop ]; then
    rm /usr/share/mate/autostart/vino-server.desktop
  fi
  MATECONFDIR=/usr/share/pointlinux/mate/mateconf-settings
  # Revert old mateconf settings
  if [ -f $MATECONFDIR/defaults ]; then
    mateconftool-2 --direct --config-source xml:readwrite:/etc/mateconf/mateconf.xml.defaults \
    --load $MATECONFDIR/defaults
    rm $MATECONFDIR/defaults
  fi
fi
