# Maintainer: Balló György <ballogyor+arch at gmail dot com>
# Contributor:  Bartłomiej Piotrowski <nospam@bpiotrowski.pl>
# Contributor: Angel 'angvp' Velasquez <angvp[at]archlinux.com.ve> 
# Contributor: Geoffroy Carrier <geoffroy.carrier@koon.fr>

pkgbase=lxlauncher
pkgname=(lxlauncher lxlauncher-gtk3)
pkgver=0.2.5
pkgrel=4
pkgdesc='Open source clone of the Asus launcher for EeePC'
arch=('x86_64')
license=('GPL2')
url='https://lxde.org/'
depends=('gtk2' 'gtk3' 'startup-notification' 'lxmenu-data' 'menu-cache')
makedepends=('intltool')
backup=('etc/xdg/lxlauncher/gtk.css'
        'etc/xdg/lxlauncher/gtkrc'
        'etc/xdg/lxlauncher/settings.conf')
source=(https://downloads.sourceforge.net/lxde/$pkgbase-$pkgver.tar.xz
        0001-Add-CSS-selectors-for-GTK-3.20-and-newer.patch
        fix-invisible-icons.patch)
sha256sums=('cd14b59cf337e7ba0d67efc95cd79859ab5f0f85af5a84c7aff771f868c3dca7'
            '794a92dda67f055a794315af4d1a1b0d3319da836582fbc88bbaa3f737612f70'
            '34fd1774d962965795eac8002d77a17078a967e2812ebae3e71d35533e1b3799')

prepare() {
  cd $pkgbase-$pkgver

  # Add CSS selectors for GTK+ 3.20 and newer
  # https://sourceforge.net/p/lxde/patches/543/
  patch -Np1 -i ../0001-Add-CSS-selectors-for-GTK-3.20-and-newer.patch

  # Fix invisible icons with GTK+ 3
  patch -Np1 -i ../fix-invisible-icons.patch
}

build() {
  # GTK+ 2 version
  [ -d gtk2 ] || cp -r $pkgbase-$pkgver gtk2
  cd gtk2
  ./configure --sysconfdir=/etc --prefix=/usr
  make

  cd "$srcdir"
  # GTK+ 3 version
  [ -d gtk3 ] || cp -r $pkgbase-$pkgver gtk3
  cd gtk3
  ./configure --sysconfdir=/etc --prefix=/usr --enable-gtk3
  make
}

package_lxlauncher() {
  groups=('lxde')
  depends=('gtk2' 'startup-notification' 'lxmenu-data' 'menu-cache')

  cd gtk2
  make DESTDIR="$pkgdir" install
}

package_lxlauncher-gtk3() {
  groups=('lxde-gtk3')
  pkgdesc+=' (GTK+ 3 version)'
  depends=('gtk3' 'startup-notification' 'lxmenu-data' 'menu-cache')
  conflicts=('lxlauncher')

  cd gtk3
  make DESTDIR="$pkgdir" install
}

