diff options
author | Seth Forshee <seth.forshee@canonical.com> | 2013-08-13 10:51:48 -0500 |
---|---|---|
committer | Martin Pitt <martinpitt@gnome.org> | 2013-08-23 08:45:57 +0200 |
commit | eaf86482a925e69e6e32973184164c6b8e5391d0 (patch) | |
tree | e33a24e3bd9583adff60806599d67afbf9f5d742 /src/up-device.c | |
parent | 03f67aabfe2a01ebfbcb424fa193c02be8f0906e (diff) |
Add temperature property for batteries
Linux's power_supply class supports a temperature attribute, which is
supported by many battery drivers. Add a new property to export this
information and support this property in Linux.
https://bugs.freedesktop.org/show_bug.cgi?id=68338
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Martin Pitt <martinpitt@gnome.org>
Diffstat (limited to 'src/up-device.c')
-rw-r--r-- | src/up-device.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/up-device.c b/src/up-device.c index 12f32ff..9e9c332 100644 --- a/src/up-device.c +++ b/src/up-device.c @@ -77,6 +77,7 @@ struct UpDevicePrivate gint64 time_to_empty; /* seconds */ gint64 time_to_full; /* seconds */ gdouble percentage; /* percent */ + gdouble temperature; /* degrees C */ gboolean recall_notice; gchar *recall_vendor; gchar *recall_url; @@ -110,6 +111,7 @@ enum { PROP_TIME_TO_EMPTY, PROP_TIME_TO_FULL, PROP_PERCENTAGE, + PROP_TEMPERATURE, PROP_TECHNOLOGY, PROP_RECALL_NOTICE, PROP_RECALL_VENDOR, @@ -249,6 +251,9 @@ up_device_get_property (GObject *object, guint prop_id, GValue *value, GParamSpe case PROP_PERCENTAGE: g_value_set_double (value, device->priv->percentage); break; + case PROP_TEMPERATURE: + g_value_set_double (value, device->priv->temperature); + break; case PROP_TECHNOLOGY: g_value_set_uint (value, device->priv->technology); break; @@ -352,6 +357,9 @@ up_device_set_property (GObject *object, guint prop_id, const GValue *value, GPa case PROP_PERCENTAGE: device->priv->percentage = g_value_get_double (value); break; + case PROP_TEMPERATURE: + device->priv->temperature = g_value_get_double (value); + break; case PROP_TECHNOLOGY: device->priv->technology = g_value_get_uint (value); break; @@ -1170,6 +1178,14 @@ up_device_class_init (UpDeviceClass *klass) 0.0, 100.f, 100.0, G_PARAM_READWRITE)); /** + * UpDevice:temperature: + */ + g_object_class_install_property (object_class, + PROP_TEMPERATURE, + g_param_spec_double ("temperature", NULL, NULL, + 0.0, G_MAXDOUBLE, 0.0, + G_PARAM_READWRITE)); + /** * UpDevice:recall-notice: */ g_object_class_install_property (object_class, |