network: Handle interface name changes

The interface name when a device is added may not be the final one. For
example when using USB tethering, it will first appear as 'usb0' before
being renamed to something like 'enp0s20f0u1' depending on the port the
phone is plugged in.

As a result, we will ignore the new interface name in that case and fail
to associate the correct connection with the device: Instead of the
correct "USB Ethernet" (or user-customized name), it will show up as
"Ethernet".

Fix this by updating names and connections when a device's interface
property changes.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/534
This commit is contained in:
Fabrice Bellet 2019-05-07 15:21:09 +00:00 committed by Florian Müllner
parent 03117d65b2
commit d9bfa16f05

View File

@ -1731,6 +1731,17 @@ var NMApplet = class extends PanelMenu.SystemIndicator {
this._addDeviceWrapper(wrapper); this._addDeviceWrapper(wrapper);
this._nmDevices.push(device); this._nmDevices.push(device);
this._deviceChanged(device, skipSyncDeviceNames);
device.connect('notify::interface', () => {
this._deviceChanged(device, false);
});
}
}
_deviceChanged(device, skipSyncDeviceNames) {
let wrapper = device._delegate;
if (!skipSyncDeviceNames) if (!skipSyncDeviceNames)
this._syncDeviceNames(); this._syncDeviceNames();
@ -1740,7 +1751,6 @@ var NMApplet = class extends PanelMenu.SystemIndicator {
}); });
} }
} }
}
_addDeviceWrapper(wrapper) { _addDeviceWrapper(wrapper) {
wrapper._activationFailedId = wrapper.connect('activation-failed', wrapper._activationFailedId = wrapper.connect('activation-failed',