# -*- coding: utf-8-unix -*-
%global bzr bzr830

Name:           avant-window-navigator
Version:        0.4.1
Release:        1%{?bzr:.%bzr}%{?_dist_release}

Summary:        Fully customisable dock-like window navigator for GNOME

Group:          User Interface/Desktops
#libawn is LGPLv2+, rest is GPLv2+
License:        GPLv2+ and LGPLv2+
URL:            https://launchpad.net/awn
# upstream snapshot: 
# bzr branch lp:awn
# bzr export --root=avant-window-navigator-0.4.1-bzr830 avant-window-navigator-0.4.1-bzr830.tar.gz
#
Source0:       %{name}-%{version}-%{bzr}.tar.gz

BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root


BuildRequires:  libwnck-devel 
BuildRequires:  dbus-glib-devel
BuildRequires:  pygtk2-devel 
BuildRequires:  pycairo-devel
BuildRequires:  GConf2-devel 
BuildRequires:  startup-notification-devel
BuildRequires:  gnome-desktop-devel libgnome-devel gnome-python
BuildRequires:  libXdamage-devel libXcomposite-devel libXres-devel 
BuildRequires:  gettext, intltool
BuildRequires:  desktop-file-utils
BuildRequires:  pyxdg libgtop2-devel
BuildRequires:  libdesktop-agnostic-bin >= 0.3.91
BuildRequires:  libdesktop-agnostic-devel >= 0.3.91
BuildRequires:  vala
BuildRequires:  libtool

Requires:       gnome-python, gnome-python-gnomedesktop, pyxdg
Requires:       libdesktop-agnostic-bin >= 0.3.91
Requires:       python-desktop-agnostic >= 0.3.91
Requires(pre):  GConf2
Requires(post): GConf2
Requires(preun): GConf2

%description
Avant Window Navgator (Awn) is a dock-like bar which sits at the bottom of 
the screen (in all its composited-goodness) tracking open windows.

%package devel
Summary:    Fully customisable dock-like window navigator for GNOME
Group:      Development/Libraries
Requires:   %{name} = %{version}-%{release}

%description devel
This package includes all header files and library of AWN for development.

%prep
%setup -q -n %{name}-%{version}%{?bzr:-%{bzr}}


%build
intltoolize --copy --force --automake
gtkdocize --copy
autoreconf --force --install

%configure \
    --disable-static \
    --with-gnu-ld \
    --with-vala \
    --disable-shave \
    ;
%__sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
%__sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
%__make %{?_smp_mflags}


%install
%__rm -rf $RPM_BUILD_ROOT
export GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1
%__make install DESTDIR=$RPM_BUILD_ROOT
find ${RPM_BUILD_ROOT} -name '*.la' | xargs %__rm

#remove shebangs
%__sed -i -e '/^#!\//, 1d' $RPM_BUILD_ROOT%{_datadir}/avant-window-navigator/awn-settings/awnSettings.py
%__sed -i -e '/^#!\//, 1d' $RPM_BUILD_ROOT%{_datadir}/avant-window-navigator/awn-settings/awnSettingsHelper.py


%find_lang %{name}

desktop-file-install --vendor vine --delete-original  \
        --dir $RPM_BUILD_ROOT%{_datadir}/applications   \
        --remove-category Application \
        $RPM_BUILD_ROOT%{_datadir}/applications/avant-window-navigator.desktop

desktop-file-install --vendor vine --delete-original  \
        --dir $RPM_BUILD_ROOT%{_datadir}/applications   \
        --remove-category Application \
        $RPM_BUILD_ROOT%{_datadir}/applications/awn-settings.desktop


%pre
##obsolete schemas: awn awn-applets-shared
for schema in awn awn-applets-shared; do
    if [ -f %{_sysconfdir}/gconf/schemas/${schema}.schemas ]; then
        export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
        gconftool-2 --makefile-uninstall-rule \
            %{_sysconfdir}/gconf/schemas/${schema}.schemas >/dev/null || :
    fi
done


%post
##upgrade schemas: 
##avant-window-navigator awn-applet-taskmanager awn-applet-simple-launcher
for schema in avant-window-navigator \
              awn-applet-taskmanager \
              awn-applet-simple-launcher; do
    if [ -f %{_sysconfdir}/gconf/schemas/${schema}.schemas ]; then
        export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
        gconftool-2 --makefile-install-rule \
            %{_sysconfdir}/gconf/schemas/${schema}.schemas >/dev/null || :
    fi
done

/sbin/ldconfig

touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :


%preun
if [ "$1" -eq 0 ]; then
    for schema in avant-window-navigator \
                  awn-applet-taskmanager \
		  awn-applet-simple-launcher; do
        if [ -f %{_sysconfdir}/gconf/schemas/${schema}.schemas ]; then
	    export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
            gconftool-2 --makefile-uninstall-rule \
	        %{_sysconfdir}/gconf/schemas/${schema}.schemas >/dev/null || :
        fi
    done
fi


%postun
/sbin/ldconfig

