RecentInfo

class RecentInfo(*args, **kwargs)

GtkRecentInfo contains the metadata associated with an item in the recently used files list.

Methods

class RecentInfo
create_app_info(app_name: str | None = None) AppInfo | None

Creates a GAppInfo for the specified GtkRecentInfo

In case of error, error will be set either with a %GTK_RECENT_MANAGER_ERROR or a %G_IO_ERROR

Parameters:

app_name – the name of the application that should be mapped to a GAppInfo; if None is used then the default application for the MIME type is used

exists() bool

Checks whether the resource pointed by info still exists. At the moment this check is done only on resources pointing to local files.

get_added() DateTime

Gets the time when the resource was added to the recently used resources list.

get_age() int

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

get_application_info(app_name: str) tuple[bool, str, int, DateTime]

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.

Parameters:

app_name – the name of the application that has registered this item

get_applications() list[str]

Retrieves the list of applications that have registered this resource.

get_description() str

Gets the (short) description of the resource.

get_display_name() str

Gets the name of the resource.

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

get_gicon() Icon | None

Retrieves the icon associated to the resource MIME type.

get_groups() list[str]

Returns all groups registered for the recently used item info.

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

get_mime_type() str

Gets the MIME type of the resource.

get_modified() DateTime

Gets the time when the meta-data for the resource was last modified.

get_private_hint() bool

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.

get_short_name() str

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”.

get_uri() str

Gets the URI of the resource.

get_uri_display() str | None

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.

get_visited() DateTime

Gets the time when the meta-data for the resource was last visited.

has_application(app_name: str) bool

Checks whether an application registered this resource using app_name.

Parameters:

app_name – a string containing an application name

has_group(group_name: str) bool

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

Parameters:

group_name – name of a group

is_local() bool

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

last_application() str

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

match(info_b: RecentInfo) bool

Checks whether two GtkRecentInfo point to the same resource.

Parameters:

info_b – a GtkRecentInfo