#TODO: Nautilus extention
%define with_nautilus 0
%define with_my_japo 0
#% define svnrevision 2411
#% define rcversion 1
#% define betaversion b

Name:           gnome-mplayer
Version:        1.0.8
Release:        5%{?betaversion:.%betaversion}%{?svnrevision:.svn%svnrevision}%{?_dist_release}
Summary:        An MPlayer GUI, a full-featured binary
Summary(ja):    高機能な MPlayer のグラフィカルユーザーインターフェース
Group:          Applications/Multimedia
License:        GPLv2+
URL:            http://kdekorte.googlepages.com/gnomemplayer
Source0:        http://gnome-mplayer.googlecode.com/files/%{name}-%{version}%{?betaversion:%betaversion}%{?svnrevision:.svn%svnrevision}%{?rcversion:.rc%rcversion}.tar.%{?svnrevision:xz}%{!?svnrevision:gz}
Source10:       gnome-mplayer-snapshot.sh

## vine
%if %{with_my_japo}
Source100:      gnome-mplayer-1.0.8a.svn2411-ja.po
%endif

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

BuildRequires:  gmtk-devel >= 1.0.7
BuildRequires:  alsa-lib-devel
BuildRequires:  pulseaudio-libs-devel
BuildRequires:  dbus-glib-devel
BuildRequires:  desktop-file-utils
BuildRequires:  GConf2-devel
BuildRequires:  gettext
BuildRequires:  glib2-devel
%if %{?_dist_release} == "vl7"
BuildRequires:  gtk3-devel
%else
%if %{?_dist_release} == "vl6"
BuildRequires:  gtk2-devel
%endif
%endif
#BuildRequires:  libcurl-devel
BuildRequires:  curl-devel
BuildRequires:  libgpod-devel
%if %{?_dist_release} != "vl5"
BuildRequires:  libmusicbrainz3-devel
%endif
#BuildRequires:  libmusicbrainz-devel
BuildRequires:  libnotify-devel
BuildRequires:  libXScrnSaver-devel
BuildRequires:  gnome-power-manager

Requires:       gvfs-fuse
Requires:       gnome-power-manager
#Requires:       mencoder
#Requires:       self-build-mplayer

Requires(pre):  GConf2
Requires(post): GConf2
Requires(preun): GConf2

Distribution:	Vine Linux
Vendor:		Project Vine
Packager:	munepi


%description
GNOME MPlayer is a simple GUI for MPlayer. It is intended to be a nice tight
player and provide a simple and clean interface to MPlayer. GNOME MPlayer has
a rich API that is exposed via DBus. Using DBus you can control a single or
multiple instances of GNOME MPlayer from a single command.

%description -l ja
GNOME MPlayer は MPlayer のための簡単なグラフィカルユーザー
インターフェースです。とても引き締まったていて，
MPlayer への簡単でかつ明確なインターフェースを提供します．
GNOME MPlayer は DBus 経由で公開されている豊富な API を持っています。
DBus を使って，あなたは1つのコマンドから単一のあるいは複数の
GNOME MPlayer のインスタンスを制御できます．

gnome-mplayer を使うためには，mplayer が必要です．


%if %{with_nautilus}
%package nautilus
Summary:        A Nautilus extention of %{name}
Summary(ja):    %{name} の Nautilus 拡張
Group:          Applications/Multimedia
Requires:       %{name} = %{version}-%{release}
Requires:       nautilus-extensions

%description nautilus
GNOME MPlayer is a simple GUI for MPlayer. It is intended to be a nice tight
player and provide a simple and clean interface to MPlayer. GNOME MPlayer has
a rich API that is exposed via DBus. Using DBus you can control a single or
multiple instances of GNOME MPlayer from a single command.

This package provides a nautilus extension, which shows properties of audio and
video files in the properties dialogue.

%description nautilus -l ja
GNOME MPlayer は MPlayer のための簡単なグラフィカルユーザー
インターフェースです。とても引き締まったていて，
MPlayer への簡単でかつ明確なインターフェースを提供します．
GNOME MPlayer は DBus 経由で公開されている豊富な API を持っています。
DBus を使って，あなたは1つのコマンドから単一のあるいは複数の
GNOME MPlayer のインスタンスを制御できます．

このパッケージはプロパティダイアログ内でオーディオやビデオファイルの
プロパティを示すに Nautilus 拡張を提供します．
%endif

%prep
#% setup -q %{?rcversion:-n %{name}-%{version}.rc%{rcversion}}
%setup -q %{?betaversion:-n %{name}-%{version}%betaversion}

## vine
%if %{with_my_japo}
%__install -m644 %{SOURCE100} po/ja.po
%endif


%build
%configure \
    %if %{?_dist_release} == "vl7"
    --enable-gtk3 \
    %endif
    %if !%{with_nautilus}
    --disable-nautilus \
    %endif
    --disable-schemas-compile \
    \
    --with-dbus \
    --with-alsa \
    --with-pulseaudio \
    --with-libnotify \
    --with-libgpod \
    %if %{?_dist_release} != "vl5"
    --with-libmusicbrainz3 \
    %endif
    ;
%__make %{?_smp_mflags}


%install
%__rm -rf $RPM_BUILD_ROOT

export GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1
%__make install DESTDIR=$RPM_BUILD_ROOT

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

%find_lang %{name}

# remove intrusive docs
%__rm -rf $RPM_BUILD_ROOT%{_docdir}/gnome-mplayer

# remove unpackaged files
find $RPM_BUILD_ROOT -name *.la -exec %__rm -f {} \;


# %pre
# if [ "$1" -gt 1 ]; then
#     export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
#     gconftool-2 --makefile-uninstall-rule \
#       %{_sysconfdir}/gconf/schemas/gnome-mplayer.schemas >/dev/null || :
#     # If the schema file has ever been renamed::
#     #gconftool-2 --makefile-uninstall-rule \
#     #  %{_sysconfdir}/gconf/schemas/[OLDNAME].schemas > /dev/null || :
# fi


%post
touch --no-create %{_datadir}/icons/hicolor
if [ -x %{_bindir}/gtk-update-icon-cache ]; then
  %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor
fi 
update-desktop-database &> /dev/null || :

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

%posttrans
glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
# update-desktop-database %{_datadir}/applications/

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

%postun
if [ $1 -eq 0 ]; then
  glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
  update-desktop-database %{_datadir}/applications/
fi

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


%clean
%__rm -rf $RPM_BUILD_ROOT


%files -f %{name}.lang
%defattr(-,root,root,-)
%{_bindir}/gnome-mplayer
%{_datadir}/applications/*-gnome-mplayer.desktop
%{_datadir}/gnome-control-center/default-apps/gnome-mplayer.xml
%doc AUTHORS COPYING ChangeLog INSTALL NEWS README DOCS/* DOCS/tech/*
# %{_sysconfdir}/gconf/schemas/gnome-mplayer.schemas
%{_datadir}/glib-2.0/schemas/apps.gecko-mediaplayer.preferences.gschema.xml
%{_datadir}/glib-2.0/schemas/apps.gnome-mplayer.preferences.enums.xml
%{_datadir}/glib-2.0/schemas/apps.gnome-mplayer.preferences.gschema.xml
%{_datadir}/icons/hicolor/*/apps/gnome-mplayer.*
%{_mandir}/man1/gnome-mplayer.1.gz

