def on(id, event):
    """
    Sets the decorated method to handle indicated event::

        @plugin
        class Hosts (SectionPlugin):
            def init(self):
                self.append(self.ui.inflate('hosts:main'))
                ...

            @on('save', 'click')
            def save(self):
                self.config.save()

    :param id: element ID
    :type  id: str
    :param event: event name
    :type  event: str
    :rtype: function
    """

    def decorator(fx):
        fx._event_id = id
        fx._event_name = event
        return fx
    return decorator