# Copyright 2018 Julian Ospald <hasufell@posteo.de>
# Distributed under the terms of the GNU General Public License v2

require freedesktop-desktop gtk-icon-cache
require cargo [ channel=stable ]
require github [ user=daa84 tag="v${PV}" ]

SUMMARY="Gtk ui for neovim"
HOMEPAGE="https://github.com/daa84/neovim-gtk ${HOMEPAGE}"

LICENCES="GPL-3.0"
MYOPTIONS=""

src_install() {
    ecargo_install

    insinto /usr/share/nvim-gtk
    doins -r runtime

    insinto /usr/share/applications
    doins desktop/*.desktop

    local s
    for s in 48 128; do
        insinto /usr/share/icons/hicolor/${s}x${s}/apps
        newins desktop/org.daa.NeovimGtk_${s}.png org.daa.NeovimGtk.png
    done

    insinto /usr/share/icons/hicolor/scalable/apps
    newins desktop/org.daa.NeovimGtk.svg org.daa.NeovimGtk.png

    insinto /usr/share/icons/hicolor/symbolic/apps
    newins desktop/org.daa.NeovimGtk-symbolic.svg org.daa.NeovimGtk.png
}

pkg_postinst() {
    freedesktop-desktop_update_desktop_database
    gtk-icon-cache_pkg_postinst
}

pkg_postrm() {
    freedesktop-desktop_update_desktop_database
    gtk-icon-cache_pkg_postrm
}