volume: Pick up hasHeadphones from the signal handler
A preliminary patch for big cleanups happening soon. https://bugzilla.gnome.org/show_bug.cgi?id=690539
This commit is contained in:
parent
66da3f5668
commit
1a4948f0f2
@ -33,7 +33,7 @@ const VolumeMenu = new Lang.Class({
|
|||||||
_init: function(control) {
|
_init: function(control) {
|
||||||
this.parent();
|
this.parent();
|
||||||
|
|
||||||
this.hasHeadphones = false;
|
this._hasHeadphones = false;
|
||||||
|
|
||||||
this._control = control;
|
this._control = control;
|
||||||
this._control.connect('state-changed', Lang.bind(this, this._onControlStateChanged));
|
this._control.connect('state-changed', Lang.bind(this, this._onControlStateChanged));
|
||||||
@ -100,8 +100,8 @@ const VolumeMenu = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
_portChanged: function() {
|
_portChanged: function() {
|
||||||
this.hasHeadphones = this._findHeadphones(this._output);
|
this._hasHeadphones = this._findHeadphones(this._output);
|
||||||
this.emit('headphones-changed');
|
this.emit('headphones-changed', this._hasHeadphones);
|
||||||
},
|
},
|
||||||
|
|
||||||
_readOutput: function() {
|
_readOutput: function() {
|
||||||
@ -231,8 +231,8 @@ const Indicator = new Lang.Class({
|
|||||||
this.actor.visible = (icon != null);
|
this.actor.visible = (icon != null);
|
||||||
this.setIcon(icon);
|
this.setIcon(icon);
|
||||||
}));
|
}));
|
||||||
this._volumeMenu.connect('headphones-changed', Lang.bind(this, function() {
|
this._volumeMenu.connect('headphones-changed', Lang.bind(this, function(menu, value) {
|
||||||
this._headphoneIcon.visible = this._volumeMenu.hasHeadphones;
|
this._headphoneIcon.visible = value;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this._headphoneIcon = this.addIcon(new Gio.ThemedIcon({ name: 'headphones-symbolic' }));
|
this._headphoneIcon = this.addIcon(new Gio.ThemedIcon({ name: 'headphones-symbolic' }));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user