RecentManager
Superclasses: Object
- Constructors:
RecentManager(**properties)
new() -> Gtk.RecentManager
Constructors
- class RecentManager
- classmethod new() RecentManager
Creates a new recent manager object.
Recent manager objects are used to handle the list of recently used resources. A
GtkRecentManager
object monitors the recently used resources list, and emits thechanged
signal each time something inside the list changes.GtkRecentManager
objects are expensive: be sure to create them only when needed. You should useget_default
instead.
Methods
- class RecentManager
- add_full(uri: str, recent_data: RecentData) bool
Adds a new resource, pointed by
uri
, into the recently used resources list, using the metadata specified inside theGtkRecentData
passed inrecent_data
.The passed URI will be used to identify this resource inside the list.
In order to register the new recently used resource, metadata about the resource must be passed as well as the URI; the metadata is stored in a
GtkRecentData
, which must contain the MIME type of the resource pointed by the URI; the name of the application that is registering the item, and a command line to be used when launching the item.Optionally, a
GtkRecentData
might contain a UTF-8 string to be used when viewing the item instead of the last component of the URI; a short description of the item; whether the item should be considered private - that is, should be displayed only by the applications that have registered it.- Parameters:
uri – a valid URI
recent_data – metadata of the resource
- add_item(uri: str) bool
Adds a new resource, pointed by
uri
, into the recently used resources list.This function automatically retrieves some of the needed metadata and setting other metadata to common default values; it then feeds the data to
add_full
.See
add_full
if you want to explicitly define the metadata for the resource pointed byuri
.- Parameters:
uri – a valid URI
- get_default() RecentManager
Gets a unique instance of
GtkRecentManager
that you can share in your application without caring about memory management.
- get_items() list[RecentInfo]
Gets the list of recently used resources.
- has_item(uri: str) bool
Checks whether there is a recently used resource registered with
uri
inside the recent manager.- Parameters:
uri – a URI
- lookup_item(uri: str) RecentInfo | None
Searches for a URI inside the recently used resources list, and returns a
GtkRecentInfo
containing information about the resource like its MIME type, or its display name.- Parameters:
uri – a URI
- move_item(uri: str, new_uri: str | None = None) bool
Changes the location of a recently used resource from
uri
tonew_uri
.Please note that this function will not affect the resource pointed by the URIs, but only the URI used in the recently used resources list.
- Parameters:
uri – the URI of a recently used resource
new_uri – the new URI of the recently used resource, or
None
to remove the item pointed byuri
in the list