#!/bin/bash

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

echo -n "Install Pothos Flow icon resources...	"
if [ -x /usr/bin/xdg-icon-resource ] ; then
    for theme in hicolor gnome; do
        for size in 16 22 32 48 64 128; do
            xdg-icon-resource install --noupdate --context mimetypes --theme ${theme} --size ${size} ${DIR}/pothos-flow-${size}.png application-pothos-flow || true
            xdg-icon-resource install --noupdate --context apps --theme ${theme} --size ${size} ${DIR}/pothos-flow-${size}.png pothos-flow || true
        done
    done
    xdg-icon-resource forceupdate || true
    echo "OK"
else
    echo "FAIL (missing xdg-icon-resource)"
fi

echo -n "Install Pothos Flow MIME types...	"
if [ -x /usr/bin/xdg-mime ] ; then
    xdg-mime install ${DIR}/pothos-flow.xml || true
    echo "OK"
else
    echo "FAIL (missing xdg-mime)"
fi

echo -n "Install Pothos Flow menu launcher...	"
if [ -x /usr/bin/xdg-desktop-menu ] ; then
    xdg-desktop-menu install ${DIR}/pothos-flow.desktop || true
    echo "OK"
else
    echo "FAIL (missing xdg-desktop-menu)"
fi
