GNOME Bugzilla – Bug 686201
[PATCH] Implement g_icon_{to,new_for}_string interface in GdkPixbuf
Last modified: 2013-05-28 22:31:18 UTC
Created attachment 226522 [details] [review] Patch to implement GIcon to/from_tokens interface GdkPixbuf implements the GIcon interface but omits the to/from_tokens methods used by g_icon_to_string() and g_icon_new_for_string(). I recently ran into an API which used these functions to deconstruct an icon, send it over dbus and reconstruct it on the other side, but using GdkPixbufs results in a broken image icon on the other side. This patch uses g_base64_encode/decode to get a string for the serialized pixbuf, which seemed to me like the most straightforward way, but not necessarily the most efficient.
Created attachment 235719 [details] [review] Add test for GIcon serialization
base64 encoding and sending over d-bus as a string is pretty inefficient... I think we should use an approach that allows sending binary data (such as using GVariants directly). Also: we should be able to deserialize without having gdk-pixbuf (since having some format that can be deserialized only under some circumstances is pretty annoying). See also bug 688820.
Looks like this is fixed by bug 688820