/*
* Copyright (C) 2013 Canonical Ltd
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* Authored by: Nick Dedekind
*/
#ifndef UNITY_SCOPE_H
#define UNITY_SCOPE_H
#include
#include
#include "ScopeProxyInterface.h"
#include "Preview.h"
#include "Result.h"
namespace unity
{
namespace dash
{
#define G_SCOPE_ERROR g_scope_error_quark ()
typedef enum
{
G_SCOPE_ERROR_NO_ACTIVATION_HANDLER = (1 << 0),
G_SCOPE_ERROR_INVALID_PREVIEW = (2 << 0)
} GScopeError;
GQuark
g_scope_error_quark (void);
class Scope : public sigc::trackable, boost::noncopyable
{
public:
typedef std::shared_ptr Ptr;
Scope(ScopeData::Ptr const& scope_data);
virtual ~Scope();
// Must call this function after construction.
virtual void Init();
void Connect();
nux::ROProperty id;
nux::ROProperty connected;
nux::ROProperty visible;
nux::ROProperty results_dirty;
nux::ROProperty is_master;
nux::ROProperty search_hint;
nux::RWProperty view_type;
nux::RWProperty form_factor;
nux::ROProperty results;
nux::ROProperty filters;
nux::ROProperty categories;
nux::ROProperty> category_order;
nux::ROProperty name;
nux::ROProperty description;
nux::ROProperty icon_hint;
nux::ROProperty category_icon_hint;
nux::ROProperty> keywords;
nux::ROProperty type;
nux::ROProperty query_pattern;
nux::ROProperty shortcut;
virtual void Search(std::string const& search_hint, SearchCallback const& callback = nullptr, GCancellable* cancellable = nullptr);
virtual void Search(std::string const& search_hint, glib::HintsMap const&, SearchCallback const& callback = nullptr, GCancellable* cancellable = nullptr);
virtual void Activate(LocalResult const& result, ActivateCallback const& callback = nullptr, GCancellable* cancellable = nullptr);
typedef std::function PreviewCallback;
virtual void Preview(LocalResult const& result, PreviewCallback const& callback = nullptr, GCancellable* cancellable = nullptr);
virtual void ActivatePreviewAction(Preview::ActionPtr const& action,
LocalResult const& result,
glib::HintsMap const& hints,
ActivateCallback const& callback = nullptr,
GCancellable* cancellable = nullptr);
virtual Results::Ptr GetResultsForCategory(unsigned category) const;
sigc::signal activated;
sigc::signal preview_ready;
protected:
virtual ScopeProxyInterface::Ptr CreateProxyInterface() const;
private:
class Impl;
std::unique_ptr pimpl;
friend class TestScope;
};
} // namespace dash
} // namespace unity
#endif // UNITY_SCOPE_H