remoteSearch: support serialized GIcons
Since [1], GIO supports generic serialization and deserialization of a GIcon into a GVariant. This is also implemented by GdkPixbuf and could be used instead of our homegrown code for it. This commit adds support to another 'icon' key in the metas dictionary returned by applications for it. The previous 'gicon' and 'icon-data' keys are still parsed and supported as before, but are now deprecated. [1] https://git.gnome.org/browse/glib/commit/?id=c16f914b40c749b938490a4e10a3c54ec1855c42 https://bugzilla.gnome.org/show_bug.cgi?id=698761
This commit is contained in:
@ -187,7 +187,9 @@ const RemoteSearchProvider = new Lang.Class({
|
||||
|
||||
createIcon: function(size, meta) {
|
||||
let gicon;
|
||||
if (meta['gicon']) {
|
||||
if (meta['icon']) {
|
||||
gicon = Gio.icon_deserialize(meta['icon']);
|
||||
} else if (meta['gicon']) {
|
||||
gicon = Gio.icon_new_for_string(meta['gicon']);
|
||||
} else if (meta['icon-data']) {
|
||||
let [width, height, rowStride, hasAlpha,
|
||||
@ -240,8 +242,12 @@ const RemoteSearchProvider = new Lang.Class({
|
||||
let metas = results[0];
|
||||
let resultMetas = [];
|
||||
for (let i = 0; i < metas.length; i++) {
|
||||
for (let prop in metas[i])
|
||||
metas[i][prop] = metas[i][prop].deep_unpack();
|
||||
for (let prop in metas[i]) {
|
||||
// we can use the serialized icon variant directly
|
||||
if (prop != 'icon')
|
||||
metas[i][prop] = metas[i][prop].deep_unpack();
|
||||
}
|
||||
|
||||
resultMetas.push({ id: metas[i]['id'],
|
||||
name: metas[i]['name'],
|
||||
description: metas[i]['description'],
|
||||
|
Reference in New Issue
Block a user