%define libgnomeui_version 2.0.0
%define desktop_file_utils_version 0.2.90

%define po_package printman

%define snapshot 20021202

Summary:        a tool for monitoring print queues from GNOME
Name:           printman
Version:        0.0.1
Release:        0.%{snapshot}.12
License:        GPL
Group:          Applications/System

# From :pserver:anonymous@anoncvs.gnome.org:/cvs/gnome, module printman
Source:         %{name}-%{version}-cvs-%{snapshot}.tar.bz2
Patch0:         printman-0.0.1-schema.patch
Patch1:         printman-0.0.1-fix.patch
Patch2:         printman-0.0.1-visible.patch
Patch3:         printman-0.0.1-nodest.patch
Patch4:         printman-0.0.1-rcp.patch
Patch5:         printman-0.0.1-default.patch
Patch6:         printman-0.0.1-icon.patch
Patch7:         printman-0.0.1-cancel.patch
Patch8:         printman-0.0.1-no-printers.patch
Patch9:         printman-0.0.1-startup.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-root

PreReq:         scrollkeeper >= 0.1.4
PreReq:         GConf2

BuildRequires: libgnomeui-devel >= %{libgnomeui_version}
BuildRequires: desktop-file-utils >= %{desktop_file_utils_version}
BuildRequires: /usr/bin/automake-1.4 cups-devel

%description
GNOME Print Manager is a tool for monitoring and controlling printing
queues from the GNOME desktop. You can view the available
printers, set the default printer, and view and cancel
current print jobs.

%prep
%setup -q

%patch0 -p1 -b .schema

# Actually show the jobs.
%patch1 -p1 -b .fix

# Show all printers by default.
%patch2 -p1 -b .visible

# Don't get confused when there are no printers
%patch3 -p1 -b .nodest

# Launch redhat-config-printer for printer properties.
%patch4 -p1 -b .rcp

# Make 'set as default' work (bug #80143).
%patch5 -p1 -b .default

# Set default icon (bug #80145).
%patch6 -p1 -b .icon

# Add context menu to job list for cancelling jobs (bug #80144).
%patch7 -p1 -b .cancel

# Offer to run the printer configuration tool if no printers (bug #81047).
%patch8 -p1 -b .no-printers

# Startup notification
%patch9 -p1 -b .startup

%build
# .schema patch touches a Makefile.am
automake-1.4

%configure
make

%install

rm -rf $RPM_BUILD_ROOT

export GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1
%makeinstall
unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL

desktop-file-install --vendor gnome --delete-original       \
  --dir $RPM_BUILD_ROOT%{_datadir}/applications             \
  --add-only-show-in GNOME                                  \
  --add-category X-Red-Hat-Base                             \
  $RPM_BUILD_ROOT%{_datadir}/applications/*

rm -rf $RPM_BUILD_ROOT%{_var}/scrollkeeper

%find_lang %{po_package}

%clean
rm -rf $RPM_BUILD_ROOT

%post
%{_bindir}/scrollkeeper-update
export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
SCHEMAS="gnome-print-manager.schemas"
for S in $SCHEMAS; do
  %{_bindir}/gconftool-2 --makefile-install-rule %{_sysconfdir}/gconf/schemas/$S > /dev/null
done

%postun
%{_bindir}/scrollkeeper-update

%files -f %{po_package}.lang
%defattr(-, root, root)
%doc COPYING ChangeLog
%{_datadir}/pixmaps
%{_datadir}/gnome
%{_datadir}/omf
%{_datadir}/applications
%{_bindir}/gnome-print-manager
%attr(0755, root, root) %{_libexecdir}/gnome-print-manager-remote
%{_sysconfdir}/gconf/schemas/*

%changelog
* Thu Jan 23 2003 Tim Powers <timp@redhat.com> 0.0.1-0.20021202.12
- rebuild

* Mon Jan 20 2003 Tim Waugh <twaugh@redhat.com> 0.0.1-0.20021202.11
- Startup notification.

* Thu Jan  9 2003 Tim Waugh <twaugh@redhat.com> 0.0.1-0.20021202.10
- Rescan print queues after running configuration tool (bug #81047).

* Tue Jan  7 2003 Tim Waugh <twaugh@redhat.com> 0.0.1-0.20021202.9
- Offer to run the printer configuration tool if no printers (bug #81047).

* Fri Jan  3 2003 Tim Waugh <twaugh@redhat.com> 0.0.1-0.20021202.8
- Add context menu to job list for cancelling jobs (bug #80144).
- Set default icon (bug #80145).

* Fri Jan  3 2003 Tim Waugh <twaugh@redhat.com> 0.0.1-0.20021202.7
- Make 'set as default' work (bug #80143).

* Fri Dec 20 2002 Tim Waugh <twaugh@redhat.com> 0.0.1-0.20021202.6
- Launch redhat-config-printer for printer properties (bug #79992).

* Tue Dec 10 2002 Tim Waugh <twaugh@redhat.com> 0.0.1-0.20021202.5
- Don't get confused when there are no printers.

* Fri Dec  6 2002 Tim Waugh <twaugh@redhat.com> 0.0.1-0.20021202.4
- Show all printers by default.

* Wed Dec  4 2002 Tim Waugh <twaugh@redhat.com> 0.0.1-0.20021202.3
- Use CUPS API, and fix LPRng compatibility.

* Tue Dec  3 2002 Tim Waugh <twaugh@redhat.com> 0.0.1-0.20021202.2
- Handle queue names containing dashes.

* Mon Dec  2 2002 Tim Waugh <twaugh@redhat.com> 0.0.1-0.20021202.1
- Update from CVS.
- No longer need libexec patch.

* Tue Jun 26 2002 Owen Taylor <otaylor@redhat.com>
- Initial package