#!/bin/sh

set -e

# Remove icons from the system icons
XDG_ICON_RESOURCE="`which xdg-icon-resource 2> /dev/null || true`"
if [ ! -x "$XDG_ICON_RESOURCE" ]; then
  echo "Error: Could not find xdg-icon-resource" >&2
  exit 1
fi
for icon in "/opt/slimjet/product_logo_"*.png; do
  size="${icon##*/product_logo_}"
  "$XDG_ICON_RESOURCE" uninstall --size "${size%.png}" "flashpeak-slimjet"
done

UPDATE_MENUS="`which update-menus 2> /dev/null || true`"
if [ -x "$UPDATE_MENUS" ]; then
  update-menus
fi

# Update cache of .desktop file MIME types. Non-fatal since it's just a cache.
update-desktop-database > /dev/null 2>&1 || true

# Remove from the alternatives system
update-alternatives --remove x-www-browser /usr/bin/flashpeak-slimjet
update-alternatives --remove gnome-www-browser /usr/bin/flashpeak-slimjet

update-alternatives --remove flashpeak-slimjet /usr/bin/flashpeak-slimjet
