on ffba04d help sign in
unity8/plugins/Unity/filteroption.cpp
72 lines 2.2 kB history raw
1/*
2 * Copyright (C) 2011 Canonical, Ltd.
3 *
4 * Authors:
5 * Florian Boucault <florian.boucault@canonical.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 3.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
20// Self
21#include "filteroption.h"
23// libunity-core
24#include <UnityCore/Filter.h>
26FilterOption::FilterOption(unity::dash::FilterOption::Ptr unityFilterOption, QObject *parent) :
27 QObject(parent), m_unityFilterOption(NULL)
29 setUnityFilterOption(unityFilterOption);
32QString FilterOption::id() const
34 return QString::fromStdString(m_unityFilterOption->id());
37QString FilterOption::name() const
39 return QString::fromStdString(m_unityFilterOption->name());
42QString FilterOption::iconHint() const
44 return QString::fromStdString(m_unityFilterOption->icon_hint());
47bool FilterOption::active() const
49 return m_unityFilterOption->active();
52void FilterOption::setActive(bool active)
54 m_unityFilterOption->active = active;
57void FilterOption::setUnityFilterOption(unity::dash::FilterOption::Ptr unityFilterOption)
59 if (m_unityFilterOption != NULL) {
60 // FIXME: should disconnect from m_unityFilterOption's signals
61 }
63 m_unityFilterOption = unityFilterOption;
65 /* Property change signals */
66 m_unityFilterOption->id.changed.connect(sigc::mem_fun(this, &FilterOption::idChanged));
67 m_unityFilterOption->name.changed.connect(sigc::mem_fun(this, &FilterOption::nameChanged));
68 m_unityFilterOption->icon_hint.changed.connect(sigc::mem_fun(this, &FilterOption::iconHintChanged));
69 m_unityFilterOption->active.changed.connect(sigc::mem_fun(this, &FilterOption::activeChanged));
72#include "filteroption.moc"