modules: systemd_failed_units: Introduce nr_failed as member

Keeping nr_failed as member allows to split-out calculation of overall
failed units into updateData.

Signed-off-by: Steffen Kothe <steffen.kothe@skothe.net>
This commit is contained in:
Steffen Kothe
2025-06-21 15:17:59 +00:00
parent dfbf1ff2a0
commit 37a6106d3e
2 changed files with 3 additions and 2 deletions

View File

@ -19,7 +19,7 @@ class SystemdFailedUnits : public ALabel {
std::string format_ok;
bool update_pending;
uint32_t nr_failed_system, nr_failed_user;
uint32_t nr_failed_system, nr_failed_user, nr_failed;
std::string last_status;
Glib::RefPtr<Gio::DBus::Proxy> system_proxy, user_proxy;

View File

@ -16,6 +16,7 @@ SystemdFailedUnits::SystemdFailedUnits(const std::string& id, const Json::Value&
update_pending(false),
nr_failed_system(0),
nr_failed_user(0),
nr_failed(0),
last_status() {
if (config["hide-on-ok"].isBool()) {
hide_on_ok = config["hide-on-ok"].asBool();
@ -100,7 +101,7 @@ void SystemdFailedUnits::updateData() {
}
auto SystemdFailedUnits::update() -> void {
uint32_t nr_failed = nr_failed_system + nr_failed_user;
nr_failed = nr_failed_system + nr_failed_user;
// Hide if needed.
if (nr_failed == 0 && hide_on_ok) {