#! /bin/sh

case "$1" in
    configure)
        # Update MIME database only if it's older than the packages dir
        if test -x /usr/bin/update-mime-database -a \
           /usr/share/mime/mime.cache -ot /usr/share/mime/packages; then
            /usr/bin/update-mime-database /usr/share/mime
        fi
        if test -x /usr/bin/gtk-update-icon-cache; then
            /usr/bin/gtk-update-icon-cache -f -t /usr/share/icons/hicolor
        fi
        if test -x /usr/bin/update-desktop-database; then
            /usr/bin/update-desktop-database
        fi

dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint string:"Adding menu icon and D-Bus service"

cp /usr/share/icons/hicolor/48x48/apps/xarchiver.png /usr/share/pixmaps

[ -f /usr/share/applications/hildon/xarchiver.desktop ] && echo "File exists, moving on..." || echo "File does not exists" && echo "[Desktop Entry]
Encoding=UTF-8
Version=1.0
Name=Xarchiver
Name[de]=Xarchiver
Name[eu]=Xarchiver
Name[fi]=Xarchiver
Name[fr]=Xarchiver
Name[he]=Xarchiver
Name[hu]=Xarchiver
Name[it]=Xarchiver
Name[ja]=Xarchiver
Name[nl]=Xarchiver
Name[pt_BR]=Xarchiver
Comment=A GTK+2 only archive manager
Comment[de]=Ein auf GTK+2 basierender Archivmanager
Comment[eu]=GTK+2-rako bakarrik pakete kudeatzailea
Comment[fi]=GTK+2 -arkistonhallintasovellus
Comment[fr]=Un gestionnaire d'archive pour GTK+2 seulement
Comment[he]=מנהל ארכיונים ב GTK+2
Comment[hu]=Egy GTK+2 archívum kezelő
Comment[it]=Un gestore di archivi che richiede solo GTK+2
Comment[ja]=Xfce 4 アーカイブマネージャー
Comment[nl]=Een GTK+2 archief beheerder
Comment[pt_BR]=Um compactador de arquivos baseado apenas em GTK+2
GenericName=Archive manager
GenericName[de]=Archivmanager
GenericName[eu]=Pakete kudeatzailea
GenericName[fi]=Arkistonhallinta
GenericName[fr]=Gestionnaire d'archives
GenericName[he]=מנהל ארכיונים
GenericName[hu]=Archívum kezelő
GenericName[it]=Gestore di archivi
GenericName[nl]=Archief beheerder
GenericName[pt_BR]=Compactador de Arquivos
Exec=xarchiver
Icon=xarchiver
Terminal=false
Type=Application
X-MultipleArgs=false
Categories=GTK;Archiving;Utility;
StartupNotify=true
MimeType=application/x-arj;application/arj;application/x-bzip;application/x-bzip-compressed-tar;application/x-gzip;application/x-rar;application/x-rar-compressed;application/x-tar;application/x-zip;application/x-zip-compressed;application/zip;multipart/x-zip;application/x-7z-compressed;application/x-compressed-tar;application/x-bzip2;application/x-bzip2-compressed-tar;" >> /usr/share/applications/hildon/xarchiver.desktop
[ -f /usr/share/dbus-1/services/xarchiver.service ] && echo "D-Bus service file exits" && rm /usr/share/dbus-1/services/xarchiver.service || echo "Service file doesn't exist"

echo "[D-BUS Service]
Name=org.maemo.xarchiver
Exec=/usr/bin/xarchiver" >> /usr/share/dbus-1/services/xarchiver.service
esac

#DEBHELPER#
