%define _dbus_ver		1.4.0
%define _gconf_ver		2.32.0
%define _gtk_ver		2.22.0
%define _glib_ver		2.26.0
%define _libgnomekbd_ver	2.32.0
%define _libglade_ver		2.6.0
%define _libgnome_menu_ver	2.30.4
%define _gnome_desktop_ver	2.32.0
%define _libexif_ver		0.6.12

%define xscreensaverdir %{_datadir}/control-center/screensavers

Summary:	GNOME Screensaver
Summary(ja):	GNOME スクリーンセーバー
Name:		gnome-screensaver
Version:	2.30.2
Release:	1%{?_dist_release}
License:	GPL
Group:		User Interface/Desktops
URL:		http://live.gnome.org/GnomeScreensaver/

Source0:	ftp://ftp.gnome.org/pub/gnome/sources/gnome-screensaver/2.30/gnome-screensaver-%{version}.tar.bz2
Source1: gnome-screensaver-hide-xscreensaver.menu

Vendor:		Project Vine
Distribution:	Vine Linux

BuildRoot:	%{_tmppath}/%{name}-%{version}-root
BuildRequires:	gtk2-devel >= %{_gtk_ver}
BuildRequires:	glib2-devel >= %{_glib_ver}
BuildRequires:	dbus-devel >= %{_dbus_ver}
BuildRequires:	GConf2-devel >= %{_gconf_ver}
BuildRequires:	libgnomekbd-devel >= %{_libgnomekbd_ver}
BuildRequires:	libglade2-devel >= %{_libglade_ver}
BuildRequires:	gnome-menus-devel >= %{_libgnome_menu_ver}
BuildRequires:	gnome-desktop-devel >= %{_gnome_desktop_ver}
BuildRequires:	libexif-devel >= %{_libexif_ver}
BuildRequires:	pam-devel
BuildRequires:	libX11-devel, libXScrnSaver-devel, libXext-devel
BuildRequires:	libXinerama-devel libXmu-devel
BuildRequires:	libnotify-devel
BuildRequires:	xorg-x11-proto-devel
BuildRequires:	libXxf86misc-devel
BuildRequires:	libXxf86vm-devel
BuildRequires:	gettext
BuildRequires:	perl(XML::Parser)
BuildRequires:	nss-devel
BuildRequires:	automake, autoconf, libtool, intltool
BuildRequires:	desktop-file-utils

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

%description
gnome-screensaver is a screen saver and locker that aims to have
simple, sane, secure defaults and be well integrated with the desktop.
It is designed to support:

 * the ability to lock down configuration settings
 * translation into many languages
 * user switching

%prep
%setup -q

%build
%configure \
	--disable-schemas-install \
	--enable-locking \
	--enable-pam \
	--enable-debug=no \
	--with-xscreensaverdir=%{_datadir}/xscreensavers/config \
	--with-xscreensaverhackdir=%{_libexecdir}/xscreensaver \
	--with-gdm-config=%{_datadir}/gdm/defaults.conf \
	--with-mit-screensaver=no
%__make

%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

desktop-file-install --vendor gnome --delete-original                   \
  --dir $RPM_BUILD_ROOT%{_datadir}/applications                         \
  --add-only-show-in GNOME                                              \
  $RPM_BUILD_ROOT%{_datadir}/applications/*.desktop

%find_lang %{name}

# hide xscreensaver from the menus
install -D -m644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/xdg/menus/preferences-post-merged/gnome-screensaver-hide-xscreensaver.menu

%post
export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
gconftool-2 --makefile-install-rule %{_sysconfdir}/gconf/schemas/gnome-screensaver.schemas >/dev/null

%pre
if [ "$1" -gt 1 ]; then
  export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
  gconftool-2 --makefile-uninstall-rule %{_sysconfdir}/gconf/schemas/gnome-screensaver.schemas >/dev/null
fi

%preun
if [ "$1" -eq 0 ]; then
  export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
  gconftool-2 --makefile-uninstall-rule %{_sysconfdir}/gconf/schemas/gnome-screensaver.schemas >/dev/null
fi

%clean
%__rm -rf %{buildroot}

%files -f %{name}.lang
%defattr(-,root,root)
%doc AUTHORS COPYING ChangeLog NEWS README TODO
%{_sysconfdir}/gconf/schemas/*.schemas
%{_sysconfdir}/pam.d/*
%{_sysconfdir}/xdg/menus/preferences-post-merged/*
%{_sysconfdir}/xdg/menus/*.menu
%{_sysconfdir}/xdg/autostart/gnome-screensaver.desktop
%{_bindir}/*
%{_libexecdir}/*
%{_libdir}/pkgconfig/*.pc
%{_datadir}/%{name}
%{_datadir}/applications/*.desktop
%{_datadir}/applications/screensavers/*.desktop
%{_datadir}/backgrounds/cosmos
%{_datadir}/desktop-directories/*.directory
%dir %{_datadir}/gnome-background-properties
%{_datadir}/gnome-background-properties/cosmos.xml
#%{_datadir}/pixmaps/backgrounds/*
%{_datadir}/pixmaps/*.svg
%{_datadir}/dbus-1/services/org.gnome.ScreenSaver.service
%{_mandir}/man1/*.1*

%changelog
* Tue Oct 05 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.30.2-1
- new upstream release
- remove BuildRequires: gnome-vfs2-devel, libgnomeui-devel
- fix %files

* Sat Sep 25 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.30.0-2
- rebuild with rpm-4.8.1 for pkg-config file

* Wed Mar 31 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.30.0-1
- new upstream release

* Sun Mar 07 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.28.3-1
- new upstream release
- add BuildRequires: desktop-file-utils

* Mon Nov  2 2009 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 2.28.0-1
- new upstream release
- update BR with gnome-2.28

* Sat Apr 25 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 2.26.1-1
- new upstream release

* Sun Mar 22 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 2.26.0-1
- new upstream release
- add BR: gnome-desktop-devel
- update BR with gnome-2.26

* Wed Sep 24 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 2.24.0-1
- new upstream release

* Thu May 22 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 2.22.2-1
- new upstream release

* Mon Aug 07 2006 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 2.14.3-0vl1
- new upstream release

* Mon Jul 17 2006 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 2.14.2-0vl3
- do not migrate at %%post

* Mon Jul 17 2006 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 2.14.2-0vl2
- migrate xscreensaver's screensavers like FC et al.

* Mon Jul 17 2006 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 2.14.2-0vl1
- initial build
