/* * Copyright (C) 2010 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: Neil Jagdish Patel */ #ifndef PLACE_ENTRY_H #define PLACE_ENTRY_H #include #include #include #include #include #include class PlaceEntryGroup { public: // As this class is to hide the implementation of the PlaceEntry, and will often be // hiding a more C-like API, the decision taken is to make all these stack allocated // and to discourage the views or controllers from saving references to these. Instead // please use GetId(), which will return a pointer that you can guarentee will be valid // and you can use to do lookups to views. virtual const void * GetId () const = 0; virtual const char * GetRenderer () const = 0; virtual const char * GetName () const = 0; virtual const char * GetIcon () const = 0; }; class PlaceEntryResult { public: // As this class is to hide the implementation of the PlaceEntry, and will often be // hiding a more C-like API, the decision taken is to make all these stack allocated // and to discourage the views or controllers from saving references to these. Instead // please use GetId(), which will return a pointer that you can guarentee will be valid // and you can use to do lookups to views. virtual const void * GetId () const = 0; virtual const char * GetName () const = 0; virtual const char * GetIcon () const = 0; virtual const char * GetMimeType() const = 0; virtual const char * GetURI () const = 0; virtual const char * GetComment () const = 0; }; class PlaceEntry : public sigc::trackable { public: typedef sigc::slot GroupForeachCallback; typedef sigc::slot ResultForeachCallback; virtual const char * GetId () = 0; virtual const char * GetName () = 0; virtual const char * GetIcon () = 0; virtual const char * GetDescription () = 0; virtual guint64 GetShortcut () = 0; // For ordering entries within a place virtual guint32 GetPosition () = 0; // For DND, what can this entry handle virtual const char ** GetMimetypes () = 0; virtual const std::map& GetHints () = 0; // Whether the entry is sensitive to input (clicks/DND) virtual bool IsSensitive () = 0; // This is not really useful for views virtual bool IsActive () = 0; // Show this entry in the launcher virtual bool ShowInLauncher () = 0; // Include as part of global search results virtual bool ShowInGlobal () = 0; // Important to call this when the view is active/inactive, so the place can reset itself // if necessary virtual void SetActive (bool is_active) = 0; virtual void SetSearch (const char *search, std::map& hints) = 0; virtual void SetActiveSection (guint32 section_id) = 0; virtual void SetGlobalSearch (const char *search, std::map& hints) = 0; virtual void ForeachGroup (GroupForeachCallback slot) = 0; virtual void ForeachResult (ResultForeachCallback slot) = 0; virtual void ForeachGlobalGroup (GroupForeachCallback slot) = 0; virtual void ForeachGlobalResult (ResultForeachCallback slot) = 0; // Signals sigc::signal active_changed; // This covers: name, icon and description properties sigc::signal state_changed; sigc::signal position_changed; sigc::signal mimetypes_changed; sigc::signal sensitive_changed; // If ShowInLauncher or ShowInGlobal changes sigc::signal visibility_changed; // We don't use this too much right now sigc::signal hints_changed; // Should be very rare sigc::signal sections_model_changed; // Definitely connect to this, as your setting sections the places might want // to update it's views accordingly sigc::signal entry_renderer_changed; // This is not important outside of a global search aggregator sigc::signal global_renderer_changed; sigc::signal group_added; sigc::signal result_added; sigc::signal result_removed; sigc::signal global_group_added; sigc::signal global_result_added; sigc::signal global_result_removed; }; #endif // PLACE_ENTRY_H