volume: Don't have a separate syncVisibility method

With it doing less now, we can simply do it inline.

https://bugzilla.gnome.org/show_bug.cgi?id=690539
This commit is contained in:
Jasper St. Pierre 2012-12-19 22:46:11 -05:00
parent 9ebeb64570
commit 66da3f5668

View File

@ -228,12 +228,11 @@ const Indicator = new Lang.Class({
this._volumeMenu = new VolumeMenu(this._control); this._volumeMenu = new VolumeMenu(this._control);
this._volumeMenu.connect('icon-changed', Lang.bind(this, function(menu) { this._volumeMenu.connect('icon-changed', Lang.bind(this, function(menu) {
let icon = this._volumeMenu.getIcon(); let icon = this._volumeMenu.getIcon();
this._hasPulseAudio = icon != null; this.actor.visible = (icon != null);
this.setIcon(icon); this.setIcon(icon);
this._syncVisibility();
})); }));
this._volumeMenu.connect('headphones-changed', Lang.bind(this, function() { this._volumeMenu.connect('headphones-changed', Lang.bind(this, function() {
this._syncVisibility(); this._headphoneIcon.visible = this._volumeMenu.hasHeadphones;
})); }));
this._headphoneIcon = this.addIcon(new Gio.ThemedIcon({ name: 'headphones-symbolic' })); this._headphoneIcon = this.addIcon(new Gio.ThemedIcon({ name: 'headphones-symbolic' }));
@ -247,11 +246,6 @@ const Indicator = new Lang.Class({
this.actor.connect('scroll-event', Lang.bind(this, this._onScrollEvent)); this.actor.connect('scroll-event', Lang.bind(this, this._onScrollEvent));
}, },
_syncVisibility: function() {
this.actor.visible = this._hasPulseAudio;
this._headphoneIcon.visible = this._volumeMenu.hasHeadphones;
},
_onScrollEvent: function(actor, event) { _onScrollEvent: function(actor, event) {
this._volumeMenu.scroll(event); this._volumeMenu.scroll(event);
} }