gtk.RecentManager — manages recently used files (new in PyGTK 2.10)
class gtk.RecentManager(gobject.GObject): |
Functions |
|
gobject.GObject Signal Prototypes
"changed | def callback(recent_manager, user_param1, ...) |
gtk.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.
|
Returns : | 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.
|
screen : | a gtk.gdk.Screen |
This 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.
|
uri : | a valid URI |
Returns : | 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.
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.
|
uri : | a valid URI |
recent_data : | a dict containing metadata of the resource |
Returns : | 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").
|
uri : | the URI of the item you wish to remove |
Returns : | 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.
|
uri : | a URI |
Returns : | 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.
|
uri : | a URI |
Returns : | 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.
|
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 by uri in the list |
Returns : | 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.
|
limit : | 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.
|
Returns : | 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.
|
Returns : | 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.
|
Returns : | 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.
|
screen : | a gtk.gdk.Screen |
Returns : | 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.
|
recent_manager : | the recent manager |
user_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.