modules: systemd_failed_units: Introduce systemd state variables

Systemd provides the status of a given user and system session as a
human readable string.

Retrieve this information via RequestSystemState and guard the
retrieve of failed units depending on this request.

The functionality is extended but does not change, which means that
failed units in any granularity are displayed as before.

Update documentation in the meantime.

Signed-off-by: Steffen Kothe <steffen.kothe@skothe.net>
This commit is contained in:
Steffen Kothe
2025-06-21 15:09:05 +00:00
parent d5e3a9f894
commit cfb47790ad
3 changed files with 49 additions and 9 deletions

View File

@ -19,6 +19,7 @@ class SystemdFailedUnits : public ALabel {
std::string format_ok;
bool update_pending;
std::string system_state, user_state, overall_state;
uint32_t nr_failed_system, nr_failed_user, nr_failed;
std::string last_status;
Glib::RefPtr<Gio::DBus::Proxy> system_proxy, user_proxy;
@ -26,6 +27,7 @@ class SystemdFailedUnits : public ALabel {
void notify_cb(const Glib::ustring &sender_name, const Glib::ustring &signal_name,
const Glib::VariantContainerBase &arguments);
void RequestFailedUnits();
void RequestSystemState();
void updateData();
};