#Packager: George Vlahavas <vlahavas~at~gmail~dot~com>

pkgname=gnome-schedule
pkgver=2.1.1
pkgrel=2gv
source=("http://downloads.sourceforge.net/project/gnome-schedule/gnome-schedule-2/gnome-schedule-2.1.1/gnome-schedule-2.1.1.tar.gz" "gnome-schedule-2.1.1-nohelp.patch" "gnome-schedule-48.png" "gnome-schedule-2.1.1-el.patch" "gnome-schedule-2.1.1-rootuser.patch")
docs=("readme" "install" "copying" "changelog" "authors" "news" "todo")
url=http://gnome-schedule.sourceforge.net/

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"gnome-schedule (GNOME scheduler for automatic tasks)"
"Gnome-schedule is a graphical user interface that leverages the power"
"of vixie-cron, dcron and at to manage your crontab file and provide an"
"easy way to schedule tasks on your computer. It supports recurrent"
"(periodical) tasks and tasks that happen only once in the future. It"
"is written in Python using pygtk, and has been developed, tested and"
"packaged for various Linux distributions."
)


build() {
	cd $startdir/src/$pkgname-$pkgver

	patch -p1 < $startdir/src/gnome-schedule-2.1.1-rootuser.patch || exit 1
	patch -p1 < $startdir/src/gnome-schedule-2.1.1-nohelp.patch || exit 1
	
	cd po
	patch -p0 < $startdir/src/gnome-schedule-2.1.1-el.patch || exit 1
	cd ..

	mkdir -p $startdir/pkg/usr/share/icons/hicolor/scalable/apps
	cp $startdir/src/$pkgname-$pkgver/icons/gnome-schedule.svg $startdir/pkg/usr/share/icons/hicolor/scalable/apps
	mkdir -p $startdir/pkg/usr/share/icons/hicolor/48x48/apps
	cp $startdir/src/gnome-schedule-48.png $startdir/pkg/usr/share/icons/hicolor/48x48/apps/gnome-schedule.png

	./configure --prefix=/usr --libdir=/usr/lib${LIBDIRSUFFIX} --localstatedir=/var --sysconfdir=/etc --build=$arch-slackware-linux
	make || return 1
	make install DESTDIR=$startdir/pkg

	sed -i "s/^Icon=.*/Icon=gnome-schedule/" $startdir/pkg/usr/share/applications/gnome-schedule.desktop
	cp $startdir/pkg/usr/share/applications/gnome-schedule.desktop $startdir/pkg/usr/share/applications/gnome-schedule-root.desktop
	sed -i "s/^Categories=.*/Categories=Application;Utility;/" $startdir/pkg/usr/share/applications/gnome-schedule.desktop
	sed -i "s/^Exec=.*/Exec=gksu dbus-launch gnome-schedule/" $startdir/pkg/usr/share/applications/gnome-schedule-root.desktop

	# Gnome help files are not needed
	rm -rf $startdir/pkg/usr/share/omf
	rm -rf $startdir/pkg/usr/share/gnome
}