Fix showing small item previews

Don't use a clone of an actor that's not part of the scene graph for the
item previews. This patch fixes previews in the details pane for documents
for which we don't have full previews and for applications.

Use create_icon_texture() from AppInfo instead of looking up the file
for gicon when creating an application icon for the details pane.
This commit is contained in:
Marina Zhurakhinskaya
2009-07-29 17:47:50 -04:00
parent 66e48da7cb
commit f7fff83647
3 changed files with 11 additions and 39 deletions

View File

@ -68,29 +68,9 @@ AppDisplayItem.prototype = {
return this._appInfo.create_icon_texture(GenericDisplay.ITEM_DISPLAY_ICON_SIZE);
},
// Ensures the preview icon is created.
_ensurePreviewIconCreated : function() {
if (!this._showPreview || this._previewIcon)
return;
let gicon = this._appInfo.get_icon();
let previewIconPath = null;
if (gicon) {
let iconTheme = Gtk.IconTheme.get_default();
let previewIconInfo = iconTheme.lookup_by_gicon(gicon, GenericDisplay.PREVIEW_ICON_SIZE, 0);
if (previewIconInfo)
previewIconPath = previewIconInfo.get_filename();
}
if (previewIconPath) {
try {
this._previewIcon = new Clutter.Texture({ width: GenericDisplay.PREVIEW_ICON_SIZE, height: GenericDisplay.PREVIEW_ICON_SIZE});
this._previewIcon.set_from_file(previewIconPath);
} catch (e) {
// we can get an error here if the file path doesn't exist on the system
log('Error loading AppDisplayItem preview icon ' + e);
}
}
// Returns a preview icon for the item.
_createPreviewIcon : function() {
return this._appInfo.create_icon_texture(GenericDisplay.PREVIEW_ICON_SIZE);
}
};