RecentManager

open class RecentManager(pointer: <Error class: unknown class><<Error class: unknown class>>)

GtkRecentManager 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.

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 method@Gtk.RecentManager.lookup_item:

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 method@Gtk.RecentManager.get_items, which returns a list of struct@Gtk.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.

Skipped during bindings generation

  • method filename: Property has no getter nor setter

  • method size: Property has no getter nor setter

Constructors

Link copied to clipboard
constructor()

Creates a new recent manager object.

constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val gtkRecentManagerPointer: <Error class: unknown class><<Error class: unknown class>>

Functions

Link copied to clipboard
open fun addFull(uri: String, recentData: RecentData): Boolean

Adds a new resource, pointed by @uri, into the recently used resources list, using the metadata specified inside the GtkRecentData passed in @recent_data.

Link copied to clipboard
open fun addItem(uri: String): Boolean

Adds a new resource, pointed by @uri, into the recently used resources list.

Link copied to clipboard
fun connectChanged(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: () -> Unit): <Error class: unknown class>

Emitted when the current recently used resources manager changes its contents.

Link copied to clipboard
open fun getItems(): <Error class: unknown class>

Gets the list of recently used resources.

Link copied to clipboard
open fun hasItem(uri: String): Boolean

Checks whether there is a recently used resource registered with @uri inside the recent manager.

Link copied to clipboard
open fun lookupItem(uri: String): <Error class: unknown class><RecentInfo?>

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.

Link copied to clipboard
open fun moveItem(uri: String, newUri: String? = null): <Error class: unknown class><Boolean>

Changes the location of a recently used resource from @uri to @new_uri.

Link copied to clipboard
open fun purgeItems(): <Error class: unknown class><Int>

Purges every item from the recently used resources list.

Link copied to clipboard
open fun removeItem(uri: String): <Error class: unknown class><Boolean>

Removes a resource pointed by @uri from the recently used resources list handled by a recent manager.