if [ $1 -eq 0 ] ; then
    touch --no-create %{_datadir}/icons/hicolor &>/dev/null
    if [ -x %{_bindir}/gtk-update-icon-cache ]; then
      %{_bindir}/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
    fi
fi


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


%clean
%__rm -rf $RPM_BUILD_ROOT


%files -f %{name}.lang
%defattr(-,root,root,-)
%doc AUTHORS COPYING COPYING.LIB ChangeLog README
#%doc %{_datadir}/gtk-doc/html/libawn
%{_bindir}/*
%{_libdir}/libawn*.so.*
%dir %{_libdir}/awn
%dir %{_libdir}/awn/applets
%{_libdir}/awn/applets/*/*.so
%config(noreplace) %{_sysconfdir}/gconf/schemas/avant-window-navigator.schemas
%config(noreplace) %{_sysconfdir}/gconf/schemas/awn-applet-taskmanager.schemas
%config(noreplace) %{_sysconfdir}/gconf/schemas/awn-applet-simple-launcher.schemas
%{_datadir}/applications/*
%dir %{_datadir}/avant-window-navigator
%{_datadir}/avant-window-navigator/*
%{_datadir}/icons/hicolor/*/apps/*
%{_datadir}/icons/hicolor/scalable/categories/awn-plugins.svg
%dir %{python_sitearch}/awn
%{python_sitearch}/awn/*

%files devel
%defattr(-,root,root,-)
%doc AUTHORS COPYING COPYING.LIB ChangeLog README
%dir %{_includedir}/libawn
%{_includedir}/libawn/*
%{_libdir}/libawn*.so
%{_libdir}/pkgconfig/*.pc
%{_datadir}/pygtk/2.0/defs/awn.defs
%{_datadir}/vala/vapi/awn.*


%changelog
* Sat Jun 18 2011 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.4.1-1.bzr830
- updated to source 0.4.1 (bzr830) based on Fedora rawhide

* Sun Mar 22 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 0.2.6-3
- rebuild with gnome-desktop-2.26.0

* Mon Feb 16 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.2.6-2
- corrected *.desktop

* Mon Feb 02 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.2.6-1
- initial build

* Sat Dec 20 2008 Sindre Pedersen Bj淡rdal <sindrepb@fedoraproject.org> - 0.2.6-14
- Add missing libXres buildrequires

* Thu Dec 04 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com> - 0.2.6-13
- Rebuild for Python 2.6

* Thu Dec 04 2008 Sindre Pedersen Bj淡rdal <sindrepb@fedoraproject.org> - 0.2.6-12
- Add patch to fix metacity sticky bug, #469032

* Sat Nov 29 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com> - 0.2.6-11
- Rebuild for Python 2.6

* Fri Nov 28 2008 Caol叩n McNamara <caolanm@redhat.com - 0.2.6-10
- rebuild for dependencies

* Sun Aug 03 2008 Sindre Pedersen Bj淡rdal <sindrepb@fedoraproject.org> - 0.2.6-9
- Add patch to fix empty string in schemas file. #457683

* Sat Mar 22 2008 Sindre Pedersen Bj淡rdal <sindrepb@fedoraproject.org> - 0.2.6-8
- Add missing pyxdg requires

* Tue Mar 20 2008 Sindre Pedersen Bj淡rdal <sindrepb@fedoraproject.org> - 0.2.6-6
- Incorparate the python package in main, #438411
* Mon Mar 17 2008 Sindre Pedersen Bj淡rdal <sindrepb@fedoraproject.org> - 0.2.6-3
- Fix python package

* Mon Mar 17 2008 Sindre Pedersen Bj淡rdal <sindrepb@fedoraproject.org> - 0.2.6-2
- Add missing pyxdg build depenency

* Mon Mar 17 2008 Sindre Pedersen Bj淡rdal <sindrepb@fedoraproject.org> - 0.2.6-1
- New release
- Re-enable gconf scriplets
- Add missing scriplets
- Update license

* Tue Feb 19 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 0.2.1-3
- Autorebuild for GCC 4.3

* Thu Nov 04 2007 Sindre Pedersen Bj淡rdal <foolish[AT]guezz.net> - 0.2.1-2
- New Release
* Wed Oct 21 2007 Huang Peng <phuang@redhat.com> - 0.2-1
- Update to 0.2
* Wed Aug 29 2007 Fedora Release Engineering <rel-eng at fedoraproject dot org> - 0.1.1-4
- Rebuild for selinux ppc32 issue.
* Tue Jun 05 2007 Sindre Pedersen Bj淡rdal <foolish[AT]guezz.net> - 0.1.1-3
- Own %%{_datadir}/avant-window-navigator
* Tue Jun 05 2007 Sindre Pedersen Bj淡rdal <foolish[AT]guezz.net> - 0.1.1-2
- Add missing BRs
- Fix gconf scriplets
* Thu May 01 2007 Sindre Pedersen Bj淡rdal <foolish[AT]guezz.net> - 0.1.1-1
- Initial build

