power: Remove get_battery_level()

This was added in 6c447dc14a to deal with
both older and newer UPower versions.

It should be safe now to assume a UPower version with this property.
This commit is contained in:
Ian Douglas Scott 2020-10-12 10:06:41 -07:00 committed by Robert Ancell
parent f297f544f1
commit af8c3247b4

View file

@ -383,18 +383,6 @@ kind_to_description (UpDeviceKind kind)
g_assert_not_reached ();
}
static UpDeviceLevel
get_battery_level (UpDevice *device)
{
UpDeviceLevel battery_level;
if (!g_object_class_find_property (G_OBJECT_CLASS (G_OBJECT_GET_CLASS (device)), "battery-level"))
return UP_DEVICE_LEVEL_NONE;
g_object_get (device, "battery-level", &battery_level, NULL);
return battery_level;
}
static void
add_device (CcPowerPanel *panel, UpDevice *device)
{
@ -419,8 +407,8 @@ add_device (CcPowerPanel *panel, UpDevice *device)
"state", &state,
"model", &name,
"is-present", &is_present,
"battery-level", &battery_level,
NULL);
battery_level = get_battery_level (device);
if (!is_present)
return;