Skip to content

Commit

Permalink
Cache icon names and tooltips, to avoid changing them unnecessarily.
Browse files Browse the repository at this point in the history
  • Loading branch information
autarkper committed Sep 25, 2012
1 parent c698084 commit a84d5fb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions js/ui/applet.js
Expand Up @@ -169,8 +169,10 @@ Applet.prototype = {
},

set_applet_tooltip: function (text) {
this._applet_tooltip_text = text;
this._applet_tooltip.set_text(text);
if (this._applet_tooltip_text !== text) {
this._applet_tooltip.set_text(text);
this._applet_tooltip_text = text;
}
},

on_applet_clicked: function(event) {
Expand Down Expand Up @@ -281,6 +283,10 @@ IconApplet.prototype = {
},

set_applet_icon_symbolic_name: function (icon_name) {
if (this.__icon_name === icon_name) {
return;
}

if (this._scaleMode) {
let height = (this._panelHeight / DEFAULT_PANEL_HEIGHT) * PANEL_SYMBOLIC_ICON_DEFAULT_HEIGHT;
this._applet_icon = new St.Icon({icon_name: icon_name, icon_size: height, icon_type: St.IconType.SYMBOLIC, reactive: true, track_hover: true, style_class: 'system-status-icon' });
Expand Down

0 comments on commit a84d5fb

Please sign in to comment.