Each recently used file is identified by its URI, and has meta-data
associated to it, like the names and command lines of the applications
that have registered it, the number of time each application has
registered the same file, the mime type of the file and whether
the file should be displayed only by the applications that have
registered it.
gtk.recent_manager.RecentManager manages and looks up recently used files.
Each recently used file is identified by its URI, and has meta-data associated to it, like the names and command lines of the applications that have registered it, the number of time each application has registered the same file, the mime type of the file and whether the file should be displayed only by the applications that have registered it.
The recently used files list is per user.
gtk.recent_manager.RecentManager acts like a database of all the recently used files. You can create new gtk.recent_manager.RecentManager objects, but it is more efficient to use the default manager created by GTK.
Adding a new recently used file is as simple as:
The gtk.recent_manager.RecentManager will try to gather all the needed information from the file itself through GIO.
Looking up the meta-data associated with a recently used file given its URI requires calling gtk.recent_manager.RecentManager.lookupItem:
In order to retrieve the list of recently used files, you can use gtk.recent_manager.RecentManager.getItems, which returns a list of gtk.recent_info.RecentInfo.
Note that the maximum age of the recently used files list is controllable through the property@Gtk.Settings:gtk-recent-files-max-age property.