%define name	gwget
%define version	1.0.4
%define release	4%{?_dist_release}

Summary:	Download manager for Gnome
Summary(ja): 	Gnome 用ダウンロードマネージャ
Name:		%{name}
Version:	%{version}
Release: 	%{release}
License:	GPLv2+
Group:		Applications/Internet
URL:		http://www.gnome.org/projects/gwget/

Source0:	http://ftp.gnome.org/pub/GNOME/sources/gwget/1.0/%{name}-%{version}.tar.bz2
Patch1:		gwget-1.0.4-libnotify-0.7.0.patch
Patch2:		gwget-glib.patch

BuildRoot:	%{_tmppath}/%{name}-%{version}-root
BuildRequires:	gtk2-devel >= 2.10
BuildRequires:	libgnomeui-devel
BuildRequires:	libglade2-devel, gnome-vfs2-devel
BuildRequires:	dbus-devel
BuildRequires:	libnotify-devel
BuildRequires:	libSM-devel
BuildRequires:	intltool >= 0.35.0
BuildRequires:	gettext >= 0.14.1
BuildRequires:	desktop-file-utils
Requires:	wget >= 1.9
Requires(post): GConf2
Requires(preun): GConf2

%description
Gwget is a Download Manager for Gnome 2. It uses wget as a backend.
Currently, very basic wget options are available, supporting multiple
downloads, drag&drop and display the errors from wget process.

%description -l ja
Gwget は Gnome 2 向けのダウンロードマネージャです。バックエンドに wget を使用します。現在は基本的な wget オプションを利用することができ、複数のダウンロード、ドラッグ&ドロップ、wget プロセスからのエラー表示に対応しています。

%prep
%setup -q
%patch1 -p1 -b .libnotify-0.7.0
%patch2 -p1 -b .glib

# convert files to UTF-8 with preserving the timestamps
for file in ChangeLog README; do
    mv $file timestamp
    iconv -f ISO-8859-1 -t UTF-8 -o $file timestamp
    touch -r timestamp $file
done

%build
%configure --disable-epiphany-extension --disable-static
make %{?_smp_mflags}


%install
%{__rm} -rf ${RPM_BUILD_ROOT}
export GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1
make install DESTDIR=$RPM_BUILD_ROOT INSTALL='install -p'
unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL

desktop-file-install \
	--dir ${RPM_BUILD_ROOT}%{_datadir}/applications	\
	--delete-original				\
	${RPM_BUILD_ROOT}%{_datadir}/applications/%{name}.desktop

%find_lang %{name}

#remove unnecessary files.
%{__rm} -rf ${RPM_BUILD_ROOT}/%{_includedir}/gwget

%clean
%{__rm} -rf ${RPM_BUILD_ROOT}

%post
export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
gconftool-2 --makefile-install-rule %{_sysconfdir}/gconf/schemas/gwget.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/gwget.schemas > /dev/null
fi

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

%postun
update-desktop-database -q

%files -f %{name}.lang
%defattr(-,root,root)
%doc AUTHORS COPYING ChangeLog INSTALL NEWS README THANKS TODO
%{_bindir}/gwget
%{_sysconfdir}/gconf/schemas/gwget.schemas
%{_datadir}/applications/gwget.desktop
%{_datadir}/gwget
%{_datadir}/pixmaps/gwget.png
%{_datadir}/dbus-1/services/org.gnome.gwget.service

%changelog
* Mon Dec 15 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 1.0.4-4
- added Patch1 and 2 to build with current VineSeed

* Sun Feb 12 2012 Toshiharu Kudoh <toshi.kd2@gmail.com> 1.0.4-3
- rebuilt with rpm-4.8.1

* Sun Jan 24 2010 Toshiharu Kudoh <toshi.kd2@gmail.com> 1.0.4-2
- added BuildRequires: libSM-devel (see [BTS:VineLinux:0900])

* Tue Oct 20 2009 Toshiharu Kudoh <toshi.kd2@gmail.com> 1.0.4-1
- new upstream release

* Sun Oct 11 2009 Toshiharu Kudoh <toshi.kd2@gmail.com> 1.0.2-1
- new upstream release
- added --disable-static in configure option
- changed make %{?_smp_mflags}
- added BuildRequires:	libnotify-devel, intltool >= 0.35.0, gettext >= 0.14.1, desktop-file-utils

* Sat May 23 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.1-1
- applied new versioning policy, spec in UTF-8
- new upstream release

* Wed Jul 25 2007 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.99-0vl1
- rebuild for Vine Seed.
- add requried gtk2 version >= 2.10.

* Wed Jul 25 2007 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.98.2-0vl1
- initial build for Vine Plus/4.0.
