@@ -39,18 +39,10 @@
40Scope::Scope(QObject *parent) : QObject(parent)
40Scope::Scope(QObject *parent) : QObject(parent)
41 , m_formFactor("phone")
41 , m_formFactor("phone")
42− , m_previewCancellable(nullptr)
44 m_categories.reset(new Categories(this));
43 m_categories.reset(new Categories(this));
49− if (m_previewCancellable) {
50− g_object_unref(m_previewCancellable);
54QString Scope::id() const
46QString Scope::id() const
56 return QString::fromStdString(m_unityScope->id());
48 return QString::fromStdString(m_unityScope->id());
@@ -183,19 +175,13 @@ void Scope::preview(const QVariant &uri, const QVariant &icon_hint, const QVaria
183 const QVariant &comment, const QVariant &dnd_uri, const QVariant &metadata)
175 const QVariant &comment, const QVariant &dnd_uri, const QVariant &metadata)
185 auto res = createLocalResult(uri, icon_hint, category, result_type, mimetype, title, comment, dnd_uri, metadata);
177 auto res = createLocalResult(uri, icon_hint, category, result_type, mimetype, title, comment, dnd_uri, metadata);
188− m_previewCancellable = g_cancellable_new();
178+ m_previewCancellable.Renew();
189 m_unityScope->Preview(res, nullptr, m_previewCancellable);
179 m_unityScope->Preview(res, nullptr, m_previewCancellable);
192void Scope::cancelActivation()
182void Scope::cancelActivation()
194− if (m_previewCancellable) {
184+ m_previewCancellable.Cancel();
195− g_cancellable_cancel(m_previewCancellable);
196− g_object_unref(m_previewCancellable);
197− m_previewCancellable = nullptr;
201void Scope::onActivated(unity::dash::LocalResult const& result, unity::dash::ScopeHandledType type, unity::glib::HintsMap const& hints)
187void Scope::onActivated(unity::dash::LocalResult const& result, unity::dash::ScopeHandledType type, unity::glib::HintsMap const& hints)
@@ -226,10 +212,6 @@ void Scope::onActivated(unity::dash::LocalResult const& result, unity::dash::Sco
227void Scope::onPreviewReady(unity::dash::LocalResult const& /* result */, unity::dash::Preview::Ptr const& preview)
213void Scope::onPreviewReady(unity::dash::LocalResult const& /* result */, unity::dash::Preview::Ptr const& preview)
229− if (m_previewCancellable) {
230− g_object_unref(m_previewCancellable);
231− m_previewCancellable = nullptr;
233 auto prv = Preview::newFromUnityPreview(preview);
215 auto prv = Preview::newFromUnityPreview(preview);
234 // is this the best solution? QML may need to keep more than one preview instance around, so we can't own it.
216 // is this the best solution? QML may need to keep more than one preview instance around, so we can't own it.
235 // passing it by value is not possible.
217 // passing it by value is not possible.