%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%global	python_module_name gcdemu

Summary: A GNOME panel applet to control CDEmu daemon
Summary: CDEmu daemon を制御するための GNOME パネルアプレット
Name: gcdemu
Version: 1.3.0
Release: 2%{?_dist_release}
License: GPLv2+
Group: Applications/Accessories
URL: http://cdemu.sourceforge.net
Source: http://downloads.sourceforge.net/cdemu/%{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildArch: noarch

BuildRequires: dbus-python-devel
BuildRequires: gettext
BuildRequires: intltool >= 0.21
BuildRequires: gnome-panel-devel
BuildRequires: gnome-python-devel
BuildRequires: perl-XML-Parser
BuildRequires: pygtk2-devel >= 2.6
BuildRequires: python-devel
BuildRequires: gnome-doc-utils >= 0.3.2

Requires: dbus-python >= 0.80
Requires: gnome-python-applet
Requires: hicolor-icon-theme
Requires: pygtk2 >= 2.6

Requires(pre): GConf2
Requires(post):	GConf2
Requires(preun): GConf2

Requires(post): scrollkeeper
Requires(postun): scrollkeeper

%description
This is gCDEmu, a GNOME applet for controlling CDEmu daemon. It is part of the 
userspace-cdemu suite, a free, GPL CD/DVD-ROM device emulator for linux.

It provides a graphic interface that allows performing the key tasks related to
controlling the CDEmu daemon, such as loading and unloading devices, displaying 
devices' status and retrieving/setting devices' debug masks.

In addition, applet listens to the signals emitted by CDEmu daemon and provides
the notification via libnotify's notifications (provided that python bindings
are installed).

%prep
%setup -q

%build
%{configure} --disable-schemas-install --disable-scrollkeeper
%{__make} %{?_smp_mflags}

%install
%{__rm} -rf $RPM_BUILD_ROOT
export GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1
%{__make} install DESTDIR=$RPM_BUILD_ROOT
unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
%find_lang gcdemu --with-gnome

%clean
%{__rm} -rf $RPM_BUILD_ROOT

%pre
if [ "$1" -gt 1 ]; then
	export GCONF_CONFIG_SOURCE=$(gconftool-2 --get-default-source)
	gconftool-2 --makefile-uninstall-rule \
		%{_sysconfdir}/gconf/schemas/gcdemu.schemas >/dev/null ||:
fi

%post
scrollkeeper-update -q
export GCONF_CONFIG_SOURCE=$(gconftool-2 --get-default-source)
gconftool-2 --makefile-install-rule \
	%{_sysconfdir}/gconf/schemas/gcdemu.schemas >/dev/null ||:

%preun
if [ "$1" -eq 0 ]; then
	export GCONF_CONFIG_SOURCE=$(gconftool-2 --get-default-source)
	gconftool-2 --makefile-uninstall-rule \
		%{_sysconfdir}/gconf/schemas/gcdemu.schemas >/dev/null ||:
fi

%postun 
scrollkeeper-update -q

%files -f gcdemu.lang
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING NEWS README
%{_datadir}/pixmaps/*
#%{_datadir}/omf/gcdemu/gcdemu-C.omf
%{_libdir}/bonobo/servers/*
%{_libexecdir}/*
%dir %{python_sitelib}/%{python_module_name}/
%{python_sitelib}/%{python_module_name}/*.py*
%{_sysconfdir}/gconf/schemas/*


%changelog
* Fri Nov 19 2010 IWAI, Masaharu <iwai@alib.jp> - 1.3.0-2
- add BuildRequires: gnome-doc-utils >= 0.3.2

* Fri Sep 3 2010 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.3.0-1
- new upstream release

* Sun Feb 7 2010 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.2.0-2
- rebuilt with python-2.6.4

* Fri Sep 25 2009 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.2.0-1
- initial build for VineSeed

* Sat Jun 28 2008 Rok Mandeljc <rok.mandeljc@email.si> - 1.1.0-1
- Updated to 1.1.0

* Thu Dec 20 2007 Rok Mandeljc <rok.mandeljc@email.si> - 1.0.0-1
- Initial RPM release.
