Don't call dp.emit() when UPower service active status changes

This commit is contained in:
Erik Reider 2022-03-25 17:35:37 +01:00
parent e0f0931e2d
commit a7ed1ed570

View File

@ -155,12 +155,12 @@ void UPower::upowerAppear(GDBusConnection* conn, const gchar* name, const gchar*
gpointer data) { gpointer data) {
UPower* up = static_cast<UPower*>(data); UPower* up = static_cast<UPower*>(data);
up->upowerRunning = true; up->upowerRunning = true;
up->dp.emit(); up->event_box_.set_visible(true);
} }
void UPower::upowerDisappear(GDBusConnection* conn, const gchar* name, gpointer data) { void UPower::upowerDisappear(GDBusConnection* conn, const gchar* name, gpointer data) {
UPower* up = static_cast<UPower*>(data); UPower* up = static_cast<UPower*>(data);
up->upowerRunning = false; up->upowerRunning = false;
up->dp.emit(); up->event_box_.set_visible(false);
} }
void UPower::removeDevice(const gchar* objectPath) { void UPower::removeDevice(const gchar* objectPath) {
@ -281,13 +281,8 @@ std::string UPower::timeToString(gint64 time) {
auto UPower::update() -> void { auto UPower::update() -> void {
std::lock_guard<std::mutex> guard(m_Mutex); std::lock_guard<std::mutex> guard(m_Mutex);
// Hide everything if the UPower service is not running // Don't update widget if the UPower service isn't running
if (!upowerRunning) { if (!upowerRunning) return;
event_box_.set_visible(false);
// Call parent update
AModule::update();
return;
}
UpDeviceKind kind; UpDeviceKind kind;
UpDeviceState state; UpDeviceState state;