gtk.RecentManagermanages recently used files (new in PyGTK
2.10)Synopsisgtk.RecentManagergobject.GObjectgtk.RecentManagerset_screenscreenadd_itemuriadd_fullurirecent_dataremove_itemurilookup_itemurihas_itemurimove_itemurinew_uriset_limitlimitget_limitget_itemspurge_itemsFunctionsgtk.recent_manager_get_defaultgtk.recent_manager_get_for_screenscreenAncestry+-- gobject.GObject
+-- gtk.RecentManager
gtk.RecentManager Properties
"filename"Read-Write-Construct OnlyThe full path to the file to be used to store and read the
recently used resources list This property is available in GTK+
2.10 and above."limit"Read-WriteThe maximum number of items to be returned by the gtk.RecentManager.get_items()
function. This property is available in GTK+ 2.10 and
above."size"ReadThe size of the recently used resources list. This
property is available in GTK+ 2.10 and above.
gtk.RecentManager Signal Prototypesgobject.GObject Signal Prototypes"changedcallbackrecent_manageruser_param1...Descriptiongtk.RecentManager
provides a facility for adding, removing and looking 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 gtk.RecentManager
acts like a database of all the recently used files. You can create new
gtk.RecentManager
objects, but it is more efficient to use the standard recent manager for
the gtk.gdk.Screen
so that information about the recently used files is shared with other
people using them. In case the default screen is being used, adding a
new recently used file is as simple as:
manager = gtk.recent_manager_get_default()
manager.add_item(file_uri)
While looking up a recently used file is as simple as:
manager = gtk.recent_manager_get_default()
try:
info = manager.lookup_item(file_uri)
except gobject.GError:
print "Could not find the file: ", file_uri
Recently used files are supported since GTK+ 2.10.Constructorgtk.RecentManagergtk.RecentManagerReturns :A newly created gtk.RecentManager
object.This constructor is available in PyGTK 2.10 and above.Creates a new recent manager object. Recent manager objects are
used to handle the list of recently used resources. A gtk.RecentManager
object monitors the recently used resources list, and emits the
"changed" signal each time something inside the list changes.gtk.RecentManager
objects are expansive: be sure to create them only when needed. You
should use the gtk.recent_manager_get_for_screen()
or the gtk.recent_manager_get_default()
functions instead.Methodsgtk.RecentManager.set_screenset_screenscreenscreen :a gtk.gdk.ScreenThis method is available in PyGTK 2.10 and above.Sets the screen for a recent manager; the screen is used to
track the user's currently configured recently used documents
storage.gtk.RecentManager.add_itemadd_itemuriuri :a valid URIReturns :True if the new item was
successfully added to the recently used resources
listThis method is available in PyGTK 2.10 and above.Adds a new resource, pointed by uri, into
the recently used resources list.This method automatically retrieves some of the needed metadata
and sets other metadata to common default values.See the gtk.RecentManager.add_full()
method if you want to explicitly define the metadata for the resource
pointed by uri.gtk.RecentManager.add_fulladd_fullurirecent_datauri :a valid URIrecent_data :a dict containing metadata of the
resourceReturns :True if the new item was
successfully added to the recently used resources
list.This method is available in PyGTK 2.10 and above.Adds a new resource, pointed by uri, into
the recently used resources list, using the metadata specified inside
the dict passed in recent_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 dict, which must contain the MIME type of the resource
pointed by the URI ("mime_type"), the name of the application that is
registering the item ("app_name"), and a command line to be used when
launching the item ("app_exec").Optionally, the recent_data dict might
contain a UTF-8 string to be used when viewing the item instead of the
last component of the URI ("display_name"), a short description of the
item ("description"), whether the item should be considered private -
that is, should be displayed only by the applications that have
registered it("is_private") or a list of the groups that the item
belongs to ("groups").gtk.RecentManager.remove_itemremove_itemuriuri :the URI of the item you wish to removeReturns :True if the item pointed by
uri has been successfully removed by the
recently used resources list.This method is available in PyGTK 2.10 and above.Removes a resource pointed by uri from
the recently used resources list handled by a recent manager. Raises
the gobject.GError when an error occurs.gtk.RecentManager.lookup_itemlookup_itemuriuri :a URIReturns :a gtk.RecentInfo
object containing information about the resource pointed by
uri, or None if the URI
was not registered in the recently used resources
list.Searches for a URI inside the recently used resources list, and
returns a gtk.RecentInfo
object containing information about the resource like its MIME type,
or its display name. Raises the gobject.GError when an error
occurs.gtk.RecentManager.has_itemhas_itemuriuri :a URIReturns :True if the resource was
found.This method is available in PyGTK 2.10 and above.Checks whether there is a recently used resource registered with
uri.gtk.RecentManager.move_itemmove_itemurinew_uriuri :the URI of a recently used resourcenew_uri :the new URI of the recently used resource, or None to
remove the item pointed by uri in the listReturns :True on
success.This method is available in PyGTK 2.10 and above.Changes the location of a recently used resource from
uri to new_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. Raises the gobject.GError when an error occurs.gtk.RecentManager.set_limitset_limitlimitlimit :the maximum number of items to return, or
-1.This method is available in PyGTK 2.10 and above.Sets the maximum number of item that the gtk.RecentManager.get_items()
function should return. If limit is set to -1,
then return all the items.gtk.RecentManager.get_limitget_limitReturns :the number of items to return, or -1 for every
item.This method is available in PyGTK 2.10 and above.Returns the maximum number of items that the gtk.RecentManager.get_items()
method should return.gtk.RecentManager.get_itemsget_itemsReturns :a list of gtk.RecentInfo
objects.This method is available in PyGTK 2.10 and above.Returns the list of recently used resources as gtk.RecentInfo
objects.gtk.RecentManager.purge_itemspurge_itemsReturns :the number of items that have been removed from
the recently used resources list.This method is available in PyGTK 2.10 and above.Purges every item from the recently used resources list. Raises
the gobject.GError when an error occurs.Functionsgtk.recent_manager_get_defaultgtk.recent_manager_get_defaultReturns :A unique gtk.RecentManager
associated with the default screen. This recent manager is
associated to the screen and can be used as long as the screen is
open.This function is available in PyGTK 2.10 and above.Gets the recent manager for the default screen. See the gtk.recent_manager_get_for_screen()
function.gtk.recent_manager_get_for_screengtk.recent_manager_get_for_screenscreenscreen :a gtk.gdk.ScreenReturns :A unique gtk.RecentManager
associated with the given screen. This recent manager is
associated to the with the screen and can be used as long as the
screen is open.This function is available in PyGTK 2.10 and above.Gets the recent manager object associated with
screen; if this function has not previously
been called for the given screen, a new recent manager object will be
created and associated with the screen. Recent manager objects are
fairly expensive to create, so using this function is usually a better
choice than calling the gtk.RecentManager()
constructor and setting the screen yourself; by using this function a
single recent manager object will be shared between users.SignalsThe "changed" gtk.RecentManager Signalcallbackrecent_manageruser_param1...recent_manager :the recent manageruser_param1 :the first user parameter (if any) specified
with the connect()
method... :additional user parameters (if any)This signal is available in GTK+ 2.10 and above.Emitted when the current recently used resources manager changes
its contents.