Skip to content

Commit

Permalink
topicons: move icon creation in separate function
Browse files Browse the repository at this point in the history
  • Loading branch information
jonian committed Aug 25, 2018
1 parent 1e2419f commit 97824ce
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions unite@hardpixel.eu/modules/topIcons.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,12 @@ var TopIcons = new Lang.Class({
this._destroyIconsContainer();
},

_addTrayIcon: function (o, icon, role) {
this._icons.push(icon);
_addTrayIcon: function (o, trayIcon, role) {
this._icons.push(trayIcon);

let icon = this._createIcon(trayIcon);
let buttonMask = St.ButtonMask.ONE | St.ButtonMask.TWO | St.ButtonMask.THREE;
let iconContainer = new St.Button({ child: icon, button_mask: buttonMask });
let iconSize = Helpers.scaleSize(20);

icon.connect('destroy', function() {
icon.clear_effects();
Expand All @@ -155,10 +155,6 @@ var TopIcons = new Lang.Class({
this._iconsContainer.actor.show();
this._iconsContainer.container.show();
this._iconsBoxLayout.insert_child_at_index(iconContainer, 0);

icon.reactive = true;
icon.get_parent().set_size(iconSize, iconSize);
icon.set_size(iconSize, iconSize);
},

_removeTrayIcon: function (o, icon) {
Expand All @@ -178,6 +174,15 @@ var TopIcons = new Lang.Class({
}
},

_createIcon: function (icon) {
let size = Helpers.scaleSize(20);

icon.reactive = true;
icon.set_size(size, size);

return icon;
},

_toggle: function() {
this._enabled = this._settings.get_boolean('show-legacy-tray');
this._enabled ? this._activate() : this.destroy();
Expand Down

0 comments on commit 97824ce

Please # to comment.