pub trait IconExt: 'static {
// Required methods
fn equal(&self, icon2: Option<&impl IsA<Icon>>) -> bool;
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
Required Methods§
fn equal(&self, icon2: Option<&impl IsA<Icon>>) -> bool
sourcefn serialize(&self) -> Option<Variant>
fn serialize(&self) -> Option<Variant>
Serializes a Icon
into a glib::Variant
. An equivalent Icon
can be retrieved
back by calling Icon::deserialize()
on the returned value.
As serialization will avoid using raw icon data when possible, it only
makes sense to transfer the glib::Variant
between processes on the same machine,
(as opposed to over the network), and within the same file system namespace.
Returns
a glib::Variant
, or None
when serialization fails. The glib::Variant
will not be floating.
sourcefn to_string(&self) -> Option<GString>
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 Icon::for_string()
to
get self
back from the returned string.
The encoding of the returned string is proprietary to Icon
except
in the following two cases
-
If
self
is aFileIcon
, the returned string is a native path (such as/path/to/my icon.png
) without escaping if theFile
forself
is a native file. If the file is not native, the returned string is the result ofFileExt::uri()
(such assftp://path/to/my
20icon``). -
If
self
is aThemedIcon
with exactly one name and no fallbacks, the encoding is simply the name (such asnetwork-server
).
Returns
An allocated NUL-terminated UTF8 string or
None
if self
can’t be serialized. Use g_free()
to free.