| 1 |
/* Copyright (C) 2006 The gtkmm Development Team |
| 2 |
* |
| 3 |
* This library is free software; you can redistribute it and/or |
| 4 |
* modify it under the terms of the GNU Lesser General Public |
| 5 |
* License as published by the Free Software Foundation; either |
| 6 |
* version 2.1 of the License, or (at your option) any later version. |
| 7 |
* |
| 8 |
* This library is distributed in the hope that it will be useful, |
| 9 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 |
* Lesser General Public License for more details. |
| 12 |
* |
| 13 |
* You should have received a copy of the GNU Lesser General Public |
| 14 |
* License along with this library; if not, see <https://www.gnu.org/licenses/>. |
| 15 |
*/ |
| 16 |
|
| 17 |
_CONFIGINCLUDE(gtkmmconfig.h) |
| 18 |
|
| 19 |
#include <vector> |
| 20 |
|
| 21 |
#include <gdkmm/pixbuf.h> |
| 22 |
#include <giomm/icon.h> |
| 23 |
#include <giomm/appinfo.h> |
| 24 |
#include <ctime> |
| 25 |
|
| 26 |
_DEFS(gtkmm,gtk) |
| 27 |
|
| 28 |
#ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 29 |
extern "C" |
| 30 |
{ |
| 31 |
typedef struct _GtkRecentInfo GtkRecentInfo; |
| 32 |
void gtk_recent_info_unref(GtkRecentInfo* info); |
| 33 |
} |
| 34 |
#endif /* !DOXYGEN_SHOULD_SKIP_THIS */ |
| 35 |
|
| 36 |
namespace Gtk |
| 37 |
{ |
| 38 |
|
| 39 |
/** Contains information found when looking up an entry of the |
| 40 |
* recently used files list. |
| 41 |
* |
| 42 |
* @newin{2,10} |
| 43 |
* |
| 44 |
* @ingroup RecentFiles |
| 45 |
*/ |
| 46 |
class GTKMM_API RecentInfo final |
| 47 |
{ |
| 48 |
_CLASS_OPAQUE_REFCOUNTED(RecentInfo, GtkRecentInfo, NONE, gtk_recent_info_ref, gtk_recent_info_unref, GTKMM_API) |
| 49 |
_IGNORE(gtk_recent_info_ref, gtk_recent_info_unref) |
| 50 |
public: |
| 51 |
|
| 52 |
_WRAP_METHOD(Glib::ustring get_uri() const, gtk_recent_info_get_uri) |
| 53 |
_WRAP_METHOD(Glib::ustring get_display_name() const, gtk_recent_info_get_display_name) |
| 54 |
_WRAP_METHOD(Glib::ustring get_description() const, gtk_recent_info_get_description) |
| 55 |
_WRAP_METHOD(Glib::ustring get_mime_type() const, gtk_recent_info_get_mime_type) |
| 56 |
|
| 57 |
_WRAP_METHOD(std::time_t get_added() const, gtk_recent_info_get_added) |
| 58 |
_WRAP_METHOD(std::time_t get_modified() const, gtk_recent_info_get_modified) |
| 59 |
_WRAP_METHOD(std::time_t get_visited() const, gtk_recent_info_get_visited) |
| 60 |
|
| 61 |
_WRAP_METHOD(bool get_private_hint() const, gtk_recent_info_get_private_hint) |
| 62 |
|
| 63 |
#m4 _CONVERSION(`GAppInfo*',`Glib::RefPtr<Gio::AppInfo>',`Glib::wrap($3)') |
| 64 |
_WRAP_METHOD(Glib::RefPtr<Gio::AppInfo> create_app_info(const Glib::ustring& app_name), gtk_recent_info_create_app_info, errthrow) |
| 65 |
|
| 66 |
_WRAP_METHOD_DOCS_ONLY(gtk_recent_info_get_application_info) |
| 67 |
bool get_application_info(const Glib::ustring& app_name, std::string& app_exec, |
| 68 |
guint& count, std::time_t& time) const; |
| 69 |
|
| 70 |
_WRAP_METHOD_DOCS_ONLY(gtk_recent_info_get_applications) |
| 71 |
std::vector<Glib::ustring> get_applications() const; |
| 72 |
|
| 73 |
_WRAP_METHOD(Glib::ustring last_application() const, gtk_recent_info_last_application) |
| 74 |
_WRAP_METHOD(bool has_application(const Glib::ustring& app_name) const, |
| 75 |
gtk_recent_info_has_application) |
| 76 |
|
| 77 |
_WRAP_METHOD_DOCS_ONLY(gtk_recent_info_get_groups) |
| 78 |
std::vector<Glib::ustring> get_groups() const; |
| 79 |
|
| 80 |
_WRAP_METHOD(bool has_group(const Glib::ustring& group_name) const, gtk_recent_info_has_group) |
| 81 |
|
| 82 |
_WRAP_METHOD(Glib::RefPtr<Gdk::Pixbuf> get_icon(int size), |
| 83 |
gtk_recent_info_get_icon, refreturn) |
| 84 |
_WRAP_METHOD(Glib::RefPtr<const Gdk::Pixbuf> get_icon(int size) const, |
| 85 |
gtk_recent_info_get_icon, refreturn, constversion) |
| 86 |
|
| 87 |
_WRAP_METHOD(Glib::RefPtr<Gio::Icon> get_gicon(), |
| 88 |
gtk_recent_info_get_gicon, refreturn) |
| 89 |
_WRAP_METHOD(Glib::RefPtr<const Gio::Icon> get_gicon() const, |
| 90 |
gtk_recent_info_get_gicon, refreturn, constversion) |
| 91 |
|
| 92 |
_WRAP_METHOD(Glib::ustring get_short_name() const, gtk_recent_info_get_short_name) |
| 93 |
_WRAP_METHOD(Glib::ustring get_uri_display() const, gtk_recent_info_get_uri_display) |
| 94 |
|
| 95 |
_WRAP_METHOD(int get_age() const, gtk_recent_info_get_age) |
| 96 |
_WRAP_METHOD(bool is_local() const, gtk_recent_info_is_local) |
| 97 |
_WRAP_METHOD(bool exists() const, gtk_recent_info_exists) |
| 98 |
#m4begin |
| 99 |
_CONVERSION(`const RecentInfo&',`GtkRecentInfo*', `const_cast<GtkRecentInfo*>(($3).gobj())') |
| 100 |
#m4end |
| 101 |
_WRAP_METHOD(bool equal(const RecentInfo& info_b) const, gtk_recent_info_match) |
| 102 |
}; |
| 103 |
|
| 104 |
#ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 105 |
|
| 106 |
struct GTKMM_API RecentInfoTraits |
| 107 |
{ |
| 108 |
typedef Glib::RefPtr<RecentInfo> CppType; |
| 109 |
typedef const GtkRecentInfo* CType; |
| 110 |
typedef GtkRecentInfo* CTypeNonConst; |
| 111 |
|
| 112 |
static inline CType to_c_type(const CppType& obj) { return Glib::unwrap(obj); } |
| 113 |
static inline CType to_c_type(const CType& obj) { return obj; } |
| 114 |
static CppType to_cpp_type(const CType& obj); |
| 115 |
static inline void release_c_type(const CType& obj) |
| 116 |
{ gtk_recent_info_unref(const_cast<CTypeNonConst>(obj)); } |
| 117 |
}; |
| 118 |
#endif /* !DOXYGEN_SHOULD_SKIP_THIS */ |
| 119 |
|
| 120 |
// TODO: These are almost impossible to use without RefPtr<>::operator*() |
| 121 |
|
| 122 |
/** @relates Gtk::RecentInfo */ |
| 123 |
inline bool operator==(const RecentInfo& lhs, const RecentInfo& rhs) |
| 124 |
{ return lhs.equal(rhs); } |
| 125 |
|
| 126 |
/** @relates Gtk::RecentInfo */ |
| 127 |
inline bool operator!=(const RecentInfo& lhs, const RecentInfo& rhs) |
| 128 |
{ return !lhs.equal(rhs); } |
| 129 |
|
| 130 |
} // namespace Gtk |
| 131 |
|
| 132 |
namespace Glib |
| 133 |
{ |
| 134 |
|
| 135 |
// This is needed so Glib::RefPtr<Gtk::RecentInfo> can be used with |
| 136 |
// Glib::Value and Gtk::TreeModelColumn: |
| 137 |
template <> |
| 138 |
class GTKMM_API Value< Glib::RefPtr<Gtk::RecentInfo> > : public ValueBase_Boxed |
| 139 |
{ |
| 140 |
public: |
| 141 |
typedef Glib::RefPtr<Gtk::RecentInfo> CppType; |
| 142 |
typedef GtkRecentInfo* CType; |
| 143 |
|
| 144 |
static GType value_type(); |
| 145 |
|
| 146 |
void set(const CppType& data); |
| 147 |
CppType get() const; |
| 148 |
}; |
| 149 |
|
| 150 |
} // namespace Glib |