Skip to content

Gtk.RecentInfo

record (struct)

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

Methods

create_app_info

def create_app_info(self, app_name: str | None = ...) -> Gio.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

def exists(self) -> 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

def get_added(self) -> GLib.DateTime

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

get_age

def get_age(self) -> int

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

get_application_info

def get_application_info(self, app_name: str) -> tuple[bool, str, int, GLib.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

def get_applications(self) -> list[str]

Retrieves the list of applications that have registered this resource.

get_description

def get_description(self) -> str

Gets the (short) description of the resource.

get_display_name

def get_display_name(self) -> str

Gets the name of the resource.

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

get_gicon

def get_gicon(self) -> Gio.Icon | None

Retrieves the icon associated to the resource MIME type.

get_groups

def get_groups(self) -> 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

def get_mime_type(self) -> str

Gets the MIME type of the resource.

get_modified

def get_modified(self) -> GLib.DateTime

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

get_private_hint

def get_private_hint(self) -> 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

def get_short_name(self) -> 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

def get_uri(self) -> str

Gets the URI of the resource.

get_uri_display

def get_uri_display(self) -> 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 RecentInfo.get_uri.

get_visited

def get_visited(self) -> GLib.DateTime

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

has_application

def has_application(self, 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

def has_group(self, 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

def is_local(self) -> bool

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

last_application

def last_application(self) -> str

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

match_

def match_(self, info_b: RecentInfo) -> bool

Checks whether two GtkRecentInfo point to the same resource.

Parameters:

  • info_b — a GtkRecentInfo

ref

def ref(self) -> RecentInfo

Increases the reference count of recent_info by one.

unref

def unref(self) -> None

Decreases the reference count of info by one.

If the reference count reaches zero, info is deallocated, and the memory freed.