@@ -33,14 +33,12 @@
33#include <QQmlEngine>
33#include <QQmlEngine>
35#include <UnityCore/Variant.h>
35#include <UnityCore/Variant.h>
36−#include <UnityCore/GLibWrapper.h>
38#include <libintl.h>
37#include <libintl.h>
39#include <glib.h>
38#include <glib.h>
41Scope::Scope(QObject *parent) : QObject(parent)
40Scope::Scope(QObject *parent) : QObject(parent)
42 , m_formFactor("phone")
41 , m_formFactor("phone")
43− , m_searchInProgress(false)
45 m_categories.reset(new Categories(this));
43 m_categories.reset(new Categories(this));
@@ -70,11 +68,6 @@ QString Scope::searchHint() const
70 return QString::fromStdString(m_unityScope->search_hint());
68 return QString::fromStdString(m_unityScope->search_hint());
73−bool Scope::searchInProgress() const
75− return m_searchInProgress;
78bool Scope::visible() const
71bool Scope::visible() const
80 return m_unityScope->visible();
73 return m_unityScope->visible();
@@ -122,15 +115,10 @@ void Scope::setSearchQuery(const QString& search_query)
122 string ("") and m_searchQuery is the null string,
115 string ("") and m_searchQuery is the null string,
123 search_query != m_searchQuery is still true.
116 search_query != m_searchQuery is still true.
125− using namespace std::placeholders;
127 if (m_searchQuery.isNull() || search_query != m_searchQuery) {
118 if (m_searchQuery.isNull() || search_query != m_searchQuery) {
128 m_searchQuery = search_query;
119 m_searchQuery = search_query;
129− m_cancellable.Renew();
130− m_searchInProgress = true;
131− m_unityScope->Search(search_query.toStdString(), std::bind(&Scope::onSearchFinished, this, _1, _2, _3), m_cancellable);
120+ m_unityScope->Search(search_query.toStdString(), sigc::mem_fun(this, &Scope::searchFinished));
132 Q_EMIT searchQueryChanged();
121 Q_EMIT searchQueryChanged();
133− Q_EMIT searchInProgressChanged();
@@ -306,6 +294,8 @@ void Scope::setUnityScope(const unity::dash::Scope::Ptr& scope)
306 m_unityScope->visible.changed.connect(sigc::mem_fun(this, &Scope::visibleChanged));
294 m_unityScope->visible.changed.connect(sigc::mem_fun(this, &Scope::visibleChanged));
307 m_unityScope->shortcut.changed.connect(sigc::mem_fun(this, &Scope::shortcutChanged));
295 m_unityScope->shortcut.changed.connect(sigc::mem_fun(this, &Scope::shortcutChanged));
308 m_unityScope->connected.changed.connect(sigc::mem_fun(this, &Scope::connectedChanged));
296 m_unityScope->connected.changed.connect(sigc::mem_fun(this, &Scope::connectedChanged));
297+ /* Signals forwarding */
298+ connect(this, SIGNAL(searchFinished(const std::string &, unity::glib::HintsMap const &, unity::glib::Error const &)), SLOT(onSearchFinished(const std::string &, unity::glib::HintsMap const &)));
310 /* FIXME: signal should be forwarded instead of calling the handler directly */
300 /* FIXME: signal should be forwarded instead of calling the handler directly */
311 m_unityScope->activated.connect(sigc::mem_fun(this, &Scope::onActivated));
301 m_unityScope->activated.connect(sigc::mem_fun(this, &Scope::onActivated));
@@ -326,33 +316,18 @@ unity::dash::Scope::Ptr Scope::unityScope() const
327void Scope::synchronizeStates()
317void Scope::synchronizeStates()
329− using namespace std::placeholders;
331 if (connected()) {
319 if (connected()) {
332 /* Forward local states to m_unityScope */
320 /* Forward local states to m_unityScope */
333 if (!m_searchQuery.isNull()) {
321 if (!m_searchQuery.isNull()) {
334− m_cancellable.Renew();
335− m_searchInProgress = true;
336− m_unityScope->Search(m_searchQuery.toStdString(), std::bind(&Scope::onSearchFinished, this, _1, _2, _3), m_cancellable);
322+ m_unityScope->Search(m_searchQuery.toStdString());
337− Q_EMIT searchInProgressChanged();
342−void Scope::onSearchFinished(std::string const& /* query */, unity::glib::HintsMap const& hints, unity::glib::Error const& err)
327+void Scope::onSearchFinished(const std::string& /* query */, unity::glib::HintsMap const &hints)
344 QString hint;
329 QString hint;
346− GError* error = const_cast<unity::glib::Error&>(err);
348− if (!err || !g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
349− m_searchInProgress = false;
350− Q_EMIT searchInProgressChanged();
352− // no need to check the results hint, we're still searching
356 if (!m_unityScope->results()->count()) {
331 if (!m_unityScope->results()->count()) {
357 unity::glib::HintsMap::const_iterator it = hints.find("no-results-hint");
332 unity::glib::HintsMap::const_iterator it = hints.find("no-results-hint");
358 if (it != hints.end()) {
333 if (it != hints.end()) {