gtk.recent_manager
Module for [RecentManager] class
Types 3
#GtkRecentManager 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 recently used files list is per user.
The #GtkRecentManager acts like a database of all the recently used files. You can create new #GtkRecentManager objects, but it is more efficient to use the default manager created by GTK+.
Adding a new recently used file is as simple as:
GtkRecentManager *manager;
manager = gtk_recent_manager_get_default ();
gtk_recent_manager_add_item (manager, file_uri);The #GtkRecentManager 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]:
GtkRecentManager *manager;
GtkRecentInfo *info;
GError *error = NULL;
manager = gtk_recent_manager_get_default ();
info = gtk_recent_manager_lookup_item (manager, file_uri, &error);
if (error)
{
g_warning ("Could not find the file: %s", error->message);
g_error_free (error);
}
else
{
// Use the info object
gtk_recent_info_unref (info);
}In order to retrieve the list of recently used files, you can use [gtk.recent_manager.RecentManager.getItems], which returns a list of #GtkRecentInfo-structs.
A #GtkRecentManager is the model used to populate the contents of one, or more #GtkRecentChooser implementations.
Note that the maximum age of the recently used files list is controllable through the #GtkSettings:gtk-recent-files-max-age property.
Recently used files are supported since GTK+ 2.10.
RecentManager self()Returns `this`, for use in `with` statements.RecentManagerGidBuilder builder()Get builder for [gtk.recent_manager.RecentManager] Returns: New builder objectstring filename() @propertyGet `filename` property. Returns: The full path to the file to be used to store and read the recently used resources listgtk.recent_manager.RecentManager getDefault()Gets a unique instance of #GtkRecentManager, that you can share in your application without caring about memory management. Returns: A unique #GtkRecentManager. Do not ref or unref it.bool addFull(string uri, gtk.recent_data.RecentData recentData)Adds a new resource, pointed by uri, into the recently used resources list, using the metadata specified inside the #GtkRecentData-struct passed in recent_data.bool addItem(string uri)Adds a new resource, pointed by uri, into the recently used resources list.gtk.recent_info.RecentInfo[] getItems()Gets the list of recently used resources. Returns: a list of newly allocated #GtkRecentInfo objects. Use [gtk.recent_info.RecentInfo.unref] on each item inside the list, and then free the list itse...bool hasItem(string uri)Checks whether there is a recently used resource registered with uri inside the recent manager.gtk.recent_info.RecentInfo lookupItem(string uri)Searches for a URI inside the recently used resources list, and returns a #GtkRecentInfo-struct containing informations about the resource like its MIME type, or its display name.bool moveItem(string uri, string newUri = null)Changes the location of a recently used resource from uri to new_uri.int purgeItems()Purges every item from the recently used resources list. Returns: the number of items that have been removed from the recently used resources list Throws: [ErrorWrap]bool removeItem(string uri)Removes a resource pointed by uri from the recently used resources list handled by a recent manager.gulong connectChanged(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.recent_manager.RecentManager)))
&& Parameters!T.length < 2)Connect to `Changed` signal.T filename(string propval)Set `filename` property. Params: propval = The full path to the file to be used to store and read the recently used resources list Returns: Builder instance for fluent chainingFluent builder for [gtk.recent_manager.RecentManager]