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
This commit is contained in:
parent
79fc31d29d
commit
97125eb29d
2 changed files with 4 additions and 19 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 ();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue