@@ -73,7 +73,8 @@ void Scopes::clear()
7373 timer.stop();
7474 if (m_scopes.size() > 0) {
7575 beginRemoveRows(QModelIndex(), 0, m_scopes.count()-1);
76− qDeleteAll(m_scopes);
76+ qDeleteAll(m_allScopes);
77+ m_allScopes.clear();
7778 m_scopes.clear();
7879 endRemoveRows();
7980 }
@@ -126,17 +127,17 @@ unity::shell::scopes::ScopeInterface* Scopes::getScope(int row) const
126127
127128unity::shell::scopes::ScopeInterface* Scopes::getScope(QString const &scope_id) const
128129{
130+ // According to mh3 Scopes::getScope should only return favorite scopes (i.e the ones in the model)
129131 for (Scope *scope : m_scopes) {
130− // According to mh3 Scopes::getScope should only return non null for visible scopes
131− if (scope->id() == scope_id && scope->visible())
132+ if (scope->id() == scope_id)
132133 return scope;
133134 }
134135 return nullptr;
135136}
136137
137−unity::shell::scopes::ScopeInterface* Scopes::getScopeFromAll(const QString& scope_id) const
138+Scope* Scopes::getScopeFromAll(const QString& scope_id) const
138139{
139− for (Scope *scope : m_scopes) {
140+ for (Scope *scope : m_allScopes) {
140141 if (scope->id() == scope_id)
141142 return scope;
142143 }
@@ -163,21 +164,23 @@ unity::shell::scopes::ScopeInterface* Scopes::overviewScope() const
163164 return m_scopesOverview;
164165}
165166
166−QList<unity::shell::scopes::ScopeInterface *> Scopes::scopes(bool onlyVisible) const
167+QList<Scope*> Scopes::scopes() const
167168{
168− QList<unity::shell::scopes::ScopeInterface *> res;
169− for (Scope *scope : m_scopes) {
170− if (!onlyVisible || scope->visible()) {
171− res << scope;
172− }
173− }
174− return res;
169+ return m_scopes;
170+}
171+
172+QList<Scope*> Scopes::allScopes() const
173+{
174+ return m_allScopes;
175175}
176176
177177void Scopes::addScope(Scope* scope)
178178{
179179 int index = rowCount();
180− beginInsertRows(QModelIndex(), index, index);
181− m_scopes.append(scope);
182− endInsertRows();
180+ if (scope->favorite()) {
181+ beginInsertRows(QModelIndex(), index, index);
182+ m_scopes.append(scope);
183+ endInsertRows();
184+ }
185+ m_allScopes.append(scope);
183186}