gtkmm 3.16.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions | Related Functions | List of all members
Gtk::RecentInfo Class Reference
RecentFiles

Contains information found when looking up an entry of the recently used files list. More...

`#include <gtkmm/recentinfo.h>`

## Public Member Functions

void | reference () const
| Increment the reference count for this object. More...
void | unreference () const
| Decrement the reference count for this object. More...
GtkRecentInfo* | gobj ()
| Provides access to the underlying C instance. More...
const GtkRecentInfo* | gobj () const
| Provides access to the underlying C instance. More...
GtkRecentInfo* | gobj_copy () const
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
Glib::ustring | get_uri () const
| Gets the URI of the resource. More...
Glib::ustring | get_display_name () const
| Gets the name of the resource. More...
Glib::ustring | get_description () const
| Gets the (short) description of the resource. More...
Glib::ustring | get_mime_type () const
| Gets the MIME type of the resource. More...
std::time_t | get_added () const
| Gets the timestamp (seconds from system’s Epoch) when the resource was added to the recently used resources list. More...
std::time_t | get_modified () const
| Gets the timestamp (seconds from system’s Epoch) when the meta-data for the resource was last modified. More...
std::time_t | get_visited () const
| Gets the timestamp (seconds from system’s Epoch) when the meta-data for the resource was last visited. More...
bool | get_private_hint () const
| Gets the value of the “private” flag. More...
Glib::RefPtr< Gio::AppInfo > | create_app_info (const Glib::ustring& app_name)
| Creates a AppInfo for the specified Gtk::RecentInfo. More...
bool | get_application_info (const Glib::ustring& app_name, std::string& app_exec, guint&count, std::time_t& time) const
| Gets the data regarding the application that has registered the resource pointed by info. More...
std::vector< Glib::ustring > | get_applications () const
| Retrieves the list of applications that have registered this resource. More...
Glib::ustring | last_application () const
| Gets the name of the last application that have registered the recently used resource represented by info. More...
bool | has_application (const Glib::ustring& app_name) const
| Checks whether an application registered this resource using app_name. More...
std::vector< Glib::ustring > | get_groups () const
| Returns all groups registered for the recently used item info. More...
bool | has_group (const Glib::ustring& group_name) const
| Checks whether group_name appears inside the groups registered for the recently used item info. More...
Glib::RefPtr< Gdk::Pixbuf > | get_icon (int size)
| Retrieves the icon of size size associated to the resource MIME type. More...
Glib::RefPtr< const Gdk::Pixbuf > | get_icon (int size) const
| Retrieves the icon of size size associated to the resource MIME type. More...
Glib::RefPtr< Gio::Icon > | get_gicon ()
| Retrieves the icon associated to the resource MIME type. More...
Glib::RefPtr< const Gio::Icon > | get_gicon () const
| Retrieves the icon associated to the resource MIME type. More...
Glib::ustring | get_short_name () const
| Computes a valid UTF-8 string that can be used as the name of the item in a menu or list. More...
Glib::ustring | get_uri_display () const
| Gets a displayable version of the resource’s URI. More...
int | get_age () const
| Gets the number of days elapsed since the last update of the resource pointed by info. More...
bool | is_local () const
| Checks whether the resource is local or not by looking at the scheme of its URI. More...
bool | exists () const
| Checks whether the resource pointed by info still exists. More...
bool | equal (const RecentInfo& info_b) const
| Checks whether two Gtk::RecentInfo-struct point to the same resource. More...

## Protected Member Functions

| RecentInfo ()
void | operator delete (void*, std::size_t)

## Related Functions

