NMDeviceWired: don't unconditionally access device.active_connection
The active_connection might be null, but the NMApplet code might still belive the device wrapper is the primary connection (because dbus signals are emitted one after the other). (Also, remove an old and wrong comment about bluetooth in wwan code) Fixes: (gnome-shell:22511): Gjs-WARNING **: JS ERROR: Exception in callback for signal: icon-changed: TypeError: this._device.active_connection is null NMDeviceWired<.getIndicatorIcon@resource:///org/gnome/shell/ui/status/network.js:475 wrapper@resource:///org/gnome/gjs/modules/lang.js:169 NMApplet<._updateIcon@resource:///org/gnome/shell/ui/status/network.js:1790 wrapper@resource:///org/gnome/gjs/modules/lang.js:169 _emit@resource:///org/gnome/gjs/modules/signals.js:124 NMConnectionSection<._addConnection/<@resource:///org/gnome/shell/ui/status/network.js:265 _emit@resource:///org/gnome/gjs/modules/signals.js:124 NMConnectionItem<._sync@resource:///org/gnome/shell/ui/status/network.js:137 wrapper@resource:///org/gnome/gjs/modules/lang.js:169 NMConnectionItem<.setActiveConnection@resource:///org/gnome/shell/ui/status/network.js:169 wrapper@resource:///org/gnome/gjs/modules/lang.js:169 NMConnectionDevice<._activeConnectionChanged@resource:///org/gnome/shell/ui/status/network.js:327 wrapper@resource:///org/gnome/gjs/modules/lang.js:169 https://bugzilla.gnome.org/show_bug.cgi?id=723570
This commit is contained in:
parent
fff2ca6f26
commit
bde1451896
@ -213,6 +213,10 @@ const NMConnectionSection = new Lang.Class({
|
|||||||
this.item.label.text = '';
|
this.item.label.text = '';
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_getMenuIcon: function() {
|
||||||
|
return this.getIndicatorIcon();
|
||||||
|
},
|
||||||
|
|
||||||
_getStatus: function() {
|
_getStatus: function() {
|
||||||
let values = this._connectionItems.values();
|
let values = this._connectionItems.values();
|
||||||
for (let item of values) {
|
for (let item of values) {
|
||||||
@ -448,20 +452,17 @@ const NMDeviceWired = new Lang.Class({
|
|||||||
this.parent();
|
this.parent();
|
||||||
},
|
},
|
||||||
|
|
||||||
_getMenuIcon: function() {
|
|
||||||
if (this._device.active_connection)
|
|
||||||
return this.getIndicatorIcon();
|
|
||||||
else
|
|
||||||
return 'network-wired-disconnected-symbolic';
|
|
||||||
},
|
|
||||||
|
|
||||||
getIndicatorIcon: function() {
|
getIndicatorIcon: function() {
|
||||||
let state = this._device.active_connection.state;
|
if (this._device.active_connection) {
|
||||||
if (state == NetworkManager.ActiveConnectionState.ACTIVATING)
|
let state = this._device.active_connection.state;
|
||||||
return 'network-wired-acquiring-symbolic';
|
|
||||||
else if (state == NetworkManager.ActiveConnectionState.ACTIVATED)
|
if (state == NetworkManager.ActiveConnectionState.ACTIVATING)
|
||||||
return 'network-wired-symbolic';
|
return 'network-wired-acquiring-symbolic';
|
||||||
else
|
else if (state == NetworkManager.ActiveConnectionState.ACTIVATED)
|
||||||
|
return 'network-wired-symbolic';
|
||||||
|
else
|
||||||
|
return 'network-wired-disconnected-symbolic';
|
||||||
|
} else
|
||||||
return 'network-wired-disconnected-symbolic';
|
return 'network-wired-disconnected-symbolic';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -528,28 +529,20 @@ const NMDeviceModem = new Lang.Class({
|
|||||||
return this.parent();
|
return this.parent();
|
||||||
},
|
},
|
||||||
|
|
||||||
_getMenuIcon: function() {
|
getIndicatorIcon: function() {
|
||||||
if (this._device.active_connection)
|
if (this._device.active_connection) {
|
||||||
return this.getIndicatorIcon();
|
if (this._device.active_connection.state == NetworkManager.ActiveConnectionState.ACTIVATING)
|
||||||
else
|
return 'network-cellular-acquiring-symbolic';
|
||||||
|
|
||||||
|
return this._getSignalIcon();
|
||||||
|
} else {
|
||||||
return 'network-cellular-signal-none-symbolic';
|
return 'network-cellular-signal-none-symbolic';
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_getSignalIcon: function() {
|
_getSignalIcon: function() {
|
||||||
return 'network-cellular-signal-' + signalToIcon(this._mobileDevice.signal_quality) + '-symbolic';
|
return 'network-cellular-signal-' + signalToIcon(this._mobileDevice.signal_quality) + '-symbolic';
|
||||||
},
|
},
|
||||||
|
|
||||||
getIndicatorIcon: function() {
|
|
||||||
if (this._device.active_connection.state == NetworkManager.ActiveConnectionState.ACTIVATING)
|
|
||||||
return 'network-cellular-acquiring-symbolic';
|
|
||||||
|
|
||||||
if (!this._mobileDevice) {
|
|
||||||
// this can happen for bluetooth in PAN mode
|
|
||||||
return 'network-cellular-connected-symbolic';
|
|
||||||
}
|
|
||||||
|
|
||||||
return this._getSignalIcon();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const NMDeviceBluetooth = new Lang.Class({
|
const NMDeviceBluetooth = new Lang.Class({
|
||||||
@ -563,13 +556,6 @@ const NMDeviceBluetooth = new Lang.Class({
|
|||||||
this.item.menu.addMenuItem(createSettingsAction(_("Mobile Broadband Settings"), device));
|
this.item.menu.addMenuItem(createSettingsAction(_("Mobile Broadband Settings"), device));
|
||||||
},
|
},
|
||||||
|
|
||||||
_getMenuIcon: function() {
|
|
||||||
if (this._device.active_connection)
|
|
||||||
return this.getIndicatorIcon();
|
|
||||||
else
|
|
||||||
return 'network-cellular-signal-none-symbolic';
|
|
||||||
},
|
|
||||||
|
|
||||||
_getDescription: function() {
|
_getDescription: function() {
|
||||||
return this._device.name;
|
return this._device.name;
|
||||||
},
|
},
|
||||||
@ -579,13 +565,17 @@ const NMDeviceBluetooth = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
getIndicatorIcon: function() {
|
getIndicatorIcon: function() {
|
||||||
let state = this._device.active_connection.state;
|
if (this._device.active_connection) {
|
||||||
if (state == NetworkManager.ActiveConnectionState.ACTIVATING)
|
let state = this._device.active_connection.state;
|
||||||
return 'network-cellular-acquiring-symbolic';
|
if (state == NetworkManager.ActiveConnectionState.ACTIVATING)
|
||||||
else if (state == NetworkManager.ActiveConnectionState.ACTIVATED)
|
return 'network-cellular-acquiring-symbolic';
|
||||||
return 'network-cellular-connected-symbolic';
|
else if (state == NetworkManager.ActiveConnectionState.ACTIVATED)
|
||||||
else
|
return 'network-cellular-connected-symbolic';
|
||||||
|
else
|
||||||
|
return 'network-cellular-signal-none-symbolic';
|
||||||
|
} else {
|
||||||
return 'network-cellular-signal-none-symbolic';
|
return 'network-cellular-signal-none-symbolic';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1242,8 +1232,9 @@ const NMDeviceWireless = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
getIndicatorIcon: function() {
|
getIndicatorIcon: function() {
|
||||||
if (this._device.state >= NetworkManager.DeviceState.PREPARE &&
|
if (this._device.state < NetworkManager.DeviceState.PREPARE)
|
||||||
this._device.state < NetworkManager.DeviceState.ACTIVATED)
|
return 'network-wireless-disconnected-symbolic';
|
||||||
|
if (this._device.state < NetworkManager.DeviceState.ACTIVATED)
|
||||||
return 'network-wireless-acquiring-symbolic';
|
return 'network-wireless-acquiring-symbolic';
|
||||||
|
|
||||||
let ap = this._device.active_access_point;
|
let ap = this._device.active_access_point;
|
||||||
|
Loading…
Reference in New Issue
Block a user