%define	domain_name	windowutils

%define build_vine5 0
%if "%{?_dist_release}" == "vl5"
%define build_vine5 1
%endif

Summary:	Gnome panel applet for maximized window title lbar
Summary(ja): 	最大化したウィンドウのタイトルバー用 GNOME パネルアプレット
Name:		windowapplets
Version:	0.2.9
Release: 	1%{?_dist_release}
Source0:	103732-gnome-window-applets-%{version}.tar.gz
Source1:	windowapplets-0.2.5-ja.po
Patch0:		windowapplets-0.2.9-metacity-notitlebar.patch
Patch1:		windowapplets-0.2.5-locale-dir-fix.patch
Patch2:		windowapplets-0.2.7-exclude-decorate.patch
Patch3:		windowapplets-0.2.9-gtk216.patch
License:	GPLv3
Group:		User Interface/Desktops
URL:		http://gnome-look.org/content/show.php?content=103732

BuildRequires:	libwnck-devel gnome-panel-devel gnome-applets
BuildRequires:	GConf2-devel libbonoboui-devel
BuildRoot:	%{_tmppath}/%{name}-%{version}-root

Packager:	kazutaka

%description
GNOME Panel applets that substitute the maximized window toolbar.
This package contains these applets:
        - Window Buttons Applet
        - Window Title Applet

%description -l ja
最大化したウィンドウのタイトルバーを置き換える GNOME パネル
アプレットです。
このパッケージには次のアプレットが含まれます:
        - ウィンドウボタン・アプレット
        - ウィンドウタイトル・アプレット

%prep
%setup -q -n gnome-window-applets-%{version}
%patch0 -p1 -b .notitlebar
%patch1 -p1 -b .locale-fix
%patch2 -p1 -b .exclude-decorate

%if %{build_vine5}
%patch3 -p1 -b .gtk216
%endif

%build
%configure --disable-schemas-install
%{__make} %{?_smp_mflags}


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

#install japanese massage catalog
%{__mkdir_p} ${RPM_BUILD_ROOT}/%{_localedir}/ja/LC_MESSAGES
msgfmt %{SOURCE1} -o ${RPM_BUILD_ROOT}/%{_localedir}/ja/LC_MESSAGES/%{domain_name}.mo

# remove docs installed in /usr/doc/%{name}
%{__rm} -rf $RPM_BUILD_ROOT/%{_prefix}/doc

%find_lang %{domain_name}

%pre
if [ "$1" -gt 1 ]; then
  export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
  for f in windowbuttons windowtitle; do
    echo %{_sysconfdir}/gconf/schemas/${f}.schemas; done \
    | xargs gconftool-2 --makefile-uninstall-rule >& /dev/null || :
fi

%post
export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
for f in windowbuttons windowtitle; do
  echo %{_sysconfdir}/gconf/schemas/${f}.schemas; done \
  | xargs gconftool-2 --makefile-install-rule >& /dev/null || :

%preun
if [ "$1" -eq 0 ]; then
  export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
  for f in windowbuttons windowtitle; do
    echo %{_sysconfdir}/gconf/schemas/${f}.schemas; done \
    | xargs gconftool-2 --makefile-uninstall-rule >& /dev/null || :
fi


%clean
%{__rm} -rf $RPM_BUILD_ROOT


%files -f %{domain_name}.lang
%defattr(-,root,root)
%doc AUTHORS COPYING ChangeLog INSTALL NEWS README
%{_sysconfdir}/gconf/schemas/windowbuttons.schemas
%{_sysconfdir}/gconf/schemas/windowtitle.schemas
%{_libdir}/bonobo/servers/WindowButtons.server
%{_libdir}//bonobo/servers/WindowTitle.server
%{_libexecdir}/windowbuttons
%{_libexecdir}/windowtitle
%{_datadir}/windowbuttons
%{_datadir}/windowtitle


%changelog
* Sat Dec 04 2010 Kazutaka HARADA <kazutaka@vinelinux.org> 0.2.9-1
- new upstream release
- update Patch0
  - fit to updated source code
  - check current window manager and switch logic to hide title bar
    on maximized window (use this hack except compiz)
-  add Patch3: make compilable < gtk+-2.18

* Sun Jul 25 2010 Kazutaka HARADA <kazutaka@vinelinux.org> 0.2.7-2
- add Patch2 to exclude specific apps for window decoration
  (but now support guake only)

* Sat Jul 17 2010 Kazutaka HARADA <kazutaka@vinelinux.org> 0.2.7-1
- new upstream release

* Sun Mar 21 2010 Kazutaka HARADA <kazutaka@vinelinux.org> 0.2.5-1
- initial build for Vine Linux
- add Patch0 to hide title bar of maximized window on metacity
- add Patch1 to fix GNOMELOCALEDIR
- add Source1 for japanese translation

