Class: Gtk::RecentManager

Inherits:
Object
  • Object
show all
Extended by:
GLib::Deprecatable
Defined in:
lib/gtk4/deprecated.rb

Overview

GtkRecentManagerClass contains only private data.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeGtk::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 [signalGtk.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 [funcGtk.RecentManager.get_default] instead.

Class Method Details

.defaultGtk::RecentManager

Gets a unique instance of GtkRecentManager that you can share in your application without caring about memory management.

Returns:

Instance Method Details

#add_full(uri, recent_data) ⇒ 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.

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.

Parameters:

  • uri (String)

    a valid URI

  • recent_data (Gtk::RecentData)

    metadata of the resource

Returns:

  • (Boolean)

    true if the new item was successfully added to the recently used resources list, false otherwise

#add_item(uri) ⇒ Boolean

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 [methodGtk.RecentManager.add_full].

See [methodGtk.RecentManager.add_full] if you want to explicitly define the metadata for the resource pointed by uri.

Parameters:

  • uri (String)

    a valid URI

Returns:

  • (Boolean)

    true if the new item was successfully added to the recently used resources list

#filenameString

The full path to the file to be used to store and read the recently used resources list

Returns:

  • (String)

    filename

#filename=(filename) ⇒ String

The full path to the file to be used to store and read the recently used resources list

Parameters:

  • filename (String)

Returns:

  • (String)

    filename

  • (String)

    filename

#has_item(uri) ⇒ Boolean

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

Parameters:

  • uri (String)

    a URI

Returns:

  • (Boolean)

    true if the resource was found, false otherwise

#itemsGLib::List<Gtk::RecentInfo>

Gets the list of recently used resources.

Returns:

  • (GLib::List<Gtk::RecentInfo>)

    a list of newly allocated GtkRecentInfo objects. Use [methodGtk.RecentInfo.unref] on each item inside the list, and then free the list itself using g_list_free().

#lookup_item(uri) ⇒ Gtk::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.

Parameters:

  • uri (String)

    a URI

Returns:

  • (Gtk::RecentInfo)

    a GtkRecentInfo containing information about the resource pointed by uri, or nil if the URI was not registered in the recently used resources list. Free with [methodGtk.RecentInfo.unref].

#move_item(uri, new_uri) ⇒ Boolean

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.

Parameters:

  • uri (String)

    the URI of a recently used resource

  • new_uri (String)

    the new URI of the recently used resource, or nil to remove the item pointed by uri in the list

Returns:

  • (Boolean)

    true on success

#purge_itemsInteger

Purges every item from the recently used resources list.

Returns:

  • (Integer)

    the number of items that have been removed from the recently used resources list

#remove_item(uri) ⇒ Boolean

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

Parameters:

  • uri (String)

    the URI of the item you wish to remove

Returns:

  • (Boolean)

    true if the item pointed by uri has been successfully removed by the recently used resources list, and false otherwise

#sizeInteger

The size of the recently used resources list.

Returns:

  • (Integer)

    size

#size=(size) ⇒ Integer

The size of the recently used resources list.

Parameters:

  • size (Integer)

Returns:

  • (Integer)

    size

  • (Integer)

    size