[ Version ( since = "2.20" ) ]
public string? to_string ()

Generates a textual representation of this that can be used for serialization such as when passing this to a different process or saving it to persistent storage.

Use new_for_string to get this back from the returned string.

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

  • If this is a FileIcon, the returned string is a native path (such as `/path/to/my icon.png`) without escaping if the File for this is a native file. If the file is not native, the returned string is the result of get_uri (such as `sftp://path/to/my%20icon.png`).
  • If this is a ThemedIcon with exactly one name and no fallbacks, the encoding is simply the name (such as `network-server`).



a Icon.


An allocated NUL-terminated UTF8 string or null if this can't be serialized. Use g_free to free.