Merge branch 'master' into my-overlay-design

This commit is contained in:
Marina Zhurakhinskaya 2009-06-22 16:14:55 -04:00
commit c600ebb687

View File

@ -19,14 +19,16 @@ DocInfo.prototype = {
this.name = recentInfo.get_display_name();
this.uri = recentInfo.get_uri();
this.mimeType = recentInfo.get_mime_type();
this._iconPixbuf = Shell.get_thumbnail(this.uri, this.mimeType);
},
getIcon : function(size) {
let icon = new Clutter.Texture();
let iconPixbuf;
if (this._iconPixbuf) {
if (this.uri.match("^file://"))
iconPixbuf = Shell.get_thumbnail(this.uri, this.mimeType);
if (iconPixbuf) {
// We calculate the width and height of the texture so as
// to preserve the aspect ratio of the thumbnail. Because
// the images generated based on thumbnails don't have an
@ -34,10 +36,10 @@ DocInfo.prototype = {
// slightly smaller texture and then create a group around
// it for padding purposes
let scalingFactor = (size - THUMBNAIL_ICON_MARGIN * 2) / Math.max(this._iconPixbuf.get_width(), this._iconPixbuf.get_height());
icon.set_width(Math.ceil(this._iconPixbuf.get_width() * scalingFactor));
icon.set_height(Math.ceil(this._iconPixbuf.get_height() * scalingFactor));
Shell.clutter_texture_set_from_pixbuf(icon, this._iconPixbuf);
let scalingFactor = (size - THUMBNAIL_ICON_MARGIN * 2) / Math.max(iconPixbuf.get_width(), iconPixbuf.get_height());
icon.set_width(Math.ceil(iconPixbuf.get_width() * scalingFactor));
icon.set_height(Math.ceil(iconPixbuf.get_height() * scalingFactor));
Shell.clutter_texture_set_from_pixbuf(icon, iconPixbuf);
let group = new Clutter.Group({ width: size,
height: size });