[gnome-shell/gnome-3-32] network: Handle interface name changes
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gnome-3-32] network: Handle interface name changes
- Date: Tue, 7 May 2019 15:22:57 +0000 (UTC)
commit 2d9ed18668c158423cbc98fa69d85780beba6c2e
Author: Fabrice Bellet <fabrice bellet info>
Date: Tue May 7 15:21:09 2019 +0000
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
(cherry picked from commit d9bfa16f05b6b77a1fb03d3366f9333e105983fe)
js/ui/status/network.js | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
---
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index e6551f217..421d2e7d2 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -1730,14 +1730,24 @@ var NMApplet = class extends PanelMenu.SystemIndicator {
this._addDeviceWrapper(wrapper);
this._nmDevices.push(device);
- if (!skipSyncDeviceNames)
- this._syncDeviceNames();
+ this._deviceChanged(device, skipSyncDeviceNames);
- if (wrapper instanceof NMConnectionSection) {
- this._connections.forEach(connection => {
- wrapper.checkConnection(connection);
- });
- }
+ device.connect('notify::interface', () => {
+ this._deviceChanged(device, false);
+ });
+ }
+ }
+
+ _deviceChanged(device, skipSyncDeviceNames) {
+ let wrapper = device._delegate;
+
+ if (!skipSyncDeviceNames)
+ this._syncDeviceNames();
+
+ if (wrapper instanceof NMConnectionSection) {
+ this._connections.forEach(connection => {
+ wrapper.checkConnection(connection);
+ });
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]