status/network: Only show custom wired names

Thanks to NetworkManager's connection name disambiguation, it's
pretty common for single wired connections to be named "Wired". This
is fine and what we want almost all times, but in the specific case
of quick settings, we already have a "Wired" string set as title of
the quick settings toggle, so having that as subtitle is reduntant.

Hide the subtitle label (by returning null) when the subtitle of
a wired network matches the title.

Fixes ab10b95d2d
Closes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6369

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2627>
This commit is contained in:
Georges Basile Stavracas Neto 2023-02-06 08:22:48 -03:00
parent 3d645eada0
commit 9d75d777c7

View File

@ -1821,6 +1821,13 @@ class NMWiredToggle extends NMDeviceToggle {
'gnome-network-panel.desktop'); 'gnome-network-panel.desktop');
} }
_transformSubtitle(source) {
const subtitle = super._transformSubtitle(source);
if (subtitle === this.title)
return null;
return subtitle;
}
_createDeviceMenuItem(device) { _createDeviceMenuItem(device) {
return new NMWiredDeviceItem(this._client, device); return new NMWiredDeviceItem(this._client, device);
} }