NetworkStatus: hide the only connection for wired devices
For wired devices (actually, ethernet devices), hide the connection list when there is only one connection (either automatic or stored). The device can be operated with the associated switch.
This commit is contained in:
parent
da852a94bd
commit
4ebf07c725
@ -449,8 +449,10 @@ NMDevice.prototype = {
|
||||
obj.item.destroy();
|
||||
this._connections.splice(pos, 1);
|
||||
|
||||
if (this._connections.length == 0) {
|
||||
if (this._connections.length <= 1) {
|
||||
// We need to show the automatic connection again
|
||||
// (or in the case of NMDeviceWired, we want to hide
|
||||
// the only explicit connection)
|
||||
this._clearSection();
|
||||
this._createSection();
|
||||
}
|
||||
@ -678,6 +680,20 @@ NMDeviceWired.prototype = {
|
||||
return true;
|
||||
},
|
||||
|
||||
_createSection: function() {
|
||||
NMDevice.prototype._createSection.call(this);
|
||||
|
||||
// if we have only one connection (normal or automatic)
|
||||
// we hide the connection list, and use the switch to control
|
||||
// the device
|
||||
// we can do it here because addConnection and removeConnection
|
||||
// both call _createSection at some point
|
||||
if (this._connections.length <= 1)
|
||||
this.section.actor.hide();
|
||||
else
|
||||
this.section.actor.show();
|
||||
},
|
||||
|
||||
_createAutomaticConnection: function() {
|
||||
let connection = new NetworkManager.Connection();
|
||||
connection._uuid = NetworkManager.utils_uuid_generate();
|
||||
|
Loading…
Reference in New Issue
Block a user