(Note that these are not member functions.)
bool | operator== (const RecentInfo& lhs, const RecentInfo& rhs)
bool | operator!= (const RecentInfo& lhs, const RecentInfo& rhs)
Glib::RefPtr< Gtk::RecentInfo > | wrap (GtkRecentInfo* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...

## Detailed Description

Contains information found when looking up an entry of the recently used files list.

Since gtkmm 2.10:

## Constructor & Destructor Documentation

Gtk::RecentInfo::RecentInfo | ( |  | ) |

protected

## Member Function Documentation

Glib::RefPtr<Gio::AppInfo> Gtk::RecentInfo::create_app_info | ( | const Glib::ustring & | app_name | ) |

Creates a AppInfo for the specified Gtk::RecentInfo.

Parameters

  app_name | The name of the application that should be mapped to a AppInfo; if `0` is used then the default application for the MIME type is used.

Returns
  The newly created AppInfo, or `0`. In case of error, error will be set either with a Gtk::RECENT_MANAGER_ERROR or a IO_ERROR.

bool Gtk::RecentInfo::equal | ( | const RecentInfo& | info_b | ) | const

Checks whether two Gtk::RecentInfo-struct point to the same resource.

Since gtkmm 2.10:

Parameters

  info_b | A Gtk::RecentInfo.

Returns
  `true` if both Gtk::RecentInfo-struct point to the same resource, `false` otherwise.

bool Gtk::RecentInfo::exists | ( |  | ) | const

Checks whether the resource pointed by info still exists.

At the moment this check is done only on resources pointing to local files.

Since gtkmm 2.10:

Returns
  `true` if the resource exists.

std::time_t Gtk::RecentInfo::get_added | ( |  | ) | const

Gets the timestamp (seconds from system’s Epoch) when the resource was added to the recently used resources list.

Since gtkmm 2.10:

Returns
  The number of seconds elapsed from system’s Epoch when the resource was added to the list, or -1 on failure.

int Gtk::RecentInfo::get_age | ( |  | ) | const

Gets the number of days elapsed since the last update of the resource pointed by info.

Since gtkmm 2.10:

Returns
  A positive integer containing the number of days elapsed since the time this resource was last modified.

bool Gtk::RecentInfo::get_application_info | ( | const Glib::ustring & | app_name,
|  | std::string & | app_exec,
|  | guint & | count,
|  | std::time_t & | time
| ) |  | const

Gets the data regarding the application that has registered the resource pointed by info.

If the command line contains any escape characters defined inside the storage specification, they will be expanded.

Since gtkmm 2.10:

Parameters

  app_name | The name of the application that has registered this item.
  app_exec | Return location for the string containing the command line.
  count | Return location for the number of times this item was registered.
  time | Return location for the timestamp this item was last registered for this application.

Returns
  `true` if an application with app_name has registered this resource inside the recently used list, or `false` otherwise. The app_exec string is owned by the Gtk::RecentInfo and should not be modified or freed.

std::vector<Glib::ustring> Gtk::RecentInfo::get_applications | ( |  | ) | const

Retrieves the list of applications that have registered this resource.

Since gtkmm 2.10:

Parameters

  length | Return location for the length of the returned list.

Returns
  A newly allocated `0`-terminated array of strings. Use Glib::strfreev() to free it.

Glib::ustring Gtk::RecentInfo::get_description | ( |  | ) | const

Gets the (short) description of the resource.

Since gtkmm 2.10:

Returns
  The description of the resource. The returned string is owned by the recent manager, and should not be freed.

Glib::ustring Gtk::RecentInfo::get_display_name | ( |  | ) | const

Gets the name of the resource.

If none has been defined, the basename of the resource is obtained.

Since gtkmm 2.10:

Returns
  The display name of the resource. The returned string is owned by the recent manager, and should not be freed.

Glib::RefPtr<Gio::Icon> Gtk::RecentInfo::get_gicon | ( |  | ) |

Retrieves the icon associated to the resource MIME type.

Since gtkmm 2.22:

Returns
  A Icon containing the icon, or `0`. Use Glib::object_unref() when finished using the icon.

Glib::RefPtr<const Gio::Icon> Gtk::RecentInfo::get_gicon | ( |  | ) | const

Retrieves the icon associated to the resource MIME type.

Since gtkmm 2.22:

Returns
  A Icon containing the icon, or `0`. Use Glib::object_unref() when finished using the icon.

std::vector<Glib::ustring> Gtk::RecentInfo::get_groups | ( |  | ) | const

Returns all groups registered for the recently used item info.

The array of returned group names will be `0` terminated, so length might optionally be `0`.

Since gtkmm 2.10:

Parameters

  length | Return location for the number of groups returned.

Returns
  A newly allocated `0` terminated array of strings. Use Glib::strfreev() to free it.

Glib::RefPtr<Gdk::Pixbuf> Gtk::RecentInfo::get_icon | ( | int | size | ) |

Retrieves the icon of size size associated to the resource MIME type.

Since gtkmm 2.10:

Parameters

  size | The size of the icon in pixels.

Returns
  A Gdk::Pixbuf containing the icon, or `0`. Use Glib::object_unref() when finished using the icon.

Glib::RefPtr<const Gdk::Pixbuf> Gtk::RecentInfo::get_icon | ( | int | size | ) | const

Retrieves the icon of size size associated to the resource MIME type.

Since gtkmm 2.10:

Parameters

  size | The size of the icon in pixels.

Returns
  A Gdk::Pixbuf containing the icon, or `0`. Use Glib::object_unref() when finished using the icon.

Glib::ustring Gtk::RecentInfo::get_mime_type | ( |  | ) | const

Gets the MIME type of the resource.

Since gtkmm 2.10:

Returns
  The MIME type of the resource. The returned string is owned by the recent manager, and should not be freed.

std::time_t Gtk::RecentInfo::get_modified | ( |  | ) | const

Gets the timestamp (seconds from system’s Epoch) when the meta-data for the resource was last modified.

Since gtkmm 2.10:

Returns
  The number of seconds elapsed from system’s Epoch when the resource was last modified, or -1 on failure.

bool Gtk::RecentInfo::get_private_hint | ( |  | ) | const

Gets the value of the “private” flag.

Resources in the recently used list that have this flag set to `true` should only be displayed by the applications that have registered them.

Since gtkmm 2.10:

Returns
  `true` if the private flag was found, `false` otherwise.

Glib::ustring Gtk::RecentInfo::get_short_name | ( |  | ) | const

Computes a valid UTF-8 string that can be used as the name of the item in a menu or list.

For example, calling this function on an item that refers to “file:///foo/bar.txt” will yield “bar.txt”.

Since gtkmm 2.10:

Returns
  A newly-allocated string in UTF-8 encoding free it with Glib::free().

Glib::ustring Gtk::RecentInfo::get_uri | ( |  | ) | const

Gets the URI of the resource.

Since gtkmm 2.10:

Returns
  The URI of the resource. The returned string is owned by the recent manager, and should not be freed.

Glib::ustring Gtk::RecentInfo::get_uri_display | ( |  | ) | const

Gets a displayable version of the resource’s URI.

If the resource is local, it returns a local path; if the resource is not local, it returns the UTF-8 encoded content of get_uri().

Since gtkmm 2.10:

Returns
  A newly allocated UTF-8 string containing the resource’s URI or `0`. Use Glib::free() when done using it.

std::time_t Gtk::RecentInfo::get_visited | ( |  | ) | const

Gets the timestamp (seconds from system’s Epoch) when the meta-data for the resource was last visited.

Since gtkmm 2.10:

Returns
  The number of seconds elapsed from system’s Epoch when the resource was last visited, or -1 on failure.

GtkRecentInfo* Gtk::RecentInfo::gobj | ( |  | ) |

Provides access to the underlying C instance.

const GtkRecentInfo* Gtk::RecentInfo::gobj | ( |  | ) | const

Provides access to the underlying C instance.

GtkRecentInfo* Gtk::RecentInfo::gobj_copy | ( |  | ) | const

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

bool Gtk::RecentInfo::has_application | ( | const Glib::ustring & | app_name | ) | const

Checks whether an application registered this resource using app_name.

Since gtkmm 2.10:

Parameters

  app_name | A string containing an application name.

Returns
  `true` if an application with name app_name was found, `false` otherwise.

bool Gtk::RecentInfo::has_group | ( | const Glib::ustring & | group_name | ) | const

Checks whether group_name appears inside the groups registered for the recently used item info.

Since gtkmm 2.10:

Parameters

  group_name | Name of a group.

Returns
  `true` if the group was found.

bool Gtk::RecentInfo::is_local | ( |  | ) | const

Checks whether the resource is local or not by looking at the scheme of its URI.

Since gtkmm 2.10:

Returns
  `true` if the resource is local.

Glib::ustring Gtk::RecentInfo::last_application | ( |  | ) | const

Gets the name of the last application that have registered the recently used resource represented by info.

Since gtkmm 2.10:

Returns
  An application name. Use Glib::free() to free it.

void Gtk::RecentInfo::operator delete | ( | void * | ,
|  | std::size_t |
| ) |  |

protected

void Gtk::RecentInfo::reference | ( |  | ) | const

Increment the reference count for this object.

You should never need to do this manually - use the object via a RefPtr instead.

void Gtk::RecentInfo::unreference | ( |  | ) | const

Decrement the reference count for this object.

You should never need to do this manually - use the object via a RefPtr instead.

## Friends And Related Function Documentation

bool operator!= | ( | const RecentInfo& | lhs,
|  | const RecentInfo& | rhs
| ) |  |

related

bool operator== | ( | const RecentInfo& | lhs,
|  | const RecentInfo& | rhs
| ) |  |

related

Glib::RefPtr< Gtk::RecentInfo > wrap | ( | GtkRecentInfo * | object,
|  | bool | take_copy = `false`
| ) |  |

related

A Glib::wrap() method for this object.

Parameters

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns
  A C++ instance that wraps this C instance.