# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="4"

inherit gnome2-utils

MY_PN="AwOken"
DESCRIPTION="A scalable icon theme called AwOken"
HOMEPAGE="http://alecive.deviantart.com/art/AwOken-163570862"
SRC_URI="http://www.deviantart.com/download/163570862/${MY_PN}_by_alecive-d2pdw32.zip -> ${P}.zip"

LICENSE="CCPL-Attribution-ShareAlike-NonCommercial-3.0"
SLOT="0"
KEYWORDS="amd64 x86"
IUSE="minimal"

RDEPEND="!minimal? ( x11-themes/gnome-icon-theme )
	x11-themes/hicolor-icon-theme
	gnome-extra/zenity
	media-gfx/imagemagick"

RESTRICT="binchecks strip"

S="${WORKDIR}/${MY_PN}-${PV}"

src_unpack() {
	unpack ${A}
	cd ${MY_PN}-${PV}
	unpack "./${MY_PN}{,Dark,White}.tar.gz"
}

src_prepare() {
	local res
	for theme in ${MY_PN}{,Dark,White}; do
		for res in 22 128; do
			ln -sf ../start-here/start-here-gentoo2.png \
				${S}/${theme}/clear/${res}x${res}/places/start-here.png || die
		done
	done
	sed -i -e "s:\$DIR/\$ICNST/Installation_and_Instructions.pdf:/usr/share/doc/${P}/Installation_and_Instructions.pdf:" ${MY_PN}/awoken-icon-theme-customization
}

src_install() {
	for theme in ${MY_PN}{,Dark,White}; do
		insinto /usr/share/icons/${theme}
		doins -r ${theme}/{clear,extra}
		doins ${theme}/index.theme
		doins ${theme}/awoken-icon-theme-customization-*
		doins ${theme}/.${theme/${MY_PN}/${MY_PN}rc}
	done
	dobin ${MY_PN}/awoken-icon-theme-customization{,-clear}
	dodoc ${MY_PN}/Installation_and_Instructions.pdf
}

pkg_preinst() {
	gnome2_icon_savelist
}

pkg_postinst() {
	gnome2_icon_cache_update
}

pkg_postrm() {
	gnome2_icon_cache_update
}