RecentManagerRef

public struct RecentManagerRef : RecentManagerProtocol, GWeakCapturing

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:

(C Language Example):

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_lookup_item():

(C Language Example):

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_get_items(), 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.

The RecentManagerRef type acts as a lightweight Swift reference to an underlying GtkRecentManager instance. It exposes methods that can operate on this data type through RecentManagerProtocol conformance. Use RecentManagerRef only as an unowned reference to an existing GtkRecentManager instance.

  • ptr
    Untyped pointer to the underlying `GtkRecentManager` instance.
    

    For type-safe access, use the generated, typed pointer recent_manager_ptr property instead.

    Declaration

    Swift

    public let ptr: UnsafeMutableRawPointer!

RecentManager Class

  • Designated initialiser from the underlying C data type

    Declaration

    Swift

    @inlinable
    init(_ p: UnsafeMutablePointer<GtkRecentManager>)
  • Designated initialiser from a constant pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init(_ p: UnsafePointer<GtkRecentManager>)
  • Conditional initialiser from an optional pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init!(_ maybePointer: UnsafeMutablePointer<GtkRecentManager>?)
  • Conditional initialiser from an optional, non-mutable pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init!(_ maybePointer: UnsafePointer<GtkRecentManager>?)
  • Conditional initialiser from an optional gpointer

    Declaration

    Swift

    @inlinable
    init!(gpointer g: gpointer?)
  • Conditional initialiser from an optional, non-mutable gconstpointer

    Declaration

    Swift

    @inlinable
    init!(gconstpointer g: gconstpointer?)
  • Reference intialiser for a related type that implements RecentManagerProtocol

    Declaration

    Swift

    @inlinable
    init<T>(_ other: T) where T : RecentManagerProtocol
  • This factory is syntactic sugar for setting weak pointers wrapped in GWeak<T>

    Declaration

    Swift

    @inlinable
    static func unowned<T>(_ other: T) -> RecentManagerRef where T : RecentManagerProtocol
  • Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to RecentManagerProtocol.

    Declaration

    Swift

    @inlinable
    init<T>(cPointer: UnsafeMutablePointer<T>)
  • Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to RecentManagerProtocol.

    Declaration

    Swift

    @inlinable
    init<T>(constPointer: UnsafePointer<T>)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to RecentManagerProtocol.

    Declaration

    Swift

    @inlinable
    init(mutating raw: UnsafeRawPointer)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to RecentManagerProtocol.

    Declaration

    Swift

    @inlinable
    init(raw: UnsafeMutableRawPointer)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to RecentManagerProtocol.

    Declaration

    Swift

    @inlinable
    init(opaquePointer: OpaquePointer)
  • Creates a new recent manager object. Recent manager objects are used to
    

    handle the list of recently used resources. A GtkRecentManager object monitors the recently used resources list, and emits the “changed” signal each time something inside the list changes.

    GtkRecentManager objects are expensive: be sure to create them only when needed. You should use gtk_recent_manager_get_default() instead.

    Declaration

    Swift

    @inlinable
    init()
  • Gets a unique instance of GtkRecentManager, that you can share in your application without caring about memory management.

    Declaration

    Swift

    @inlinable
    static func getDefault() -> RecentManagerRef!