Skip to content

Commit a7ed1ed

Browse files
committedMar 25, 2022
Don't call dp.emit() when UPower service active status changes
1 parent e0f0931 commit a7ed1ed

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed
 

‎src/modules/upower/upower.cpp

+4-9
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,12 @@ void UPower::upowerAppear(GDBusConnection* conn, const gchar* name, const gchar*
155155
gpointer data) {
156156
UPower* up = static_cast<UPower*>(data);
157157
up->upowerRunning = true;
158-
up->dp.emit();
158+
up->event_box_.set_visible(true);
159159
}
160160
void UPower::upowerDisappear(GDBusConnection* conn, const gchar* name, gpointer data) {
161161
UPower* up = static_cast<UPower*>(data);
162162
up->upowerRunning = false;
163-
up->dp.emit();
163+
up->event_box_.set_visible(false);
164164
}
165165

166166
void UPower::removeDevice(const gchar* objectPath) {
@@ -281,13 +281,8 @@ std::string UPower::timeToString(gint64 time) {
281281
auto UPower::update() -> void {
282282
std::lock_guard<std::mutex> guard(m_Mutex);
283283

284-
// Hide everything if the UPower service is not running
285-
if (!upowerRunning) {
286-
event_box_.set_visible(false);
287-
// Call parent update
288-
AModule::update();
289-
return;
290-
}
284+
// Don't update widget if the UPower service isn't running
285+
if (!upowerRunning) return;
291286

292287
UpDeviceKind kind;
293288
UpDeviceState state;

0 commit comments

Comments
 (0)