
%define gtk2_version 2.2.0
%define gnome_panel 2.2.0
%define rdesktop_version 1.3.0
%define vnc_version 4.0
%define desktop_file_utils_version 0.4

Summary: Client for VNC and Windows Terminal Server
Summary(ja): VNC および Windows ターミナルサーバ用クライアント
Name: tsclient
Version: 2.0.2
Release: 3%{?_dist_release}
URL: http://sourceforge.net/projects/tsclient
Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.bz2

License: GPL+
Group: User Interface/X
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root

Requires: rdesktop
#Requires: vnc

BuildRequires: gnome-desktop-devel
BuildRequires: libgnomeui-devel
BuildRequires: libnotify-devel
BuildRequires: NetworkManager-glib-devel
BuildRequires: gtk2-devel >= %{gtk2_version}
BuildRequires: gnome-panel >= %{gnome_panel}
BuildRequires: desktop-file-utils >= %{desktop_file_utils_version}
BuildRequires: gettext
BuildRequires: autoconf, automake, libtool, intltool

# reported upstream
Patch0: icon-names.patch
# reported upstream
Patch2: edit-dialog-crash.patch
# reported upstream
Patch3: vnc-password-optional.patch
# reported upstream
Patch4: vnc-remote-screen-size.patch
# NOT reported upstream; there's no simple way to make it support both
# realvnc and tightvnc
Patch5: realvnc-args.patch
Patch6: tsclient-libgnomeui.patch

%description
tsclient is a frontend that makes it easy to use rdesktop and vncviewer.

%package devel
Summary: Header files needed to write tsclient plugins
Summary(ja): Header files needed to write tsclient plugins
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}

%description devel
The tsclient-devel package contains header files that are needed to
develop tsclient plugins.

%prep
%setup -q
%patch0 -p1 -b .icon-names
%patch2 -p1 -b .edit-dialog-crash
%patch3 -p1 -b .vnc-password
%patch4 -p1 -b .vnc-remotesize
%patch5 -p1 -b .realvnc-args
%patch6 -p1 -b .libgnomeui
libtoolize --force --copy
autoreconf -f -i

%build

%configure
make %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT

make install DESTDIR=$RPM_BUILD_ROOT

rm -rf $RPM_BUILD_ROOT/var/scrollkeeper

desktop-file-install --vendor tsclient --delete-original      \
  --dir $RPM_BUILD_ROOT%{_datadir}/applications               \
  --remove-category Application                               \
  $RPM_BUILD_ROOT%{_datadir}/applications/*

rm -rf $RPM_BUILD_ROOT/usr/lib/tsclient/plugins/*.{a,la}

%find_lang %{name}

%clean
rm -rf $RPM_BUILD_ROOT

%post 
export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
gconftool-2 --makefile-install-rule %{_sysconfdir}/gconf/schemas/tsc-handlers.schemas >& /dev/null || :
touch --no-create %{_datadir}/icons/hicolor
if [ -x /usr/bin/gtk-update-icon-cache ]; then
  gtk-update-icon-cache -q %{_datadir}/icons/hicolor
fi

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

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

%postun
touch --no-create %{_datadir}/icons/hicolor
if [ -x /usr/bin/gtk-update-icon-cache ]; then
  gtk-update-icon-cache -q %{_datadir}/icons/hicolor
fi


%files -f %{name}.lang
%defattr(-,root,root)
%doc COPYING AUTHORS
%{_bindir}/*
%{_datadir}/applications/*.desktop
%{_sysconfdir}/gconf/schemas/tsc-handlers.schemas
%{_libdir}/tsclient
%{_datadir}/gnome/autostart/tsc-autostart.desktop
%{_datadir}/icons/hicolor/scalable/apps/tsclient.svg
%{_datadir}/tsclient

%files devel
%{_includedir}/tsclient


%changelog
* Sun Apr 11 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.0.2-3
- rebuild with GNOME-2.30
- change BuildRequires: gnome-panel-devel -> gnome-panel

* Sat May 09 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 2.0.2-2
- remove Requires: vnc

* Thu May 07 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 2.0.2-1
- new upstream release

* Sun Oct 12 2008 Shu KONNO <owa@bg.wakwak.com> 0.148-1vl5
- applied new versioning policy, spec in utf-8
- changed _serverdir, %%{_libdir} => %%{_prefix}/lib

* Fri Dec  1 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.148-0vl1
- new upstream release
- dropped Patch13

* Tue May 10 2005 Daisuke SUZUKI <daisuke@linux.or.jp> 0.140-0vl1
- new upstream release
- remove banner-ja.png that are now included in upstream
- update ja.po

* Mon Feb 23 2004 Daisuke SUZUKI <daisuke@linux.or.jp> 0.132-0vl4
- add Patch13 to support -gworkarea

* Fri Dec 12 2003 Daisuke SUZUKI <daisuke@linux.or.jp> 0.132-0vl3
- add banner-ja.png

* Fri Dec 12 2003 Daisuke SUZUKI <daisuke@linux.or.jp> 0.132-0vl2
- add Vine default fontpath to XDMCP(Xnest) option.

* Fri Dec 12 2003 Daisuke SUZUKI <daisuke@linux.or.jp> 0.132-0vl1
- initial build  for Vine Linux
- add ja.po

* Mon Sep 30 2002 - Erick Woods <erick@gnomepro.com>
 - This file was created

