modules: systemd_failed_units: Introduce RequestFailedUnits member
Split-out request of failed units from systemd into a separate member function. This increases the readability and extendability, but preserves the current functionality (non-functional change). Signed-off-by: Steffen Kothe <steffen.kothe@skothe.net>
This commit is contained in:
@ -25,6 +25,7 @@ class SystemdFailedUnits : public ALabel {
|
|||||||
|
|
||||||
void notify_cb(const Glib::ustring &sender_name, const Glib::ustring &signal_name,
|
void notify_cb(const Glib::ustring &sender_name, const Glib::ustring &signal_name,
|
||||||
const Glib::VariantContainerBase &arguments);
|
const Glib::VariantContainerBase &arguments);
|
||||||
|
void RequestFailedUnits();
|
||||||
void updateData();
|
void updateData();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -68,9 +68,7 @@ auto SystemdFailedUnits::notify_cb(const Glib::ustring& sender_name,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemdFailedUnits::updateData() {
|
void SystemdFailedUnits::RequestFailedUnits() {
|
||||||
update_pending = false;
|
|
||||||
|
|
||||||
auto load = [](const char* kind, Glib::RefPtr<Gio::DBus::Proxy>& proxy) -> uint32_t {
|
auto load = [](const char* kind, Glib::RefPtr<Gio::DBus::Proxy>& proxy) -> uint32_t {
|
||||||
try {
|
try {
|
||||||
if (!proxy) return 0;
|
if (!proxy) return 0;
|
||||||
@ -93,6 +91,11 @@ void SystemdFailedUnits::updateData() {
|
|||||||
nr_failed_system = load("systemwide", system_proxy);
|
nr_failed_system = load("systemwide", system_proxy);
|
||||||
nr_failed_user = load("user", user_proxy);
|
nr_failed_user = load("user", user_proxy);
|
||||||
nr_failed = nr_failed_system + nr_failed_user;
|
nr_failed = nr_failed_system + nr_failed_user;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SystemdFailedUnits::updateData() {
|
||||||
|
update_pending = false;
|
||||||
|
RequestFailedUnits();
|
||||||
dp.emit();
|
dp.emit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user