2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GTKMM_RECENTMANAGER_H
4 #define _GTKMM_RECENTMANAGER_H
9 /* Copyright (C) 2006 The gtkmm Development Team
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Library General Public
13 * License as published by the Free Software Foundation; either
14 * version 2 of the License, or (at your option) any later version.
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Library General Public License for more details.
21 * You should have received a copy of the GNU Library General Public
22 * License along with this library; if not, write to the Free
23 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 #include <gdkmm/screen.h>
27 #include <gdkmm/pixbuf.h>
29 #include <gtkmm/recentinfo.h>
31 #include <glibmm/object.h>
32 #include <glibmm/containers.h>
35 #ifndef DOXYGEN_SHOULD_SKIP_THIS
36 typedef struct _GtkRecentManager GtkRecentManager;
37 typedef struct _GtkRecentManagerClass GtkRecentManagerClass;
38 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
42 { class RecentManager_Class; } // namespace Gtk
46 /** Exception class for Gtk::RecentManager errors.
48 class RecentManagerError : public Glib::Error
62 RecentManagerError(Code error_code, const Glib::ustring& error_message);
63 explicit RecentManagerError(GError* gobject);
66 #ifndef DOXYGEN_SHOULD_SKIP_THIS
69 #ifdef GLIBMM_EXCEPTIONS_ENABLED
70 static void throw_func(GError* gobject);
72 //When not using exceptions, we just pass the Exception object around without throwing it:
73 static std::auto_ptr<Glib::Error> throw_func(GError* gobject);
74 #endif //GLIBMM_EXCEPTIONS_ENABLED
76 friend void wrap_init(); // uses throw_func()
82 #ifndef DOXYGEN_SHOULD_SKIP_THIS
87 class Value<Gtk::RecentManagerError::Code> : public Glib::Value_Enum<Gtk::RecentManagerError::Code>
90 static GType value_type() G_GNUC_CONST;
94 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
101 /** @defgroup RecentFiles RecentFiles
104 /** RecentManager provides a facility for adding, removing and
105 * looking up recently used files. Each recently used file is
106 * identified by its URI, and has meta-data associated to it, like
107 * the names and command lines of the applications that have
108 * registered it, the number of time each application has registered
109 * the same file, the mime type of the file and whether the file
110 * should be displayed only by the applications that have
113 * The RecentManager acts like a database of all the recently
114 * used files. You can create new RecentManager objects, but
115 * it is more efficient to use the standard recent manager for
116 * the Gdk::Screen so that informations about the recently used
117 * files is shared with other people using them. Normally, you
118 * retrieve the recent manager for a particular screen using
119 * get_for_screen() and it will contain information about current
120 * recent manager for that screen.
124 * @ingroup RecentFiles
127 class RecentManager : public Glib::Object
130 #ifndef DOXYGEN_SHOULD_SKIP_THIS
133 typedef RecentManager CppObjectType;
134 typedef RecentManager_Class CppClassType;
135 typedef GtkRecentManager BaseObjectType;
136 typedef GtkRecentManagerClass BaseClassType;
138 private: friend class RecentManager_Class;
139 static CppClassType recentmanager_class_;
143 RecentManager(const RecentManager&);
144 RecentManager& operator=(const RecentManager&);
147 explicit RecentManager(const Glib::ConstructParams& construct_params);
148 explicit RecentManager(GtkRecentManager* castitem);
150 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
153 virtual ~RecentManager();
155 #ifndef DOXYGEN_SHOULD_SKIP_THIS
156 static GType get_type() G_GNUC_CONST;
157 static GType get_base_type() G_GNUC_CONST;
160 ///Provides access to the underlying C GObject.
161 GtkRecentManager* gobj() { return reinterpret_cast<GtkRecentManager*>(gobject_); }
163 ///Provides access to the underlying C GObject.
164 const GtkRecentManager* gobj() const { return reinterpret_cast<GtkRecentManager*>(gobject_); }
166 ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
167 GtkRecentManager* gobj_copy();
177 static Glib::RefPtr<RecentManager> create();
180 static Glib::RefPtr<RecentManager> get_default();
182 static Glib::RefPtr<RecentManager> get_for_screen(const Glib::RefPtr<Gdk::Screen>& screen);
184 /** Meta-data passed to add_item(). You should
185 * use RecentManager::Data if you want to control the meta-data associated
186 * to an entry of the recently used files list when you are adding
189 * - display_name: the string to be used when displaying the file inside a RecentChooser
190 * - description: a user readable description of the file
191 * - mime_type: the mime type of the file
192 * - app_name: the name of the application that is registering the file
193 * - app_exec: the command line that should be used when launching the file
194 * - groups: the list of group names to which the file belongs to
195 * - is_private: whether the file should be displayed only by the applications that have registered it
200 Glib::ustring display_name;
201 Glib::ustring description;
203 Glib::ustring mime_type;
205 Glib::ustring app_name;
206 Glib::ustring app_exec;
208 Glib::StringArrayHandle groups;
214 void set_screen(const Glib::RefPtr<Gdk::Screen>& screen);
216 #ifdef GLIBMM_EXCEPTIONS_ENABLED
217 bool add_item(const Glib::ustring& uri);
219 bool add_item(const Glib::ustring& uri, std::auto_ptr<Glib::Error>& error);
220 #endif //GLIBMM_EXCEPTIONS_ENABLED
223 bool add_item(const Glib::ustring& uri, const Data& recent_data);
225 #ifdef GLIBMM_EXCEPTIONS_ENABLED
226 bool remove_item(const Glib::ustring& uri);
228 bool remove_item(const Glib::ustring& uri, std::auto_ptr<Glib::Error>& error);
229 #endif //GLIBMM_EXCEPTIONS_ENABLED
232 #ifdef GLIBMM_EXCEPTIONS_ENABLED
233 Glib::RefPtr<RecentInfo> lookup_item(const Glib::ustring& uri);
235 Glib::RefPtr<RecentInfo> lookup_item(const Glib::ustring& uri, std::auto_ptr<Glib::Error>& error);
236 #endif //GLIBMM_EXCEPTIONS_ENABLED
239 #ifdef GLIBMM_EXCEPTIONS_ENABLED
240 Glib::RefPtr<const RecentInfo> lookup_item(const Glib::ustring& uri) const;
242 Glib::RefPtr<const RecentInfo> lookup_item(const Glib::ustring& uri, std::auto_ptr<Glib::Error>& error) const;
243 #endif //GLIBMM_EXCEPTIONS_ENABLED
246 bool has_item(const Glib::ustring& uri) const;
248 #ifdef GLIBMM_EXCEPTIONS_ENABLED
249 bool move_item(const Glib::ustring& uri, const Glib::ustring& new_uri);
251 bool move_item(const Glib::ustring& uri, const Glib::ustring& new_uri, std::auto_ptr<Glib::Error>& error);
252 #endif //GLIBMM_EXCEPTIONS_ENABLED
255 void set_limit(int limit);
257 int get_limit() const;
259 typedef Glib::ListHandle<RecentInfo, RecentInfoTraits> ListHandle_RecentInfos;
262 ListHandle_RecentInfos get_items() const;
265 #ifdef GLIBMM_EXCEPTIONS_ENABLED
268 int purge_items(std::auto_ptr<Glib::Error>& error);
269 #endif //GLIBMM_EXCEPTIONS_ENABLED
272 /// For instance, void on_changed();
273 typedef sigc::slot<void> SlotChanged;
275 /** The "changed" signal is emitted when an item in the recently used resources list is changed.
280 * <tt>void %changed()</tt>
283 Glib::SignalProxy0< void > signal_changed();
286 #ifdef GLIBMM_PROPERTIES_ENABLED
287 /** The full path to the file to be used to store and read the list.
289 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
290 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
291 * the value of the property changes.
293 Glib::PropertyProxy_ReadOnly<Glib::ustring> property_filename() const;
294 #endif //#GLIBMM_PROPERTIES_ENABLED
297 #ifdef GLIBMM_PROPERTIES_ENABLED
298 /** The maximum number of items to be returned by gtk_recent_manager_get_items.
300 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
301 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
302 * the value of the property changes.
304 Glib::PropertyProxy<int> property_limit() ;
305 #endif //#GLIBMM_PROPERTIES_ENABLED
307 #ifdef GLIBMM_PROPERTIES_ENABLED
308 /** The maximum number of items to be returned by gtk_recent_manager_get_items.
310 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
311 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
312 * the value of the property changes.
314 Glib::PropertyProxy_ReadOnly<int> property_limit() const;
315 #endif //#GLIBMM_PROPERTIES_ENABLED
317 #ifdef GLIBMM_PROPERTIES_ENABLED
318 /** The size of the recently used resources list.
320 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
321 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
322 * the value of the property changes.
324 Glib::PropertyProxy_ReadOnly<int> property_size() const;
325 #endif //#GLIBMM_PROPERTIES_ENABLED
331 //C++ methods used to invoke GTK+ virtual functions:
332 #ifdef GLIBMM_VFUNCS_ENABLED
333 #endif //GLIBMM_VFUNCS_ENABLED
336 //GTK+ Virtual Functions (override these to change behaviour):
337 #ifdef GLIBMM_VFUNCS_ENABLED
338 #endif //GLIBMM_VFUNCS_ENABLED
340 //Default Signal Handlers::
341 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
342 virtual void on_changed();
343 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
353 /** @relates Gtk::RecentManager
354 * @param object The C instance
355 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
356 * @result A C++ instance that wraps this C instance.
358 Glib::RefPtr<Gtk::RecentManager> wrap(GtkRecentManager* object, bool take_copy = false);
362 #endif /* _GTKMM_RECENTMANAGER_H */