remoteSearch: Use GIcon for loading icon data

This removes us from caching the pixbuf data in the icon cache,
and allows us to remove St.TextureCache.load_from_raw().

https://bugzilla.gnome.org/show_bug.cgi?id=691019
This commit is contained in:
Jasper St. Pierre 2013-01-02 09:31:50 -05:00
parent 73388f30fd
commit 4288761235

View File

@ -4,6 +4,7 @@ const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib; const GLib = imports.gi.GLib;
const Lang = imports.lang; const Lang = imports.lang;
const St = imports.gi.St; const St = imports.gi.St;
const Shell = imports.gi.Shell;
const FileUtils = imports.misc.fileUtils; const FileUtils = imports.misc.fileUtils;
const Search = imports.ui.search; const Search = imports.ui.search;
@ -187,18 +188,18 @@ const RemoteSearchProvider = new Lang.Class({
}, },
createIcon: function(size, meta) { createIcon: function(size, meta) {
let gicon;
if (meta['gicon']) { if (meta['gicon']) {
return new St.Icon({ gicon: Gio.icon_new_for_string(meta['gicon']), gicon = Gio.icon_new_for_string(meta['gicon']);
icon_size: size });
} else if (meta['icon-data']) { } else if (meta['icon-data']) {
let [width, height, rowStride, hasAlpha, let [width, height, rowStride, hasAlpha,
bitsPerSample, nChannels, data] = meta['icon-data']; bitsPerSample, nChannels, data] = meta['icon-data'];
let textureCache = St.TextureCache.get_default(); gicon = Shell.util_create_pixbuf_from_data(data, GdkPixbuf.Colorspace.RGB, hasAlpha,
return textureCache.load_from_raw(data, hasAlpha, bitsPerSample, width, height, rowStride);
width, height, rowStride, size);
} }
return null; return new St.Icon({ gicon: Gio.icon_new_for_string(meta['gicon']),
icon_size: size });
}, },
_getResultsFinished: function(results, error) { _getResultsFinished: function(results, error) {