%define gtk2_version		2.10.0
%define glib2_version		2.8.0
%define dbus_version		0.60
%define libnotify_version	0.4.0

Summary: Notification Daemon 
Name: notification-daemon
Version: 0.4.0
Release: 8%{?_dist_release}
URL: http://www.galago-project.org/specs/notification/ 
License: GPL
Group: System Environment/Libraries

Source0: %{name}-%{version}.tar.bz2
Source1: notification-daemon-0.4.0-ja.po
Patch1:  notification-daemon-0.4.0-ja.patch

# patches from ubuntu
Patch103: notification-daemon-0.4.0-fix-xinerama-stack.patch
Patch104: notification-daemon-0.4.0-dont-crash-on-critical-warnings.patch
Patch105: notification-daemon-0.4.0-spacing.patch
Patch107: notification-daemon-0.4.0-memleak-daemon.patch
Patch109: notification-daemon-0.4.0-change-themes-crash-rev1.patch

# vine theme (based on coco) and vine5 theme (old theme)
# http://github.com/tatofoo/notification-daemon-engine-coco
Source200: notification-daemon-engine-vine.tar.bz2

# Vine patch
# use gvfs-open instead of gnome-open
Patch300: notification-daemon-0.4.0-browser.patch
# dirty hack to change notification bubble position.
Patch310: notification-daemon-0.4.0-position.patch
# add vine and vine5 theme
Patch320: notification-daemon-0.4.0-vine-theme.patch
# change default to slider
Patch330: notification-daemon-0.4.0-default-theme.patch
# change default notify location to TOP_RIGHT
Patch340: notification-daemon-0.4.0-location.patch

BuildRoot: %{_tmppath}/%{name}-%{version}-root
Requires: dbus >= %{dbus_version}
Requires: dbus-glib >= %{dbus_version}
Requires(post): GConf2
BuildRequires: glib2-devel >= %{glib2_version}
BuildRequires: dbus-devel >= %{dbus_version}
BuildRequires: dbus-glib-devel >= %{dbus_version}
BuildRequires: libnotify-devel >= %{libnotify_version}
BuildRequires: libsexy-devel
BuildRequires: libwnck-devel
BuildRequires: GConf2-devel
BuildRequires: libglade2-devel

%description
notification-daemon is the server implementation of the freedesktop.org
desktop notification specification.  

Vendor: Project Vine
Distribution: Vine Linux
Packager: daisuke

%prep
%setup -q -a 200

%patch1 -p1 -b .ja

%patch103 -p1
%patch104 -p1
%patch105 -p0
%patch107 -p1
%patch109 -p1

%patch300 -p1
%patch310 -p1
%patch320 -p1
%patch330 -p1
%patch340 -p1


# install japanese message catalog
%{__cp} %{SOURCE1} po/ja.po

%build
autoreconf -f -i
%configure --disable-schemas-install
make %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT 
%{__make} install DESTDIR=$RPM_BUILD_ROOT

%find_lang %name

# remove unpackaged files
rm -f $RPM_BUILD_ROOT%{_libdir}/notification-daemon-1.0/engines/*.{a,la}

# install desktop file
desktop-file-install --delete-original  \
        --dir ${RPM_BUILD_ROOT}%{_datadir}/applications   \
        --add-category DesktopSettings \
        ${RPM_BUILD_ROOT}%{_datadir}/applications/notification-properties.desktop


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

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

touch --no-create %{_datadir}/icons/hicolor
if [ -x %{_bindir}/gtk-update-icon-cache ] ; then
    %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
fi

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

%postun
touch --no-create %{_datadir}/icons/hicolor
if [ -x %{_bindir}/gtk-update-icon-cache ] ; then
    %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
fi


%clean
rm -rf %{buildroot}


%files -f %{name}.lang
%defattr(-,root,root)
%doc COPYING ChangeLog NEWS
%{_bindir}/notification-properties
%{_sysconfdir}/gconf/schemas/%{name}.schemas
%dir %{_libdir}/notification-daemon-1.0
%dir %{_libdir}/notification-daemon-1.0/engines
%{_libdir}/notification-daemon-1.0/engines/*.so
%{_libexecdir}/notification-daemon
%{_datadir}/dbus-1/services/org.freedesktop.Notifications.service
%{_datadir}/applications/notification-properties.desktop
%{_datadir}/icons/hicolor/16x16/apps/notification-properties.png
%{_datadir}/icons/hicolor/22x22/apps/notification-properties.png
%{_datadir}/icons/hicolor/24x24/apps/notification-properties.png
%{_datadir}/icons/hicolor/32x32/apps/notification-properties.png
%{_datadir}/icons/hicolor/48x48/apps/notification-properties.png
%{_datadir}/icons/hicolor/scalable/apps/notification-properties.svg
%{_datadir}/notification-daemon/notification-properties.glade

%changelog
* Tue Apr 19 2011 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 0.4.0-8
- add missing BuildRequires: GConf2-devel, libglade2-devel

* Sun Apr 17 2011 Shu KONNO <owa@bg.wakwak.com> 0.4.0-7
- rebuilt with rpm-4.8.1-3

* Sun May 16 2010 Daisuke SUZUKI <daisuke@linux.or.jp> 0.4.0-6
- update Source201

* Sat May 15 2010 Daisuke SUZUKI <daisuke@linux.or.jp> 0.4.0-5
- rebuild with new toolchain
- update Source201 (add modified coco theme as new default)
- add patch300 to use gvfs-open instead of gnome-open
- add patch310 to change notification bubble position
- add patch320 to add new vine theme
- add patch340 to change default notification localtion to top_right.
- add BR: libwnck-devel

* Sun Aug 09 2009 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.4.0-4
- add Categories=DesktopSettings for notification-properties.desktop

* Fri Jun 12 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 0.4.0-3
- add Source200, Patch200,201
  - add vine theme engine based on ubuntu engine.

- add patch101-109 from ubuntu
  - Patch103: fix xinerama stack
  - Patch104: dont crash on critical warnings
  - Patch105: fix notification spacing
  - Patch107: fix memleak
  - Patch109: fix crash on theme changing

* Sat Mar 28 2009 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.4.0-2
- add japanese translation (Source1 and Patch1)
- prperly install/uninstall gconf schemas
- update gtk icon cache with %%post, %%postun

* Fri Mar 27 2009 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.4.0-1
- new upstream release
- change required gtk2 version to 2.10.0

* Sun Oct  5 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.3.7-1
- applied new versioning policy

* Tue Dec 18 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.3.7-0vl2
- rebuilt with libwnck 2.20.2

* Tue May 29 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.3.7-0vl1
- new upstream release
- rebuilt with libsexy 0.1.10
- added BuildRequores: libsexy-devel

* Fri Jun 02 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 0.3.5-0vl1
- new upstream release

* Sat Mar 11 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 0.3.4-0vl1
- initial build for Vine Linux partialy based on FC package.

* Wed Mar 08 2006 John (J5) Palmieri <johnp@redhat.com> - 0.3.1-9
- Add patch to fix struct handling in the dbus glib binding for dbus 0.61
  so image data works again

* Tue Feb 14 2006 Christopher Aillon <caillon@redhat.com> - 0.3.1-8
- BuildRequires love, for all you lovers out there.

* Fri Feb 10 2006 Jesse Keating <jkeating@redhat.com> - 0.3.1-7.1
- bump again for double-long bug on ppc(64)

* Thu Feb 09 2006 Florian La Roche <laroche@redhat.com>
- remove empty scripts from .spec file

* Tue Feb 07 2006 Jesse Keating <jkeating@redhat.com> - 0.3.1-6.1
- rebuilt for new gcc4.1 snapshot and glibc changes

* Fri Feb  3 2006 Christopher Aillon <caillon@redhat.com> - 0.3.1-6
- Add patch to determine whether a compositing manager is running
  when drawing a new notification bubble, as long as the CM grabs
  the appropriate XSelection.

* Fri Jan 20 2006 Christopher Aillon <caillon@redhat.com> - 0.3.1-5
- Make it so that marked-up messages appear with markup

* Thu Jan 12 2006 Christopher Aillon <caillon@redhat.com> - 0.3.1-4
- Provide desktop-notification-daemon, since libnotify requires a
  notification deamon, but not this specific one.  Other notification
  daemons can exist on the system so long as they meet the provides
  (and the API of course).

* Mon Jan  9 2006 Christopher Aillon <caillon@redhat.com> - 0.3.1-3
- Fix positioning of the notification bubble to not draw off-screen

* Wed Dec 14 2005 John (J5) Palmieri <johnp@redhat.com> - 0.3.1-2
- Actuall release of 0.3.1

* Thu Nov 17 2005 John (J5) Palmieri <johnp@redhat.com> - 0.3.1-1
- Upgrade to upstream 0.3.1 

* Tue Nov 15 2005 John (J5) Palmieri <johnp@redhat.com> - 0.3.0-1
- inital build
