# -*- python -*-
# encoding: utf-8

def configure(conf):
    conf.env.append_value('MODULES_AVAILABLE', 'mateapplet')
    if 'mateapplet' in conf.env['ENABLE_MODULES'] or 'all' in conf.env['ENABLE_MODULES']:
        if conf.pkg_check_modules('MATEAPPLET',
                                  'libmatepanelapplet-2.0 >= 2.13.4 pygobject-2.0 libmate-2.0 libmateui-2.0',
                                  mandatory=False):
            conf.env.append_value('MODULES_TO_BUILD', 'mateapplet')


def build(bld):
    env = bld.env
    if 'mateapplet' in env['MODULES_TO_BUILD']:
        bld.codegen('applet')
        pyext = bld.create_pyext()
        pyext.source = 'appletmodule.c applet.c'
        pyext.target = 'mateapplet'
        pyext.uselib = 'MATEAPPLET'
        pyext.install_path = '${PYTHONDIR}/gtk-2.0'

        bld.install_files('${DATADIR}/pygtk/2.0/defs', 'applet.defs')

