status/network: Rename setDeviceDescription()

It is used to pass the disambiguated device name to device items,
so call it "name" rather than "description".

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2406>
This commit is contained in:
Florian Müllner 2022-08-03 00:54:20 +02:00
parent 02bbc830fb
commit 586bb29b9c

View File

@ -320,7 +320,7 @@ var NMDeviceItem = class NMDeviceItem extends NMConnectionSection {
throw new TypeError(`Cannot instantiate abstract type ${this.constructor.name}`); throw new TypeError(`Cannot instantiate abstract type ${this.constructor.name}`);
this._device = device; this._device = device;
this._description = ''; this._deviceName = '';
this._autoConnectItem = this.item.menu.addAction(_("Connect"), this._autoConnect.bind(this)); this._autoConnectItem = this.item.menu.addAction(_("Connect"), this._autoConnect.bind(this));
this._deactivateItem = this._radioSection.addAction(_("Turn Off"), this.deactivateConnection.bind(this)); this._deactivateItem = this._radioSection.addAction(_("Turn Off"), this.deactivateConnection.bind(this));
@ -391,13 +391,13 @@ var NMDeviceItem = class NMDeviceItem extends NMConnectionSection {
this._device.disconnect(null); this._device.disconnect(null);
} }
setDeviceDescription(desc) { setDeviceName(name) {
this._description = desc; this._deviceName = name;
this._sync(); this._sync();
} }
_getDescription() { _getDescription() {
return this._description; return this._deviceName;
} }
_sync() { _sync() {
@ -1279,7 +1279,7 @@ var NMWirelessDeviceItem = class extends Signals.EventEmitter {
this._client = client; this._client = client;
this._device = device; this._device = device;
this._description = ''; this._deviceName = '';
this.item = new PopupMenu.PopupSubMenuMenuItem('', true); this.item = new PopupMenu.PopupSubMenuMenuItem('', true);
this.item.menu.addAction(_("Select Network"), this._showDialog.bind(this)); this.item.menu.addAction(_("Select Network"), this._showDialog.bind(this));
@ -1375,8 +1375,8 @@ var NMWirelessDeviceItem = class extends Signals.EventEmitter {
this.item.label.text = this._getStatus(); this.item.label.text = this._getStatus();
} }
setDeviceDescription(desc) { setDeviceName(name) {
this._description = desc; this._deviceName = name;
this._sync(); this._sync();
} }
@ -1385,22 +1385,22 @@ var NMWirelessDeviceItem = class extends Signals.EventEmitter {
if (this._isHotSpotMaster()) if (this._isHotSpotMaster())
/* Translators: %s is a network identifier */ /* Translators: %s is a network identifier */
return _("%s Hotspot Active").format(this._description); return _('%s Hotspot Active').format(this._deviceName);
else if (this._device.state >= NM.DeviceState.PREPARE && else if (this._device.state >= NM.DeviceState.PREPARE &&
this._device.state < NM.DeviceState.ACTIVATED) this._device.state < NM.DeviceState.ACTIVATED)
/* Translators: %s is a network identifier */ /* Translators: %s is a network identifier */
return _("%s Connecting").format(this._description); return _('%s Connecting').format(this._deviceName);
else if (ap) else if (ap)
return ssidToLabel(ap.get_ssid()); return ssidToLabel(ap.get_ssid());
else if (!this._client.wireless_hardware_enabled) else if (!this._client.wireless_hardware_enabled)
/* Translators: %s is a network identifier */ /* Translators: %s is a network identifier */
return _("%s Hardware Disabled").format(this._description); return _('%s Hardware Disabled').format(this._deviceName);
else if (!this._client.wireless_enabled) else if (!this._client.wireless_enabled)
/* Translators: %s is a network identifier */ /* Translators: %s is a network identifier */
return _("%s Off").format(this._description); return _('%s Off').format(this._deviceName);
else if (this._device.state == NM.DeviceState.DISCONNECTED) else if (this._device.state == NM.DeviceState.DISCONNECTED)
/* Translators: %s is a network identifier */ /* Translators: %s is a network identifier */
return _("%s Not Connected").format(this._description); return _('%s Not Connected').format(this._deviceName);
else else
return ''; return '';
} }
@ -1880,9 +1880,9 @@ class Indicator extends PanelMenu.SystemIndicator {
let names = NM.Device.disambiguate_names(this._nmDevices); let names = NM.Device.disambiguate_names(this._nmDevices);
for (let i = 0; i < this._nmDevices.length; i++) { for (let i = 0; i < this._nmDevices.length; i++) {
let device = this._nmDevices[i]; let device = this._nmDevices[i];
let description = names[i]; let name = names[i];
if (device._delegate) if (device._delegate)
device._delegate.setDeviceDescription(description); device._delegate.setDeviceName(name);
} }
} }