Summary:        A tool to configure pointing devices
Summary(ja):    ポインティングデバイスを設定するためのツール

Name:           gpointing-device-settings
Version:        1.5.1
Release:        1%{?_dist_release}
License:        LGPLv3+
Group:          Applications/System
URL:            http://live.gnome.org/GPointingDeviceSettings

Source:         %{name}-%{version}.tar.gz
# see https://aur.archlinux.org/packages.php?ID=25663&detail=1
Patch0:		gpointing-device-settings-1.5.1-fix-gdk-display.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  GConf2-devel
BuildRequires:  gtk2-devel
BuildRequires:  intltool
BuildRequires:  gnome-settings-daemon-devel >= 2.28.0
Requires(post): GConf2
Requires(post):	desktop-file-utils
Requires(postun):	desktop-file-utils

Vendor: Project Vine
Distribution: Vine Linux

%description
This application can be used to configure pointing devices like trackpoints
or touchpads, that are commonly used on laptops.


%package devel
Summary:        A tool to configure pointing devices
License:        LGPLv3+
Group:          Development/Libraries
Requires:       %{name} = %{version}, GConf2-devel, gtk2-devel

%description devel
This application can be used to configure pointing devices like trackpoints
or touchpads, that are commonly used on laptops.

This package contains all necessary include files and libraries needed
to develop modules for gpointing-device-settings.


%prep
%setup -q
%patch0 -p1 -b .gdk-display

%build
%configure --disable-static
%{__make} %{?_smp_mflags}

%install
make install DESTDIR=$RPM_BUILD_ROOT

# install .desktop
cat > $RPM_BUILD_ROOT%{_datadir}/applications/%{name}.desktop <<EOF
[Desktop Entry]
Name=Pointing Devices
Name[ja]=ポインティングデバイス
Comment=Configure pointing devices
Comment[ja]=ポインティングデバイスを設定します
Type=Application
TryExec=%{name}
Exec=%{_bindir}/%{name}
Icon=input-touchpad.png
Terminal=false
StartupNotify=true
Categories=GNOME;GTK;Settings;HardwareSettings;
OnlyShowIn=GNOME;Categories=Graphics;2DGraphics;RasterGraphics;GTK;
EOF

# remove unnecessary files
find $RPM_BUILD_ROOT/%{_libdir} -name "*.la" -exec %{__rm} -f "{}" \;
find $RPM_BUILD_ROOT/%{_libdir} -name "*.a" -exec %{__rm} -f "{}" \;

%find_lang %{name}
      

%clean
rm -rf $RPM_BUILD_ROOT

%pre
if [ "$1" -gt 1 ]; then
  export GCONF_CONFIG_SOURCE=$(gconftool-2 --get-default-source)
  SCHEMAS="gpointing-device-settings_gnome_settings_daemon.schemas"
  for S in $SCHEMAS; do
    gconftool-2 --makefile-uninstall-rule \
     %{_sysconfdir}/gconf/schemas/$S > /dev/null
  done
fi

%post
/sbin/ldconfig
update-desktop-database %{_datadir}/applications >& /dev/null ||:
export GCONF_CONFIG_SOURCE=$(gconftool-2 --get-default-source)
SCHEMAS="gpointing-device-settings_gnome_settings_daemon.schemas"
for S in $SCHEMAS; do
  gconftool-2 --makefile-install-rule \
   %{_sysconfdir}/gconf/schemas/$S > /dev/null
done

%preun
if [ "$1" -eq 0 ]; then
  export GCONF_CONFIG_SOURCE=$(gconftool-2 --get-default-source)
  SCHEMAS="gpointing-device-settings_gnome_settings_daemon.schemas"
  for S in $SCHEMAS; do
    gconftool-2 --makefile-uninstall-rule \
     %{_sysconfdir}/gconf/schemas/$S > /dev/null
  done
fi

%postun
update-desktop-database %{_datadir}/applications >& /dev/null ||:



%files -f %{name}.lang
%defattr(-,root,root,-)
%doc COPYING MAINTAINERS NEWS TODO
%{_sysconfdir}/gconf/schemas/*
%{_bindir}/*
%{_datadir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_libdir}/%{name}
%{_libdir}/gnome-settings-daemon-2.0/*.so
%{_libdir}/gnome-settings-daemon-2.0/*.gnome-settings-plugin
%{_libdir}/*.so.*
%{_mandir}/man1/%{name}.1*

%files devel
%defattr(-,root,root,-)
%{_includedir}/gpointing-device-settings
%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc


%changelog
* Thu May 12 2011 Kazutaka HARADA <kazutaka@vinelinux.org> 1.5.1-1
- new upstream release
- specify required version for gnome-settings-daemon-devel >= 2.28.0
- add patch0 to fix compile error
- add Vendor and Distribution tags
- add .desktop file

* Wed Jun 10 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 1.3.1-1
- initial build for Vine Linux

