Use St.Icon for named icons

Switch from St.TextureCache.load_named_icon() to using St.Icon for named
icons. Along with the advantage of getting colorization right for symbolic
icons, this allows moving some icon sizes into the CSS.

In the CSS, the system status icon size is changed to be 1em (=16px for the
default font size), at the request of the artists. See bug 613448.

https://bugzilla.gnome.org/show_bug.cgi?id=633865
This commit is contained in:
Owen W. Taylor
2010-11-02 18:33:22 -04:00
parent af7ba00e97
commit 0e3431ac47
9 changed files with 39 additions and 25 deletions

View File

@ -566,22 +566,16 @@ PopupImageMenuItem.prototype = {
_init: function (text, iconName) {
PopupBaseMenuItem.prototype._init.call(this);
this._size = 16;
this.label = new St.Label({ text: text });
this.addActor(this.label);
this._imageBin = new St.Bin({ width: this._size, height: this._size });
this.addActor(this._imageBin);
this._icon = new St.Icon({ style_class: 'popup-menu-icon' });
this.addActor(this._icon);
this.setIcon(iconName);
},
setIcon: function(name) {
if (this._imageBin.child)
this._imageBin.child.destroy();
let img = St.TextureCache.get_default().load_icon_name(name, St.IconType.SYMBOLIC, this._size);
this._imageBin.set_child(img);
this._icon.icon_name = name;
}
};