After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 686201 - [PATCH] Implement g_icon_{to,new_for}_string interface in GdkPixbuf
[PATCH] Implement g_icon_{to,new_for}_string interface in GdkPixbuf
Product: gdk-pixbuf
Classification: Platform
Component: general
git master
Other Linux
: Normal enhancement
: ---
Assigned To: gdk-pixbuf-maint
Depends on:
Reported: 2012-10-16 04:03 UTC by Jason Conti
Modified: 2013-05-28 22:31 UTC
See Also:
GNOME target: ---
GNOME version: ---

Patch to implement GIcon to/from_tokens interface (3.49 KB, patch)
2012-10-16 04:03 UTC, Jason Conti
none Details | Review
Add test for GIcon serialization (2.17 KB, patch)
2013-02-11 17:05 UTC, Lars Karlitski
none Details | Review

Description Jason Conti 2012-10-16 04:03:34 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.
Comment 1 Lars Karlitski 2013-02-11 17:05:53 UTC
Created attachment 235719 [details] [review]
Add test for GIcon serialization
Comment 2 Allison Karlitskaya (desrt) 2013-02-26 19:40:46 UTC
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.
Comment 3 Jason Conti 2013-05-28 22:31:18 UTC
Looks like this is fixed by bug 688820