%global xfceversion 4.18

%global namespc Libxfce4panel

%global __provides_exclude_from ^%{_libdir}/xfce4/panel/plugins/.*\\.so$
%global _with_vala 0

Name:           xfce4-panel
Version:        4.18.0
Release:        1
Summary:        Next generation panel for Xfce

License:        GPLv2+ and LGPLv2+
URL:            http://www.xfce.org/
#VCS git:git://git.xfce.org/xfce/xfce4-panel
Source0:        http://archive.xfce.org/src/xfce/%{name}/%{xfceversion}/%{name}-%{version}.tar.bz2

# clock icon taken from system-config-date, license is GPLv2+
Source1:        xfce4-clock.png
Source2:        xfce4-clock.svg
# patch from Debian
Patch1:         02_pager-size-for-viewport.patch

BuildRequires: make
BuildRequires:  gcc-c++
BuildRequires:  gtk3-devel
BuildRequires:  libxfce4ui-devel >= %{xfceversion}
BuildRequires:  xfconf-devel >= %{xfceversion}
BuildRequires:  garcon-devel >= 0.6.0
BuildRequires:  libxml2-devel >= 2.4.0
BuildRequires:  startup-notification-devel
BuildRequires:  exo-devel >= 0.3.93
BuildRequires:  libwnck3-devel >= 3.14
BuildRequires:  gettext
BuildRequires:  intltool
BuildRequires:  desktop-file-utils
BuildRequires:  gtk-doc
BuildRequires:  gobject-introspection-devel
BuildRequires:  libdbusmenu-gtk3-devel

%if %{_with_vala}
BuildRequires:  vala
%endif


# obsolete old plugins
Obsoletes:      orage < 4.12.1-17
Obsoletes:      xfce4-embed-plugin < 1.6.0-13
Obsoletes:      xfce4-cellmodem-plugin < 0.0.5-29
Obsoletes:      xfce4-kbdleds-plugins < 0.0.6-20
Obsoletes:      xfce4-hardware-monitor-plugin < 1.6.0-11

%description
This package includes the panel for the Xfce desktop environment.

%package devel
Summary:        Development headers for xfce4-panel
Requires:       %{name} = %{version}-%{release}
Requires:       pkgconfig
Requires:       libxfce4util-devel >= %{xfceversion}
Requires:       libxfce4ui-devel >= %{xfceversion}

%description devel
This package includes the header files you will need to build
plugins for xfce4-panel.


%prep
%setup -q
%patch1 -p1 -b .default

# Fix icon in 'Add new panel item' dialog
sed -i 's|Icon=office-calendar|Icon=xfce4-clock|g' plugins/clock/clock.desktop.in.in


%build
%configure --enable-gtk-doc --disable-static 

# Remove rpaths
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool

# The LD_LIBRARY_PATH hack is needed for --enable-gtk-doc
# because lt-libxfce4panel-scan is linked against libxfce4panel
export LD_LIBRARY_PATH="`pwd`/libxfce4panel/.libs"

%make_build

%install
%make_install

find %{buildroot} -name '*.la' -exec rm -f {} ';'

%find_lang %{name}

desktop-file-validate %{buildroot}/%{_datadir}/applications/panel-desktop-handler.desktop
desktop-file-validate %{buildroot}/%{_datadir}/applications/panel-preferences.desktop

# install additional icons
install -pm 0644 %{SOURCE1} %{buildroot}%{_datadir}/icons/hicolor/48x48/apps/
install -pm 0644 %{SOURCE2} %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/

%files -f %{name}.lang
%license COPYING
%doc AUTHORS ChangeLog NEWS
%config(noreplace) %{_sysconfdir}/xdg/xfce4/panel/default.xml
%{_bindir}/*
%{_libdir}/libxfce4panel-*.so.*
%{_libdir}/xfce4/panel/
%{_libdir}/girepository-1.0/%{namespc}-2.0.typelib
%{_datadir}/gir-1.0/%{namespc}-2.0.gir
%{_datadir}/icons/hicolor/*/*/*
%{_datadir}/xfce4/panel/
%{_datadir}/applications/*.desktop
%if %{_with_vala}
%{_datadir}/vala/vapi/libxfce4panel-2.0.deps
%{_datadir}/vala/vapi/libxfce4panel-2.0.vapi
%endif

%files devel
%{_libdir}/pkgconfig/*
%{_libdir}/libxfce4panel-*.so
%doc %{_datadir}/gtk-doc/html/libxfce4panel-*/
%{_includedir}/xfce4/libxfce4panel-*/

%changelog
* Wed Jan 04 2023 misaka00251 <liuxin@iscas.ac.cn> - 4.18.0-1
- Update to 4.18.0

* Fri Jun 18 2021 zhanglin <lin.zhang@turbolinux.com.cn> - 4.16.0-1
- Update to 4.16.0

* Thu Jul 9 2020 Dillon Chen <dillon.chen@turbolinux.com.cn> - 4.14.4-1
- Init package
