Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: RecentManagerMeta

[386:14] static extends: object

Generated metadata helpers for RecentManager class surfaces.

Methods

  • properties ()

    Returns property metadata for RecentManager.

    • @r A list.
  • signals ()

    Returns signal metadata for RecentManager.

    • @r A list.

class: RecentManager

[34:7] extends: object

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: c 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]: c 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.

Members

  • handleObj
  • lib
  • retainedCallbacks
  • signalHandlerNames
  • signalSetterHandlers

Methods

  • RecentManager ()

    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 [signal@Gtk.RecentManager::changed] signal each time something inside the list changes. GtkRecentManager objects are expensive: be sure to create them only when needed. You should use [func@Gtk.RecentManager.get_default] instead.

  • toNativeHandle (Source)

    Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from fn.call(...), another generated wrapper exposing handle(), or null. Returns null when the argument carries no pointer.

    • @p Source is the raw handle, raw buffer, wrapper, or null.
    • @r A raw pointer carrier or null when no pointer is present.
  • getLib ()

    Returns the opened native library for this generated wrapper.

    • @r The opened native library.
  • handle ()

    Returns the wrapped NativeHandle.

    • @r The wrapped NativeHandle.
  • isNull ()

    Returns true when the wrapped handle is null.

    • @r A bool.
  • describe ()

    Returns a small string for debugging generated wrappers.

    • @r A string.
  • asObject ()

    Wraps this handle as Object.

    • @r A Object object.
  • connectSignal (string Name, CallbackObj)

    Connects one generated callback wrapper to a named signal.

    • @p Name is the signal name.
    • @p CallbackObj is the generated callback wrapper to connect.
    • @r The connected handler id.
  • disconnectSignalHandler (int HandlerId)

    Disconnects one retained signal handler id.

    • @p HandlerId is the signal handler id to disconnect.
    • @r None.
  • setOnChanged (callback Fn, UserData = null)

    Emitted when the current recently used resources manager changes its contents. This can happen either by calling [method@Gtk.RecentManager.add_item] or by another application.

    • @p Fn is the Aussom callback.
    • @p Fn is called with (RecentManager Self).
    • @p UserData is retained and passed through to the generated callback wrapper when provided.
    • @r The connected handler id.
  • add_full (string uri, object recent_data)

    Adds a new resource, pointed by @uri, into the recently used resources list, using the metadata specified inside the GtkRecentData 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 GtkRecentData, which must contain the MIME type of the resource pointed by the URI; the name of the application that is registering the item, and a command line to be used when launching the item. Optionally, a GtkRecentData might contain a UTF-8 string to be used when viewing the item instead of the last component of the URI; a short description of the item; whether the item should be considered private - that is, should be displayed only by the applications that have registered it.
    • @p uri is a valid URI.
    • @p recent_data is metadata of the resource.
  • add_item (string uri)

    Adds a new resource, pointed by @uri, into the recently used resources list. This function automatically retrieves some of the needed metadata and setting other metadata to common default values; it then feeds the data to [method@Gtk.RecentManager.add_full]. See [method@Gtk.RecentManager.add_full] if you want to explicitly define the metadata for the resource pointed by @uri.

    • @p uri is a valid URI.
  • get_items ()

    Gets the list of recently used resources.

  • has_item (string uri)

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

    • @p uri is a URI.
  • lookup_item (string uri)

    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.

    • @p uri is a URI.
  • move_item (string uri, string new_uri)

    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.

    • @p uri is the URI of a recently used resource.
    • @p new_uri is the new URI of the recently used resource, or %NULL to remove the item pointed by @uri in the list.
  • purge_items ()

    Purges every item from the recently used resources list.

  • remove_item (string uri)

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

    • @p uri is the URI of the item you wish to remove.
  • items ()

    Returns get_items as an Aussom list of wrapper objects. This companion method materializes the full collection up front; use get_items() when lazy or change-notify access is required.

    • @r An Aussom list of elements.

class: RecentManagerChangedCallback

[316:7] extends: object

Generated low-level callback wrapper for GIR callback changed.

Members

  • callbackObj
  • userFn
  • userData
  • hasUserData

Methods

  • RecentManagerChangedCallback (callback Fn, UserData = null)

    Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking Fn.

    • @p Fn is the Aussom callback implementation.
    • @p UserData is retained and passed through to Fn on each invocation when provided.
  • trampoline (nativeSelf, nativeUserData)

    Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.

  • callback ()

    Returns the wrapped NativeCallback.

  • handle ()

    Returns the callback as a NativeHandle.

  • close ()

    Closes the underlying NativeCallback.

  • isClosed ()

    Returns true when the callback has been closed.