Skip to content

Commit a477f78

Browse files
committed
All hardware OR all software
1 parent 2bde06d commit a477f78

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

src/rfkill.vala

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,27 @@ public class RFKillManager : Object {
8080
return devices;
8181
}
8282

83+
/*
84+
* Checks for Airplane mode
85+
* Setting airplane mode from here does all software lock, whereas setting
86+
* from a key press does all hardware lock. We need one of these two things—
87+
* all devices to be locked somehow—to consider it Airplane Mode
88+
*/
8389
public bool get_airplane_mode () {
90+
var all_hardware_locked = true;
91+
var all_software_locked = true;
92+
8493
foreach (unowned var device in get_devices ()) {
8594
if (!device.software_lock) {
86-
return false;
95+
all_software_locked = false;
8796
}
8897

8998
if (!device.hardware_lock) {
90-
return false;
99+
all_hardware_locked = false;
91100
}
92101
}
93102

94-
return true;
103+
return all_hardware_locked || all_software_locked;
95104
}
96105

97106
public void set_software_lock (RFKillDeviceType type, bool lock_enabled) {

0 commit comments

Comments
 (0)