2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GTKMM_RECENTINFO_H
4 #define _GTKMM_RECENTINFO_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/pixbuf.h>
31 #ifndef DOXYGEN_SHOULD_SKIP_THIS
32 typedef struct _GtkRecentInfo GtkRecentInfo;
33 #endif //DOXYGEN_SHOULD_SKIP_THIS
39 /** Contains informations found when looking up an entry of the
40 * recently used files list.
44 * @ingroup RecentFiles
49 #ifndef DOXYGEN_SHOULD_SKIP_THIS
50 typedef RecentInfo CppObjectType;
51 typedef GtkRecentInfo BaseObjectType;
52 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
55 // For use with Glib::RefPtr<> only.
56 void reference() const;
57 void unreference() const;
59 ///Provides access to the underlying C instance.
60 GtkRecentInfo* gobj();
62 ///Provides access to the underlying C instance.
63 const GtkRecentInfo* gobj() const;
65 ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
66 GtkRecentInfo* gobj_copy() const;
69 // Do not derive this. Gtk::RecentInfo can neither be constructed nor deleted.
71 void operator delete(void*, size_t);
75 RecentInfo(const RecentInfo&);
76 RecentInfo& operator=(const RecentInfo&);
81 bool equal(const RecentInfo& other) const;
82 /// Tests whether the RecentInfo is valid.
83 operator bool() const;
86 /** Gets the URI of the resource.
87 * @return The URI of the resource. The returned string is
88 * owned by the recent manager, and should not be freed.
92 Glib::ustring get_uri() const;
94 /** Gets the name of the resource. If none has been defined, the basename
95 * of the resource is obtained.
96 * @return The display name of the resource. The returned string
97 * is owned by the recent manager, and should not be freed.
101 Glib::ustring get_display_name() const;
103 /** Gets the (short) description of the resource.
104 * @return The description of the resource. The returned string
105 * is owned by the recent manager, and should not be freed.
109 Glib::ustring get_description() const;
111 /** Gets the MIME type of the resource.
112 * @return The MIME type of the resource. The returned string
113 * is owned by the recent manager, and should not be freed.
117 Glib::ustring get_mime_type() const;
120 /** Gets the timestamp (seconds from system's Epoch) when the resource
121 * was added to the recently used resources list.
122 * @return The number of seconds elapsed from system's Epoch when
123 * the resource was added to the list, or -1 on failure.
127 time_t get_added() const;
129 /** Gets the timestamp (seconds from system's Epoch) when the resource
131 * @return The number of seconds elapsed from system's Epoch when
132 * the resource was last modified, or -1 on failure.
136 time_t get_modified() const;
138 /** Gets the timestamp (seconds from system's Epoch) when the resource
140 * @return The number of seconds elapsed from system's Epoch when
141 * the resource was last visited, or -1 on failure.
145 time_t get_visited() const;
148 /** Gets the value of the "private" flag. Resources in the recently used
149 * list that have this flag set to <tt>true</tt> should only be displayed by the
150 * applications that have registered them.
151 * @return <tt>true</tt> if the private flag was found, <tt>false</tt> otherwise.
155 bool get_private_hint() const;
158 /** Gets the data regarding the application that has registered the resource
159 * pointed by @a info .
161 * If the command line contains any escape characters defined inside the
162 * storage specification, they will be expanded.
163 * @param app_name The name of the application that has registered this item.
164 * @param app_exec Return location for the string containing the command line.
165 * @param count Return location for the number of times this item was registered.
166 * @param time Return location for the timestamp this item was last registered
167 * for this application.
168 * @return <tt>true</tt> if an application with @a app_name has registered this
169 * resource inside the recently used list, or <tt>false</tt> otherwise. You should
170 * free the returned command line using Glib::free().
174 bool get_application_info(const Glib::ustring& app_name, Glib::StringArrayHandle& app_exec, guint& count, time_t& time) const;
175 Glib::StringArrayHandle get_applications() const;
177 //_WRAP_METHOD(Glib::StringArrayHandle get_applications(unsigned& length) const, gtk_recent_info_get_applications)
179 /** Gets the name of the last application that have registered the
180 * recently used resource represented by @a info .
181 * @return An application name. Use Glib::free() to free it.
185 Glib::ustring last_application() const;
187 /** Checks whether an application registered this resource using @a app_name .
188 * @param app_name A string containing an application name.
189 * @return <tt>true</tt> if an application with name @a app_name was found,
190 * <tt>false</tt> otherwise.
194 bool has_application(const Glib::ustring& app_name) const;
196 Glib::StringArrayHandle get_groups() const;
198 //_WRAP_METHOD(Glib::StringArrayHandle get_groups(unsigned& length) const, gtk_recent_info_get_groups)
200 /** Checks whether @a group_name appears inside the groups registered for the
201 * recently used item @a info .
202 * @param group_name Name of a group.
203 * @return <tt>true</tt> if the group was found.
207 bool has_group(const Glib::ustring& group) const;
210 /** Retrieves the icon of size @a size associated to the resource MIME type.
211 * @param size The size of the icon in pixels.
212 * @return A Gdk::Pixbuf containing the icon, or <tt>0</tt>.
216 Glib::RefPtr<Gdk::Pixbuf> get_icon(int size);
218 /** Retrieves the icon of size @a size associated to the resource MIME type.
219 * @param size The size of the icon in pixels.
220 * @return A Gdk::Pixbuf containing the icon, or <tt>0</tt>.
224 Glib::RefPtr<const Gdk::Pixbuf> get_icon(int size) const;
227 /** Computes a valid UTF-8 string that can be used as the name of the item in a
228 * menu or list. For example, calling this function on an item that refers to
229 * "file:///foo/bar.txt" will yield "bar.txt".
230 * @return A newly-allocated string in UTF-8 encoding; free it with
235 Glib::ustring get_short_name() const;
237 /** Gets a displayable version of the resource's URI. If the resource
238 * is local, it returns a local path; if the resource is not local,
239 * it returns the UTF-8 encoded content of gtk_recent_info_get_uri().
240 * @return A UTF-8 string containing the resource's URI or <tt>0</tt>
244 Glib::ustring get_uri_display() const;
247 /** Gets the number of days elapsed since the last update of the resource
248 * pointed by @a info .
249 * @return A positive integer containing the number of days elapsed
250 * since the time this resource was last modified.
256 /** Checks whether the resource is local or not by looking at the
258 * @return <tt>true</tt> if the resource is local.
262 bool is_local() const;
264 /** Checks whether the resource pointed by @a info still exists. At
265 * the moment this check is done only on resources pointing to local files.
266 * @return <tt>true</tt> if the resource exists
273 //_WRAP_METHOD(bool match(const RecentInfo& b) const, gtk_recent_info_match)
279 #ifndef DOXYGEN_SHOULD_SKIP_THIS
281 struct RecentInfoTraits
283 typedef Glib::RefPtr<RecentInfo> CppType;
284 typedef const GtkRecentInfo* CType;
285 typedef GtkRecentInfo* CTypeNonConst;
287 static CType to_c_type(const CppType& obj) { return Glib::unwrap(obj); }
288 static CType to_c_type(const CType& obj) { return obj; }
289 static CppType to_cpp_type(const CType& obj); //Implemented in the .cpp file
290 static void release_c_type(const CType& /* obj */) { /* gtk_recent_info_unref(const_cast<CTypeNonConst>(obj)); */}
294 //TODO: We normally put these inside the class:
296 /** @relates Gtk::RecentInfo */
297 inline bool operator==(const RecentInfo& lhs, const RecentInfo& rhs)
298 { return lhs.equal(rhs); }
300 /** @relates Gtk::RecentInfo */
301 inline bool operator!=(const RecentInfo& lhs, const RecentInfo& rhs)
302 { return !lhs.equal(rhs); }
310 /** A Glib::wrap() method for this object.
312 * @param object The C instance.
313 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
314 * @result A C++ instance that wraps this C instance.
316 * @relates Gtk::RecentInfo
318 Glib::RefPtr<Gtk::RecentInfo> wrap(GtkRecentInfo* object, bool take_copy = false);
323 #endif /* _GTKMM_RECENTINFO_H */