%if %{with_nautilus}
%files nautilus
%{_libdir}/nautilus/extensions-2.0/*.so.*
%{_libdir}/nautilus/extensions-2.0/*.so
%endif


%changelog
* Sun Mar 24 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.0.8-5
- rebuild with libimobiledevice-1.1.5

* Thu Mar  7 2013 Munehiro Yamamoto <munepi@vinelinux.org> 1.0.8-4
- new upstream release

* Wed Feb 20 2013 Munehiro Yamamoto <munepi@vinelinux.org> 1.0.8-3.b
- updated to 1.0.8b (beta)

* Sun Feb 17 2013 Munehiro Yamamoto <munepi@vinelinux.org> 1.0.8-2.a.svn2411
- update to svn2411
- updated ja.po: gnome-mplayer-1.0.8a.svn2411-ja.po

* Fri Feb  1 2013 Munehiro Yamamoto <munepi@vinelinux.org> 1.0.8-1.a.svn2398
- update to svn2398
- updated ja.po: gnome-mplayer-1.0.8a.svn2398-ja.po

* Thu Nov  1 2012 Munehiro Yamamoto <munepi@vinelinux.org> 1.0.7-1
- new upstream release

* Sat May 26 2012 Munehiro Yamamoto <munepi@vinelinux.org> 1.0.6-4
- dropped a wrapper of /usr/bin/gnome-mplayer

* Mon Apr 16 2012 Munehiro Yamamoto <munepi@vinelinux.org> 1.0.6-3
- new upstream release

* Thu Apr  5 2012 Munehiro Yamamoto <munepi@vinelinux.org> 1.0.6-2.b1.svn2227
- source 1.0.6b1 svn2227
- updated ja.po

* Sat Mar 24 2012 Munehiro Yamamoto <munepi@vinelinux.org> 1.0.6-1.b1
- new upstream release

* Tue Feb 28 2012 Munehiro Yamamoto <munepi@vinelinux.org> 1.0.5-3
- updated ja.po

* Sat Feb 25 2012 Munehiro Yamamoto <munepi@vinelinux.org> 1.0.5-2
- updated ja.po

* Fri Dec 30 2011 Munehiro Yamamoto <munepi@vinelinux.org> 1.0.5-1
- new upstream release

* Sat Oct 15 2011 Munehiro Yamamoto <munepi@vinelinux.org> 1.0.5-1.b1.svn2180
- source 1.0.5b1
- updated ja.po
- added BuildRequires: gmtk-devel >= 1.0.5
  - dropped --disable-static from %%configure
- enable gtk3 for vl7
  - added BuildRequires: gtk3-devel
  - added --enable-gtk3 in %%configure

* Sun Sep 25 2011 Munehiro Yamamoto <munepi@vinelinux.org> 1.0.4-4
- rebuilt with libnotify-0.7.4

* Mon Jul 04 2011 Munehiro Yamamoto <munepi@vinelinux.org> 1.0.4-3
- new upstream release

* Fri Jun 10 2011 Munehiro Yamamoto <munepi@vinelinux.org> 1.0.4-2.b2
- source 1.0.4b2

* Sun Jun 05 2011 Munehiro Yamamoto <munepi@vinelinux.org> 1.0.4-1.b1.svn2124
- source snapshot 1.0.4b1 r2124
- use gsettings

* Fri Apr 22 2011 Munehiro Yamamoto <munepi@vinelinux.org> 1.0.3-3
- new upstream release

* Tue Apr 19 2011 Munehiro Yamamoto <munepi@vinelinux.org> 1.0.3-2.beta.svn1992
- source snapshot 1.0.3beta r1992

* Sun Apr 17 2011 Munehiro Yamamoto <munepi@vinelinux.org> 1.0.3-1.beta.svn1989
- source snapshot 1.0.3beta r1989
  - added --disable-schemas-compile in configure options
  - use GSettings (%%posttrans, %%postun)
- updated Japanese translation (gnome-mplayer-1.0.3beta.svn1989-ja.po)

* Tue Mar 08 2011 Munehiro Yamamoto <munepi@vinelinux.org> 1.0.1-2
- new upstream release

* Wed Mar 02 2011 Munehiro Yamamoto <munepi@vinelinux.org> 1.0.1-1.b1.svn1912
- source snapshot 1.0.1b1 r1912

* Thu Feb 24 2011 Munehiro Yamamoto <munepi@vinelinux.org> 1.0.1-1.b1.svn1892
- source snapshot 1.0.1b1 r1892
- added BuildRequires: pulseaudio-libs-devel

* Sat Nov 06 2010 Munehiro Yamamoto <munepi@vinelinux.org> 1.0.0-1
- new upstream release
- added BuildRequires: 
  - libmusicbrainz3-devel (only vl6)
  - gnome-power-manager
- added Requires: gnome-power-manager

* Tue Oct 12 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.9.99-2.rc3
- source 0.9.99.rc3

* Fri Aug 20 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.9.99-1.rc1
- source 0.9.99.rc1
  - applied gnome-mplayer-0.9.99.rc1-ja.po
  - entry ja in gnome-mplayer.desktop

* Mon Jun 28 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.9.9.2-5.svn1729
- source snapshot r1729

* Sat Apr 17 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.9.9.2-4.svn1685
- fixed gnome-mplayer.sh.in

* Sat Apr 17 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.9.9.2-3.svn1685
- source snapshot r1685
- added gnome-mplayer.sh.in
  - this script is a wrapper to check MPlayer binary existance

* Tue Mar 16 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.9.9.2-2.svn1673
- source snapshot r1673
  - Rework vdpau codec selection and deinterlace (r1673)

* Thu Mar 04 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.9.9.2-1
- new upstream release

* Sat Feb 06 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.9.9-4
- new upstream release
- added gnome-mplayer-snapshot.sh

* Sat Jan 16 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.9.9-2.svn1619
- source snapshot r1619
- added gnome-mplayer-0.9.9.svn1619-ja.po

* Mon Dec 14 2009 Munehiro Yamamoto <munepi@vinelinux.org> 0.9.9-1.svn1599
- source snapshot r1599
- added BuildRequires: libXScrnSaver-devel

* Sun Nov 01 2009 Munehiro Yamamoto <munepi@vinelinux.org> 0.9.9-1.svn1583
- source snapshot r1583
- dropped gnome-mplayer-0.9.8-fix-hidden-cursor-over-menus.patch

* Sun Nov 01 2009 Munehiro Yamamoto <munepi@vinelinux.org> 0.9.8-4
- applied gnome-mplayer-0.9.8-fix-hidden-cursor-over-menus.patch
  - fix hidden cursor over menus (r1576)

* Sat Sep 19 2009 Munehiro Yamamoto <munepi@vinelinux.org> 0.9.8-3
- new upstream release

* Tue Sep 15 2009 Munehiro Yamamoto <munepi@vinelinux.org> 0.9.8-2.svn1540
- source snapshot r1540

* Mon Sep 14 2009 Munehiro Yamamoto <munepi@vinelinux.org> 0.9.8-1.svn1538
- source snapshot r1538
  - updated the latest up-to-date ja.po

* Sat Aug 22 2009 Munehiro Yamamoto <munepi@vinelinux.org> 0.9.7-3
- new upstream release

* Fri Aug 07 2009 Munehiro Yamamoto <munepi@vinelinux.org> 0.9.7-2.svn1493
- source snapshot r1493

* Fri Aug 07 2009 Munehiro Yamamoto <munepi@vinelinux.org> 0.9.7-1.svn1486
- source snapshot r1486
  - updated the latest up-to-date ja.po
- added gtk-update-icon-cache actions in %%post, %%postun

* Wed Jun 10 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 0.9.6-2
- rebuild with libgpod-0.7.2
- gconf uninstall rule in %%preun, not %%postun

* Sat Jun 06 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.9.6-1
- new upstream release

* Thu May 27 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.9.5-4.svn1298
- source snapshot r1298
  - updated the latest up-to-date ja.po

* Sat Apr 25 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.9.5-3.svn1236
- dropped Requires: self-build-mplayer

* Sat Mar 28 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.9.5-2.svn1236
- source snapshot r1236
- updated the latest up-to-date ja.po

* Sun Mar 15 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.9.5-1
- new upstream release

* Fri Mar 06 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.9.4-4.r1184
- dropped a Nautilus plugin once

* Fri Mar 06 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.9.4-3.r1184
- source snapshot r1184
- dropped gnome-mplayer-0.9.4-ja.patch
  - committed Japanese translation
- applied gnome-mplayer-0.9.4.r1184-ja.po
  - update the latest up-to-date ja.po

* Fri Feb 06 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.9.4-2
- added Summary(ja), %%description -l ja
- updated gnome-mplayer-0.9.4-ja.patch

* Fri Feb 06 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.9.4-1
- new upstream release
- updated gnome-mplayer-0.9.4-ja.patch
- updated gnome-mplayer-0.9.4-ja.po
- updated the URL tag

* Sun Feb 01 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.9.3-1
- initial build
- added ja.po

* Thu Jan  8 2009 Julian Sikorski <belegdol[at]gmail[dot]com> - 0.9.3-2
- Added patch fixing rpmfusion bug #238 from SVN
- Made the dependencies between packages stricter (%%{version} → %%{version}-%%{release})

* Sat Jan  3 2009 Julian Sikorski <belegdol[at]gmail[dot]com> - 0.9.3-1
- Updated to 0.9.3

* Mon Nov 24 2008 Julian Sikorski <belegdol[at]gmail[dot]com> - 0.9.2-2
- Refactored the spec to allow building both minimal and full-featured versions
- s/gnome-mplayer-core-functionality/gnome-mplayer-binary

* Sat Nov 22 2008 Julian Sikorski <belegdol[at]gmail[dot]com> - 0.9.2-1
- Updated to 0.9.2
- Added libcurl-devel, libgpod-devel and libmusicbrainz3-devel to BuildRequires
- Provide gnome-mplayer-core-functionality

* Sun Nov  2 2008 Julian Sikorski <belegdol[at]gmail[dot]com> - 0.9.1-1
- Updated to 0.9.1

* Fri Oct 31 2008 Julian Sikorski <belegdol[at]gmail[dot]com> - 0.9.0-1
- Updated to 0.9.0
- Added libnotify-devel to BuildRequires
- Added gvfs-fuse to Requires

* Mon Sep 29 2008 Julian Sikorski <belegdol[at]gmail[dot]com> - 0.8.0-1.1
- Updated to 0.8.0

* Sat Sep  6 2008 Julian Sikorski <belegdol[at]gmail[dot]com> - 0.7.0-2.1
- Added alsa-lib-devel to BuildRequires (livna bug #2084)

* Sun Aug 17 2008 Julian Sikorski <belegdol[at]gmail[dot]com> - 0.7.0-1.1
- Updated to 0.7.0

* Wed Jul 30 2008 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info - 0.6.3-2
- rebuild for buildsys cflags issue

* Sun Jul  6 2008 Julian Sikorski <belegdol[at]gmail[dot]com> - 0.6.3-1
- Updated to 0.6.3

* Tue Jun 10 2008 Julian Sikorski <belegdol[at]gmail[dot]com> - 0.6.2-2
- Added mencoder to Requires (bug #1991)

* Wed May 28 2008 Julian Sikorski <belegdol[at]gmail[dot]com> - 0.6.2-1
- Updated to 0.6.2

* Thu Apr 17 2008 Julian Sikorski <belegdol[at]gmail[dot]com> - 0.6.1-1
- Updated to 0.6.1
- Updated URL and Source0

* Wed Feb 13 2008 Julian Sikorski <belegdol[at]gmail[dot]com> - 0.6.0-1
- Initial rpmfusion release
