Gio.Icon

const Gio = imports.gi.Gio;

let icon = new Gio.Icon();
  

Gio.Icon is a very minimal interface for icons. It provides functions for checking the equality of two icons, hashing of icons and serializing an icon to and from strings.

Gio.Icon does not provide the actual pixmap for the icon as this is out of GIO's scope, however implementations of Gio.Icon may contain the name of an icon (see Gio.ThemedIcon), or the path to an icon (see Gio.LoadableIcon).

To obtain a hash of a Gio.Icon, see Gio.icon_hash.

To check if two #GIcons are equal, see Gio.Icon.prototype.equal.

For serializing a Gio.Icon, use Gio.Icon.prototype.serialize and Gio.icon_deserialize.

If you want to consume Gio.Icon (for example, in a toolkit) you must be prepared to handle at least the three following cases: Gio.LoadableIcon, Gio.ThemedIcon and Gio.EmblemedIcon. It may also make sense to have fast-paths for other cases (like handling #GdkPixbuf directly, for example) but all compliant Gio.Icon implementations outside of GIO must implement Gio.LoadableIcon.

If your application or library provides one or more Gio.Icon implementations you need to ensure that your new implementation also implements Gio.LoadableIcon. Additionally, you must provide an implementation of Gio.Icon.prototype.serialize that gives a result that is understood by Gio.icon_deserialize, yielding one of the built-in icon types.

Prerequisites

Icon requires GObject.Object

Known Implementations

Icon is implemented by BytesIcon, Emblem, EmblemedIcon, FileIcon and ThemedIcon