status/network: Improve network toggle subtitles
If there is a single connection for a given NMToggle subclass, use the connection name; otherwise, transform that into '%d connected'. This is better than the current "Device (counter)" template, e.g. "VPN (2)", which would give us a quick toggle with: VPN VPN (2) Change that to e.g.: VPN 2 connected Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2619>
This commit is contained in:
parent
707ce2955b
commit
01a89bc29a
@ -1363,13 +1363,13 @@ const NMToggle = GObject.registerClass({
|
||||
|
||||
// transform function for property binding:
|
||||
// Ignore the provided label if there are multiple active
|
||||
// items, and replace it with something like "VPN (2)"
|
||||
// items, and replace it with something like "2 connected"
|
||||
_transformSubtitle(source) {
|
||||
const nActive = this.checked
|
||||
? [...this._getActiveItems()].length
|
||||
: 0;
|
||||
if (nActive > 1)
|
||||
return `${this._getDefaultName()} (${nActive})`;
|
||||
return ngettext('%d connected', '%d connected', nActive).format(nActive);
|
||||
return source;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user