panelMenu: Show/hide the indicators box based on indicator visibility
This ensures that there's no empty space in the indicators box, and we don't have to manage it manually. https://bugzilla.gnome.org/show_bug.cgi?id=705845
This commit is contained in:
parent
54bec54765
commit
4ba6791043
@ -241,13 +241,22 @@ const SystemIndicator = new Lang.Class({
|
|||||||
_init: function() {
|
_init: function() {
|
||||||
this.indicators = new St.BoxLayout({ style_class: 'panel-status-indicators-box',
|
this.indicators = new St.BoxLayout({ style_class: 'panel-status-indicators-box',
|
||||||
reactive: true });
|
reactive: true });
|
||||||
|
this.indicators.hide();
|
||||||
this.menu = new PopupMenu.PopupMenuSection();
|
this.menu = new PopupMenu.PopupMenuSection();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_syncIndicatorsVisible: function() {
|
||||||
|
this.indicators.visible = this.indicators.get_children().some(function(actor) {
|
||||||
|
return actor.visible;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
addIndicator: function(gicon) {
|
addIndicator: function(gicon) {
|
||||||
let icon = new St.Icon({ gicon: gicon,
|
let icon = new St.Icon({ gicon: gicon,
|
||||||
style_class: 'system-status-icon' });
|
style_class: 'system-status-icon' });
|
||||||
this.indicators.add_actor(icon);
|
this.indicators.add_actor(icon);
|
||||||
|
icon.connect('notify::visible', Lang.bind(this, this._syncIndicatorsVisible));
|
||||||
|
this._syncIndicatorsVisible();
|
||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user