diff options
author | David King <dking@redhat.com> | 2015-10-05 16:09:38 -0400 |
---|---|---|
committer | David King <amigadave@amigadave.com> | 2015-10-06 23:57:09 -0400 |
commit | 97125eb29dba7cf1f9c844da1f3e3531c31de5cd (patch) | |
tree | 9b544349c132eeab7c251c35b961e9c9d4d03326 /src | |
parent | 79fc31d29dcff45e9c0089eaa2b6becb1ec6f775 (diff) | |
download | gnome-contacts-97125eb29dba7cf1f9c844da1f3e3531c31de5cd.tar.gz |
Simplify search provider icon passing
Avoid a Vala bug (GNOME Bugzilla #756090) by passing a serialized GIcon
to the shell in the search provider. As a bonus, remove the old code,
which serialized a GdkPixbuf to a string (or passed it over D-Bus as a
bytestring).
https://bugzilla.redhat.com/show_bug.cgi?id=1244256
https://bugzilla.gnome.org/show_bug.cgi?id=756098
Diffstat (limited to 'src')
-rw-r--r-- | src/contacts-contact.vala | 15 | ||||
-rw-r--r-- | src/contacts-shell-search-provider.vala | 8 |
2 files changed, 4 insertions, 19 deletions
diff --git a/src/contacts-contact.vala b/src/contacts-contact.vala index edbe7ae..042f827 100644 --- a/src/contacts-contact.vala +++ b/src/contacts-contact.vala @@ -161,25 +161,12 @@ public class Contacts.Contact : GLib.Object { if (individual.avatar == null) return null; - if (individual.avatar.to_string () != null) - return null; - if (_avatar_icon_data == null) { if (small_avatar == null) return null; - var pixel_data = Variant.new_from_data (VariantType.BYTESTRING, - small_avatar.get_pixels_with_length (), - true, small_avatar); - _avatar_icon_data = new Variant ("(iiibii@ay)", - small_avatar.get_width (), - small_avatar.get_height (), - small_avatar.get_rowstride (), - small_avatar.get_has_alpha (), - small_avatar.get_bits_per_sample (), - small_avatar.get_n_channels (), - pixel_data); + _avatar_icon_data = small_avatar.serialize (); } return _avatar_icon_data; } diff --git a/src/contacts-shell-search-provider.vala b/src/contacts-shell-search-provider.vala index 53a00dd..c47318a 100644 --- a/src/contacts-shell-search-provider.vala +++ b/src/contacts-shell-search-provider.vala @@ -96,12 +96,10 @@ public class Contacts.SearchProvider : Object { meta.insert ("name", new Variant.string (contact.display_name)); - if (contact.serializable_avatar_icon != null) - meta.insert ("gicon", new Variant.string (contact.serializable_avatar_icon.to_string ())); - else if (contact.avatar_icon_data != null) - meta.insert ("icon-data", contact.avatar_icon_data); + if (contact.avatar_icon_data != null) + meta.insert ("icon", contact.avatar_icon_data); else - meta.insert ("gicon", new Variant.string (new ThemedIcon ("avatar-default").to_string ())); + meta.insert ("icon", new ThemedIcon ("avatar-default").serialize ()); results.add (meta); } app.release (); |