NetworkMenu/NMDeviceModem: use the operator name when we have it

Instead of the connection name, as the operator name is usually
shorter and more useful.

https://bugzilla.gnome.org/show_bug.cgi?id=709043
This commit is contained in:
Giovanni Campagna 2013-10-03 14:49:21 +02:00
parent 777c7a952b
commit bde5cfc8bb

View File

@ -426,16 +426,7 @@ const NMDeviceModem = new Lang.Class({
this._mobileDevice = new ModemManager.ModemGsm(device.udi); this._mobileDevice = new ModemManager.ModemGsm(device.udi);
if (this._mobileDevice) { if (this._mobileDevice) {
this._operatorNameId = this._mobileDevice.connect('notify::operator-name', Lang.bind(this, function() { this._operatorNameId = this._mobileDevice.connect('notify::operator-name', Lang.bind(this, this._sync));
if (this._operatorItem) {
let name = this._mobileDevice.operator_name;
if (name) {
this._operatorItem.label.text = name;
this._operatorItem.actor.show();
} else
this._operatorItem.actor.hide();
}
}));
this._signalQualityId = this._mobileDevice.connect('notify::signal-quality', Lang.bind(this, function() { this._signalQualityId = this._mobileDevice.connect('notify::signal-quality', Lang.bind(this, function() {
this.emit('icon-changed'); this.emit('icon-changed');
})); }));
@ -467,6 +458,9 @@ const NMDeviceModem = new Lang.Class({
/* Translators: this is for a network device that cannot be activated /* Translators: this is for a network device that cannot be activated
because it's disabled by rfkill (airplane mode) */ because it's disabled by rfkill (airplane mode) */
return _("Disabled"); return _("Disabled");
else if (this._device.state == NetworkManager.DeviceState.ACTIVATED &&
this._mobileDevice && this._mobileDevice.operator_name)
return this._mobileDevice.operator_name;
else else
return this.parent(); return this.parent();
}, },