# -*- coding: utf-8 -*-
# Moovida - Home multimedia server
# Copyright (C) 2006-2009 Fluendo Embedded S.L. (www.fluendo.com).
# All rights reserved.
#
# This file is available under one of two license agreements.
#
# This file is licensed under the GPL version 3.
# See "LICENSE.GPL" in the root of this distribution including a special
# exception to use Moovida with Fluendo's plugins.
#
# The GPL part of Moovida is also available under a commercial licensing
# agreement from Fluendo.
# See "LICENSE.Moovida" in the root directory of this distribution package
# for details on that license.
#

from elisa.core.utils import defer

import gobject

class ContextualAction(gobject.GObject):

    """
    DOCME

    @cvar name:  DOCME
    @type name:  DOCME
    @cvar label: DOCME
    @type label: DOCME
    """

    __gsignals__ = {
        'name-changed': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
    }

    label = ''

    def __init__(self, controller):
        super(ContextualAction, self).__init__()
        self.controller = controller
        self._name = None

    def _get_name(self):
        return self._name

    def _set_name(self, new_name):
        self._name = new_name
        self.emit('name-changed')

    name = property(_get_name, _set_name)

    def execute(self, item):
        # Default implementation
        return defer.fail(NotImplementedError())

