From 5418f29bf1c8e3c2ce53add5d0a54b1cd003c13f Mon Sep 17 00:00:00 2001 From: Ojas Kavathe Date: Fri, 24 Jan 2025 09:01:07 +0530 Subject: fix(bluetooth): battery between 0-1 --- lib/bluetooth/battery.vala | 2 +- lib/bluetooth/device.vala | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/bluetooth/battery.vala b/lib/bluetooth/battery.vala index a828994..9fdd70d 100644 --- a/lib/bluetooth/battery.vala +++ b/lib/bluetooth/battery.vala @@ -1,7 +1,7 @@ /** * Object representing a [[https://github.com/bluez/bluez/blob/master/doc/org.bluez.Battery.rst|battery]]. */ -public class AstalBluetooth.Battery : Object { +internal class AstalBluetooth.Battery : Object { private IBattery proxy; internal ObjectPath object_path { owned get; private set; } diff --git a/lib/bluetooth/device.vala b/lib/bluetooth/device.vala index 74f8d83..b38a5ce 100644 --- a/lib/bluetooth/device.vala +++ b/lib/bluetooth/device.vala @@ -114,12 +114,12 @@ public class AstalBluetooth.Device : Object { } /** - * The percentage of battery left on the device if it has one, else 0. + * The percentage of battery left on the device if it has one, else -1. */ - public uint battery_percentage { + public double battery_percentage { get { - if (battery != null) return battery.percentage; - else return 0; + if (battery != null) return battery.percentage * 0.01; + else return -1; } } -- cgit v1.2.3