#
# spec file for package xfce4-session
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define libname libxfsm-4_6-0

Name:           xfce4-session
Version:        4.10.0
Release:        0
Summary:        Xfce Session Manager
License:        GPL-2.0
Group:          System/GUI/XFCE
Url:            http://docs.xfce.org/xfce/xfce4-session/start
Source0:        http://archive.xfce.org/src/xfce/xfce4-session/4.10/%{name}-%{version}.tar.bz2
# PATCH-FEATURE-OPENSUSE xfce4-session-simple-splash-remove-shadows.patch gber@opensuse.org -- Improves readability of the simple splash engine text by removing the text shadows
Patch0:         xfce4-session-simple-splash-remove-shadows.patch
# PATCH-FIX-OPENSUSE xfce4-session-adapt-session-scripts.patch bnc#789057 gber@opensuse.org -- Adapt upstream sessions script to openSUSE
Patch1:         xfce4-session-adapt-session-scripts.patch
# PATCH-FIX-UPSTREAM xfce4-session-handle-multiple-interactive-session-save.patch bxo#5379 gber@opensuse.org -- Handle multiple interactive session save correctly (backported from upstream git)
Patch2:         xfce4-session-handle-multiple-interactive-session-save.patch
# PATCH-FIX-UPSTREAM xfce4-session-avoid-possible-double-free.patch bxo#9709 gber@opensuse.org -- Avoid a possible double free crash (backported from upstream git)
Patch3:         xfce4-session-avoid-possible-double-free.patch
%if 0%{?suse_version} > 1210
BuildRequires:  iceauth
%endif
BuildRequires:  intltool
BuildRequires:  update-desktop-files
BuildRequires:  xorg-x11
BuildRequires:  pkgconfig(dbus-1)
BuildRequires:  pkgconfig(dbus-glib-1)
BuildRequires:  pkgconfig(gmodule-2.0)
BuildRequires:  pkgconfig(gnome-keyring-1)
BuildRequires:  pkgconfig(gtk+-2.0)
BuildRequires:  pkgconfig(ice)
BuildRequires:  pkgconfig(libwnck-1.0)
BuildRequires:  pkgconfig(libxfce4panel-1.0)
BuildRequires:  pkgconfig(libxfce4ui-1)
BuildRequires:  pkgconfig(libxfce4util-1.0)
BuildRequires:  pkgconfig(sm)
Provides:       xfce-utils = %{version}
Obsoletes:      xfce-utils <= 4.8.3
Provides:       xfce-utils-doc = %{version}
Obsoletes:      xfce-utils-doc <= 4.8.3
Provides:       xfce-utils-lang = %{version}
Obsoletes:      xfce-utils-lang <= 4.8.3
Provides:       xfce4-session-doc = %{version}
Obsoletes:      xfce4-session-doc <= 4.8.3
Requires:       %{name}-branding = %{version}
Requires:       ConsoleKit-x11
Requires:       xfce4-settings
Requires:       xfconf
Recommends:     %{name}-doc = %{version}
Recommends:     %{name}-lang = %{version}
# minimal packages for an Xfce session
Recommends:     xfwm4
Recommends:     xfdesktop
Recommends:     thunar
Recommends:     xfce4-panel
# xfce4-about needs to be dragged at a low level
Recommends:     libxfce4ui-tools
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
xfce4-session is the session manager for the Xfce desktop environment.

%package -n %{libname}
Summary:        Shared Library for xfce4-session Splash Screen Engines
Group:          System/Libraries

%description -n %{libname}
This package contains the shared library for xfce4-session splash screen
engines.

%package        devel
Summary:        Development Files for xfce4-session
Group:          Development/Libraries/C and C++
Requires:       %{libname} = %{version}

%description devel
This package contains development files needed to develop custom splash screen
engines for the xfce4-session.

%package branding-upstream
Summary:        Upstream Branding of xfce4-session
Group:          System/GUI/XFCE
Supplements:    packageand(%{name}:branding-upstream)
Provides:       %{name}-branding = %{version}
Conflicts:      otherproviders(%{name}-branding)
# BRAND: xfce4-session.xml: Control session parameters such as the tools and
# BRAND: applications started by default or the splash theme.
BuildArch:      noarch

%description branding-upstream
This package provides the upstream look and feel for the Xfce Session Manager.

%lang_package

%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1

%build
%configure \
    --disable-static \
    --enable-session-screenshots \
    --enable-gnome \
    --enable-libgnome-keyring
make %{?_smp_mflags} V=1

%install
%make_install

chmod 755 %{buildroot}%{_sysconfdir}/xdg/xfce4/xinitrc

install -d -m 755 %{buildroot}%{_datadir}/xfce/applications

# add back X-XFCE for now; this is a personal and not a system setting
%suse_update_desktop_file -r xfce-session-settings XFCE X-XFCE GTK Settings DesktopSettings X-XFCE-SettingsDialog X-XFCE-PersonalSettings
%suse_update_desktop_file xfce4-session-logout

rm -rf %{buildroot}%{_datadir}/locale/{ast,kk,tl_PH,ur_PK}

%find_lang %{name}

rm -f %{buildroot}%{_libdir}/*.la %{buildroot}%{_libdir}/xfce4/session/splash-engines/*.la

%clean
rm -rf %{buildroot}

%post -n %{libname} -p /sbin/ldconfig

%postun -n %{libname} -p /sbin/ldconfig

%post
%desktop_database_post
%icon_theme_cache_post

%postun
%desktop_database_postun
%icon_theme_cache_postun

%files
%defattr(-,root,root)
%doc AUTHORS BUGS COPYING ChangeLog NEWS README TODO
%dir %{_sysconfdir}/xdg/xfce4
%config %{_sysconfdir}/xdg/xfce4/Xft.xrdb
%{_sysconfdir}/xdg/xfce4/xinitrc
%{_sysconfdir}/xdg/autostart/xscreensaver.desktop
%{_bindir}/xfce4-session
%{_bindir}/xfce4-session-logout
%{_bindir}/xfce4-session-settings
%{_bindir}/xflock4
%{_bindir}/startxfce4
%{_libdir}/xfce4
%{_datadir}/xfce
%{_datadir}/xsessions/xfce.desktop
%{_datadir}/themes/*
%{_datadir}/applications/*.desktop
%{_datadir}/icons/*/*/*
%doc %{_mandir}/man1/xfce4-session*.1*

%files -n %{libname}
%defattr(-,root,root)
%doc COPYING
%{_libdir}/libxfsm-*.so.*

%files lang -f %{name}.lang

%files devel
%defattr(-,root,root)
%dir %{_includedir}/xfce4
%{_includedir}/xfce4/xfce4-session-*/
%{_libdir}/pkgconfig/xfce4-session-*.pc
%{_libdir}/libxfsm-*.so

%files branding-upstream
%defattr(-,root,root)
%dir %{_sysconfdir}/xdg/xfce4
%dir %{_sysconfdir}/xdg/xfce4/xfconf
%dir %{_sysconfdir}/xdg/xfce4/xfconf/xfce-perchannel-xml
%config %{_sysconfdir}/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-session.xml

%changelog