#Maintainer: George Vlahavas (vlahavas~at~gmail~dot~com)

pkgname=bluez-gnome
pkgver=0.28
pkgrel=1gv
arch=x86_64
source=("http://bluez.sf.net/download/bluez-gnome-$pkgver.tar.gz" "bluetooth-applet.desktop" "bluetooth-sendto.desktop")
docs=("readme" "install" "copying" "changelog" "authors" "news" "todo" "maintainers")
url=http://www.bluez.org/
options=('noautodotnew')

doinst() {
	if [ -x usr/bin/update-desktop-database ]; then
	          usr/bin/update-desktop-database ./usr/share/applications >/dev/null 2>&1
	fi
	if [ -x usr/bin/update-mime-database ]; then
	          usr/bin/update-mime-database ./usr/share/mime >/dev/null 2>&1
	fi
	if [ -x usr/bin/gtk-update-icon-cache ]; then
	          usr/bin/gtk-update-icon-cache -f -t usr/share/icons/hicolor >/dev/null 2>&1
	fi
}

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"bluez-gnome (Bluetooth utilities for GNOME)"
"bluez-gnome contains various GNOME applets to detect bluetooth"
"adapters and configure them."
)


build() {
	cd $startdir/src/$pkgname-$pkgver
	./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc --disable-schemas-install --disable-desktop-update --disable-mime-update --disable-icon-update --with-gconf-source="xml::/etc/gconf/gconf.xml.defaults"
	make || return 1
	make install DESTDIR=$startdir/pkg

	mkdir -p $startdir/pkg/usr/share/Thunar/sendto
	mv $startdir/src/bluetooth-sendto.desktop $startdir/pkg/usr/share/Thunar/sendto
	chown -R root:root $startdir/pkg/usr/share
	chmod 644 $startdir/pkg/usr/share/Thunar/sendto/bluetooth-sendto.desktop

	# gconf stuff
        export GCONF_CONFIG_SOURCE="xml::$startdir/pkg/etc/gconf/gconf.xml.defaults"
        if [ -d $startdir/pkg/etc/gconf/schemas ]; then
                install -v -d -m755 $startdir/pkg/etc/gconf/gconf.xml.defaults
                SCHEMAS=$startdir/pkg/etc/gconf/schemas
                for schema in $SCHEMAS/*.schemas; do
                        gconftool-2 --makefile-install-rule $schema
                done
                # Reset / Verify correct permissions
                ( cd $startdir/pkg/etc/gconf ; find . -type d -exec chmod 755 {} \; )
                ( cd $startdir/pkg/etc/gconf ; find . -type f -exec chmod 644 {} \; )
        fi
	sed -i -e "s/OnlyShowIn=GNOME;/#OnlyShowIn=GNOME;/" $startdir/pkg/usr/share/applications/bluetooth-properties.desktop
	sed -i -e "s/OnlyShowIn=GNOME;/#OnlyShowIn=GNOME;/" $startdir/pkg/usr/share/applications/bluetooth-analyzer.desktop
	sed -i -e "s/OnlyShowIn=GNOME;/#OnlyShowIn=GNOME;/" $startdir/pkg/etc/xdg/autostart/bluetooth-applet.desktop
} 
