From a7ed1ed570dd14383a59b88f44d7e129c94f66de Mon Sep 17 00:00:00 2001 From: Erik Reider <35975961+ErikReider@users.noreply.github.com> Date: Fri, 25 Mar 2022 17:35:37 +0100 Subject: [PATCH] Don't call dp.emit() when UPower service active status changes --- src/modules/upower/upower.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/modules/upower/upower.cpp b/src/modules/upower/upower.cpp index 8750c86..83d3df2 100644 --- a/src/modules/upower/upower.cpp +++ b/src/modules/upower/upower.cpp @@ -155,12 +155,12 @@ void UPower::upowerAppear(GDBusConnection* conn, const gchar* name, const gchar* gpointer data) { UPower* up = static_cast(data); up->upowerRunning = true; - up->dp.emit(); + up->event_box_.set_visible(true); } void UPower::upowerDisappear(GDBusConnection* conn, const gchar* name, gpointer data) { UPower* up = static_cast(data); up->upowerRunning = false; - up->dp.emit(); + up->event_box_.set_visible(false); } void UPower::removeDevice(const gchar* objectPath) { @@ -281,13 +281,8 @@ std::string UPower::timeToString(gint64 time) { auto UPower::update() -> void { std::lock_guard guard(m_Mutex); - // Hide everything if the UPower service is not running - if (!upowerRunning) { - event_box_.set_visible(false); - // Call parent update - AModule::update(); - return; - } + // Don't update widget if the UPower service isn't running + if (!upowerRunning) return; UpDeviceKind kind; UpDeviceState state;