networks: Hide deactivate/remove buttons for primary connections

Helps: #1962.

Signed-off-by: Fioddor Superconcentrado <fioddor@gmail.com>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Fioddor Superconcentrado authored and Sunil Mohan Adapa committed 2021-01-25 15:40:51 -08:00
1 parent 012a9a0fc7
commit ce87de1dfb
2 files changed
+22 -14

No files matched your search

+6 -1
View File
@@ -217,8 +217,10 @@ def _get_wifi_channel_from_frequency(frequency):
def get_connection_list():
"""Get a list of active and available connections."""
active_uuids = []
client = get_nm_client()
primary_connection = client.get_primary_connection()
active_uuids = []
for connection in client.get_active_connections():
active_uuids.append(connection.get_uuid())
@@ -241,6 +243,9 @@ def get_connection_list():
'type': connection_type,
'type_name': connection_type_name,
'is_active': connection.get_uuid() in active_uuids,
'primary':
(primary_connection
and primary_connection.get_uuid() == connection.get_uuid()),
'zone': zone,
})
connections.sort(key=lambda connection: connection['is_active'],