diff options
author | Aylur <[email protected]> | 2024-08-04 00:13:02 +0200 |
---|---|---|
committer | Aylur <[email protected]> | 2024-08-04 00:13:02 +0200 |
commit | 99e46734e2a23a2bb9d1aa6e1775eda85105ce0e (patch) | |
tree | 47f125694cbc67681c5d65fa538066c3d03558f3 /src/network.vala | |
parent | 7662145390f87dc6e50286e9e3458d2b41b33577 (diff) |
add: custom accesspoint
Diffstat (limited to 'src/network.vala')
-rw-r--r-- | src/network.vala | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/network.vala b/src/network.vala index 53b3139..7c8e466 100644 --- a/src/network.vala +++ b/src/network.vala @@ -15,8 +15,8 @@ public class AstalNetwork.Network : Object { public NM.Client client { get; private set; } - public Wifi wifi { get; private set; } - public Wired wired { get; private set; } + public Wifi? wifi { get; private set; } + public Wired? wired { get; private set; } public Primary primary { get; private set; } public Connectivity connectivity { @@ -30,8 +30,13 @@ public class AstalNetwork.Network : Object { construct { try { client = new NM.Client(); - wifi = new Wifi((NM.DeviceWifi)get_device(NM.DeviceType.WIFI), client); - wired = new Wired((NM.DeviceEthernet)get_device(NM.DeviceType.ETHERNET), client); + var wifi_device = (NM.DeviceWifi)get_device(NM.DeviceType.WIFI); + if (wifi_device != null) + wifi = new Wifi(wifi_device); + + var ethernet = (NM.DeviceEthernet)get_device(NM.DeviceType.ETHERNET); + if (ethernet != null) + wired = new Wired(ethernet); sync(); client.notify["primary-connection"].connect(sync); |