NetworkStatus: ignore invalid and unsupported connection types
Some connection types (like wimax) are not supported by the menu, and should be ignored instead of throwing exceptions. Also, NetworkManager had a bug that sent connections with invalid settings. This should not happen, but in case it does, we will not blow up, but just log a warning and continue silently. https://bugzilla.gnome.org/show_bug.cgi?id=646355
This commit is contained in:
parent
38bcd52065
commit
20f1457d15
@ -22,6 +22,7 @@ const Gettext = imports.gettext.domain('gnome-shell');
|
|||||||
const _ = Gettext.gettext;
|
const _ = Gettext.gettext;
|
||||||
|
|
||||||
const NMConnectionCategory = {
|
const NMConnectionCategory = {
|
||||||
|
INVALID: 'invalid',
|
||||||
WIRED: 'wired',
|
WIRED: 'wired',
|
||||||
WIRELESS: 'wireless',
|
WIRELESS: 'wireless',
|
||||||
WWAN: 'wwan',
|
WWAN: 'wwan',
|
||||||
@ -1928,11 +1929,12 @@ NMApplet.prototype = {
|
|||||||
this._connections.splice(connection);
|
this._connections.splice(connection);
|
||||||
|
|
||||||
let section = connection._section;
|
let section = connection._section;
|
||||||
|
|
||||||
if (section == NMConnectionCategory.VPN) {
|
if (section == NMConnectionCategory.VPN) {
|
||||||
this._devices.vpn.device.removeConnection(connection);
|
this._devices.vpn.device.removeConnection(connection);
|
||||||
if (this._devices.vpn.device.empty)
|
if (this._devices.vpn.device.empty)
|
||||||
this._devices.vpn.section.actor.hide();
|
this._devices.vpn.section.actor.hide();
|
||||||
} else {
|
} else if (section != NMConnectionCategory.INVALID) {
|
||||||
let devices = this._devices[section].devices;
|
let devices = this._devices[section].devices;
|
||||||
for (let i = 0; i < devices.length; i++)
|
for (let i = 0; i < devices.length; i++)
|
||||||
devices[i].removeConnection(connection);
|
devices[i].removeConnection(connection);
|
||||||
@ -1946,16 +1948,19 @@ NMApplet.prototype = {
|
|||||||
_updateConnection: function(connection) {
|
_updateConnection: function(connection) {
|
||||||
let connectionSettings = connection.get_setting_by_name(NetworkManager.SETTING_CONNECTION_SETTING_NAME);
|
let connectionSettings = connection.get_setting_by_name(NetworkManager.SETTING_CONNECTION_SETTING_NAME);
|
||||||
connection._type = connectionSettings.type;
|
connection._type = connectionSettings.type;
|
||||||
connection._section = this._ctypes[connection._type];
|
|
||||||
|
connection._section = this._ctypes[connection._type] || NMConnectionCategory.INVALID;
|
||||||
connection._name = connectionSettings.id;
|
connection._name = connectionSettings.id;
|
||||||
connection._uuid = connectionSettings.uuid;
|
connection._uuid = connectionSettings.uuid;
|
||||||
connection._timestamp = connectionSettings.timestamp;
|
connection._timestamp = connectionSettings.timestamp;
|
||||||
|
|
||||||
let section = connection._section;
|
let section = connection._section;
|
||||||
|
|
||||||
|
if (connection._section == NMConnectionCategory.INVALID)
|
||||||
|
return;
|
||||||
if (section == NMConnectionCategory.VPN) {
|
if (section == NMConnectionCategory.VPN) {
|
||||||
this._devices.vpn.device.checkConnection(connection);
|
this._devices.vpn.device.checkConnection(connection);
|
||||||
this._devices.vpn.section.actor.show();
|
this._devices.vpn.section.actor.show();
|
||||||
connection._everAdded = true;
|
|
||||||
} else {
|
} else {
|
||||||
let devices = this._devices[section].devices;
|
let devices = this._devices[section].devices;
|
||||||
for (let i = 0; i < devices.length; i++) {
|
for (let i = 0; i < devices.length; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user