GIcon: add g_icon_[de]serialize()
authorRyan Lortie <desrt@desrt.ca>
Sat, 20 Apr 2013 22:50:21 +0000 (18:50 -0400)
committerRyan Lortie <desrt@desrt.ca>
Sun, 21 Apr 2013 20:31:14 +0000 (16:31 -0400)
commitc16f914b40c749b938490a4e10a3c54ec1855c42
tree6f1e76d356c717105a87119bd9835d4dd80d9601
parent9cc222c0bfc65034143753a64b081b7811ee48f1
GIcon: add g_icon_[de]serialize()

Add support for serialising a GIcon to a GVariant and deserialising the
result back to a GIcon.

This solves a number of problems suffered by the existing to_string()
API, primarily these:

 - not forcing the icon to be a utf8 string means that we can
   efficiently encode a PNG (ie: just give the array of bytes)

 - there is no need to ensure that proper types are loaded before using
   the deserialisation interface.  'Foreign' icon types will probably
   emit a serialised format the deserialises to a GBytesIcon.

We additionally clearly document what is required for being a consumer
or implementation of #GIcon.

Further patches will be required to GdkPixbuf and GVfsIcon to bring
their implementations in line with the new rules (essentially: introduce
implementations of the new serialize() API).

https://bugzilla.gnome.org/show_bug.cgi?id=688820
gio/gbytesicon.c
gio/gemblem.c
gio/gemblemedicon.c
gio/gfileicon.c
gio/gicon.c
gio/gicon.h
gio/gthemedicon.c
gio/gvfs.h
gio/tests/g-icon.c