%define nautilus_extensions_dir %{_libdir}/nautilus/extensions-2.0

Summary: Dropbox extension for Nautilus
Name: nautilus-dropbox
Version: 0.6.1
Release: 1%{?_dist_release}
License: GPLv2
Group: Applications/Internet
URL: https://www.dropbox.com/
Source0: %{name}-%{version}.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
BuildRequires: nautilus-devel >= 2.16.0
BuildRequires: glib2-devel >= 2.14.0
BuildRequires: libnotify-devel >= 0.4.4
BuildRequires: pygtk2
BuildRequires: docutils
BuildRequires(check): desktop-file-utils
Requires: %{name}-images = %{version}
Requires: nautilus glib2 libnotify pygtk2
Requires(post,postun): desktop-file-utils, gtk2

%description
Dropbox extension for Nautilus.
Dropbox is online backup, file sync and sharing made easy web seavice.
See https://www.dropbox.com/

%description -l ja
Nautilus のための Dropbox 拡張。
Dropbox はオンラインバックアップやファイルの同期と共有を簡単に
実現するウェブサービスです。
詳細は https://www.dropbox.com/ を見てください。

%package images-nonfree
Summary: Dropbox extension for Nautilus non-free images
Group: Applications/Internet
License: non-free (see COPYING)
Requires: %{name} = %{version}-%{release}
Provides: %{name}-images
%description images-nonfree
Dropbox extension for Nautilus non-free images.

%prep
%setup -q
%configure

%build
make

%install
rm -rf %{buildroot}
%makeinstall NAUTILUS_EXTENSION_DIR=%{buildroot}%{nautilus_extensions_dir}

## drop unnecessary files
# *.{a,la}
%{__rm} -f %{buildroot}%{nautilus_extensions_dir}/libnautilus-dropbox.{a,la}
# cache file
%{__rm} -f %{buildroot}%{_datadir}/icons/hicolor/icon-theme.cache

%check
%{_bindir}/desktop-file-validate %{buildroot}/%{_datadir}/applications/dropbox.desktop

%post
touch --no-create %{_datadir}/icons/hicolor
if [ -x %{_bindir}/gtk-update-icon-cache ]; then
  %{_bindir}/gtk-update-icon-cache -q %{_datadir}/icons/hicolor
fi
if [ -x %{_bindir}/update-desktop-database ] ; then
  %{_bindir}/update-desktop-database %{_datadir}/applications
fi

%postun
touch --no-create %{_datadir}/icons/hicolor
if [ -x %{_bindir}/gtk-update-icon-cache ]; then
  %{_bindir}/gtk-update-icon-cache -q %{_datadir}/icons/hicolor
fi
if [ -x %{_bindir}/update-desktop-database ] ; then
  %{_bindir}/update-desktop-database %{_datadir}/applications
fi

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root,-)
%doc AUTHORS COPYING NEWS README
%config(missingok) %{_datadir}/applications/dropbox.desktop
%{_bindir}/dropbox
%{nautilus_extensions_dir}/libnautilus-dropbox.so
%{_mandir}/man1/dropbox.1*

%files images-nonfree
%defattr(-,root,root,-)
%doc COPYING README
%{_datadir}/icons/hicolor/*/apps/*
%{_datadir}/icons/hicolor/*/emblems/*

%changelog
* Sat Mar 13 2010 IWAI, Masaharu <iwai@alib.jp> 0.6.1-1
- Initial build.

