/*
 * This file is autogenerated with bcop:
 * The Compiz option code generator
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */


#include <core/core.h>

#include "titleinfo_options.h"

TitleinfoOptions::TitleinfoOptions (bool init /* = true */) :
    mOptions (TitleinfoOptions::OptionNum),
    mNotify (TitleinfoOptions::OptionNum)
{
    if (init)
        initOptions ();
}

void
TitleinfoOptions::initOptions ()
{

    // show_remote_machine
    mOptions[TitleinfoOptions::ShowRemoteMachine].setName ("show_remote_machine", CompOption::TypeBool);
    mOptions[TitleinfoOptions::ShowRemoteMachine].value().set(true);

    // show_root
    mOptions[TitleinfoOptions::ShowRoot].setName ("show_root", CompOption::TypeBool);
    mOptions[TitleinfoOptions::ShowRoot].value().set(true);

}

TitleinfoOptions::~TitleinfoOptions ()
{
}


CompOption::Vector &
TitleinfoOptions::getOptions ()
{
    return mOptions;
}

bool
TitleinfoOptions::setOption (const CompString &name, CompOption::Value &value)
{
    CompOption   *o;
    unsigned int index;

    o = CompOption::findOption (mOptions, name, &index);

    if (!o)
        return false;

    switch (index)
    {
        case TitleinfoOptions::ShowRemoteMachine:
            if (o->set (value))
            {
                if (!mNotify[TitleinfoOptions::ShowRemoteMachine].empty ())
                    mNotify[TitleinfoOptions::ShowRemoteMachine] (o, TitleinfoOptions::ShowRemoteMachine);
                return true;
            }
            break;
        case TitleinfoOptions::ShowRoot:
            if (o->set (value))
            {
                if (!mNotify[TitleinfoOptions::ShowRoot].empty ())
                    mNotify[TitleinfoOptions::ShowRoot] (o, TitleinfoOptions::ShowRoot);
                return true;
            }
            break;
        default:
            break;
    }
    return false;

}

