sculpt: refine condition of acpi features

Commit "sculpt: safeguard the offering of suspend/resume" was too lax
about the detection of acpi support. In situations where acpi support
is selected but not yet installed, the menu would offer the features
already. This patch restricts the condition such that acpi support must
be running, not merely selected.

Issue #5174
This commit is contained in:
Norman Feske 2024-04-19 17:15:00 +02:00 committed by Christian Helmuth
parent ad722f1450
commit 39ccd5ab79
2 changed files with 10 additions and 1 deletions

View File

@ -2201,7 +2201,7 @@ void Sculpt::Main::_handle_runtime_state(Xml_node const &state)
/* power-management features depend on optional acpi_support subsystem */
{
bool const acpi_support = _runtime_state.present_in_runtime("acpi_support");
bool const acpi_support = _cached_runtime_config.present_in_runtime("acpi_support");
Power_features const orig_power_features = _power_features;
_power_features.poweroff = acpi_support;
_power_features.suspend = acpi_support && _drivers.suspend_supported();;

View File

@ -382,6 +382,15 @@ class Sculpt::Runtime_config
);
}
bool present_in_runtime(Start_name const &name) const
{
bool result = false;
_components.for_each([&] (Component const &component) {
if (component.name == name)
result = true; });
return result;
}
void with_start_name(Dialog::Id const &id, auto const &fn) const
{
_components.for_each([&] (Component const &component) {