diff options
Diffstat (limited to 'libupower-glib/up-device.c')
-rw-r--r-- | libupower-glib/up-device.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/libupower-glib/up-device.c b/libupower-glib/up-device.c index 7bce4e0..63ebe12 100644 --- a/libupower-glib/up-device.c +++ b/libupower-glib/up-device.c @@ -90,6 +90,7 @@ enum { PROP_PERCENTAGE, PROP_TEMPERATURE, PROP_WARNING_LEVEL, + PROP_BATTERY_LEVEL, PROP_ICON_NAME, PROP_LAST }; @@ -315,6 +316,8 @@ up_device_to_text (UpDevice *device) kind == UP_DEVICE_KIND_UPS) g_string_append_printf (string, " state: %s\n", up_device_state_to_string (up_exported_device_get_state (priv->proxy_device))); g_string_append_printf (string, " warning-level: %s\n", up_device_level_to_string (up_exported_device_get_warning_level (priv->proxy_device))); + if (up_exported_device_get_battery_level (priv->proxy_device) != UP_DEVICE_LEVEL_NONE) + g_string_append_printf (string, " battery-level: %s\n", up_device_level_to_string (up_exported_device_get_battery_level (priv->proxy_device))); if (kind == UP_DEVICE_KIND_BATTERY) { g_string_append_printf (string, " energy: %g Wh\n", up_exported_device_get_energy (priv->proxy_device)); if (!is_display) @@ -665,6 +668,9 @@ up_device_set_property (GObject *object, guint prop_id, const GValue *value, GPa case PROP_WARNING_LEVEL: up_exported_device_set_warning_level (device->priv->proxy_device, g_value_get_uint (value)); break; + case PROP_BATTERY_LEVEL: + up_exported_device_set_battery_level (device->priv->proxy_device, g_value_get_uint (value)); + break; case PROP_ICON_NAME: up_exported_device_set_icon_name (device->priv->proxy_device, g_value_get_string (value)); break; @@ -776,6 +782,9 @@ up_device_get_property (GObject *object, guint prop_id, GValue *value, GParamSpe case PROP_WARNING_LEVEL: g_value_set_uint (value, up_exported_device_get_warning_level (device->priv->proxy_device)); break; + case PROP_BATTERY_LEVEL: + g_value_set_uint (value, up_exported_device_get_battery_level (device->priv->proxy_device)); + break; case PROP_ICON_NAME: g_value_set_string (value, up_exported_device_get_icon_name (device->priv->proxy_device)); break; @@ -1150,6 +1159,22 @@ up_device_class_init (UpDeviceClass *klass) G_PARAM_READWRITE)); /** + * UpDevice:battery-level: + * + * The battery level. + * + * Since: 1.0 + **/ + g_object_class_install_property (object_class, + PROP_BATTERY_LEVEL, + g_param_spec_uint ("battery-level", + NULL, NULL, + UP_DEVICE_LEVEL_UNKNOWN, + UP_DEVICE_LEVEL_LAST, + UP_DEVICE_LEVEL_NONE, + G_PARAM_READWRITE)); + + /** * UpDevice:icon-name: * * The icon name, following the Icon Naming Speficiation |