module Gio::Icon

Overview

#GIcon 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.

#GIcon does not provide the actual pixmap for the icon as this is out of GIO's scope, however implementations of #GIcon may contain the name of an icon (see #GThemedIcon), or the path to an icon (see #GLoadableIcon).

To obtain a hash of a #GIcon, see g_icon_hash().

To check if two #GIcons are equal, see g_icon_equal().

For serializing a #GIcon, use g_icon_serialize() and g_icon_deserialize().

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

If your application or library provides one or more #GIcon implementations you need to ensure that your new implementation also implements #GLoadableIcon. Additionally, you must provide an implementation of g_icon_serialize() that gives a result that is understood by g_icon_deserialize(), yielding one of the built-in icon types.

Direct including types

Defined in:

lib/gi-crystal/src/auto/gio-2.0/icon.cr

Class Method Summary

Instance Method Summary

Class Method Detail

def self.deserialize(value : _) : Gio::Icon? #

def self.g_type : UInt64 #

def self.hash(icon : Pointer(Void)) : UInt32 #

Instance Method Detail

def equal(icon2 : Gio::Icon?) : Bool #

def new_for_string(str : String) : Gio::Icon #

def serialize : GLib::Variant? #

def to_string : String? #

abstract def to_unsafe #