Trait gio::prelude::IconExt

source ·
pub trait IconExt: IsA<Icon> + Sealed + 'static {
    // Provided methods
    fn equal(&self, icon2: Option<&impl IsA<Icon>>) -> bool { ... }
    fn hash(&self) -> u32 { ... }
    fn serialize(&self) -> Option<Variant> { ... }
    fn to_string(&self) -> Option<GString> { ... }
}
Expand description

Trait containing all Icon methods.

§Implementors

BytesIcon, Emblem, EmblemedIcon, FileIcon, Icon, LoadableIcon, ThemedIcon

Provided Methods§

source

fn equal(&self, icon2: Option<&impl IsA<Icon>>) -> bool

source

fn hash(&self) -> u32

source

fn serialize(&self) -> Option<Variant>

Serializes a #GIcon into a #GVariant. An equivalent #GIcon can be retrieved back by calling g_icon_deserialize() on the returned value. As serialization will avoid using raw icon data when possible, it only makes sense to transfer the #GVariant between processes on the same machine, (as opposed to over the network), and within the same file system namespace.

§Returns

a #GVariant, or None when serialization fails. The #GVariant will not be floating.

source

fn to_string(&self) -> Option<GString>

Generates a textual representation of @self that can be used for serialization such as when passing @self to a different process or saving it to persistent storage. Use g_icon_new_for_string() to get @self back from the returned string.

The encoding of the returned string is proprietary to #GIcon except in the following two cases

  • If @self is a #GFileIcon, the returned string is a native path (such as /path/to/my icon.png) without escaping if the #GFile for @self is a native file. If the file is not native, the returned string is the result of g_file_get_uri() (such as sftp://path/to/my20icon``).

  • If @self is a #GThemedIcon with exactly one name and no fallbacks, the encoding is simply the name (such as network-server).

§Returns

An allocated NUL-terminated UTF8 string or None if @self can’t be serialized. Use g_free() to free.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<O: IsA<Icon>> IconExt for O