From 37a6106d3e62efc19861f1ea80f04bf145d4252b Mon Sep 17 00:00:00 2001 From: Steffen Kothe Date: Sat, 21 Jun 2025 15:17:59 +0000 Subject: [PATCH] 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 --- include/modules/systemd_failed_units.hpp | 2 +- src/modules/systemd_failed_units.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/modules/systemd_failed_units.hpp b/include/modules/systemd_failed_units.hpp index 9c3fbcee..df78a5bb 100644 --- a/include/modules/systemd_failed_units.hpp +++ b/include/modules/systemd_failed_units.hpp @@ -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 system_proxy, user_proxy; diff --git a/src/modules/systemd_failed_units.cpp b/src/modules/systemd_failed_units.cpp index 56e624cf..e2cad8f9 100644 --- a/src/modules/systemd_failed_units.cpp +++ b/src/modules/systemd_failed_units.cpp @@ -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) {