Skip to content
Commit 3c32d284 authored by Stefan Brüns's avatar Stefan Brüns
Browse files

Avoid repeated Solid::Battery instantiations on charge level change

The Solid::Battery instance is only required if the updated battery
is a peripheral battery.

Determining if the battery belongs to a peripheral or is a power supply
can be done in a significantly cheaper way using a lookup in the
`m_batteriesPercent` and `m_peripheralBatteriesPercent` dictionaries.

Instantiating a Solid::Battery is fairly costly, as it will typically do
a synchronous UPower DBus call.

(cherry picked from commit 09b0084d)
parent 4425d7ab
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment