diff options
author | Bastien Nocera <hadess@hadess.net> | 2013-10-13 15:21:25 +0200 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2013-10-14 11:06:53 +0200 |
commit | d2484d4ec143348628f7129f21ad1fce23050b22 (patch) | |
tree | f54adedb956a7df50394854595c1fb97a2063063 | |
parent | c9aeb660e11f60f260dfbacfe7857e5e7d01d3cf (diff) |
lib: Add support for the IconName property
-rw-r--r-- | libupower-glib/up-device.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/libupower-glib/up-device.c b/libupower-glib/up-device.c index 0aa401b..6481c13 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_ICON_NAME, PROP_LAST }; @@ -356,6 +357,8 @@ up_device_to_text (UpDevice *device) if (kind == UP_DEVICE_KIND_LINE_POWER) g_string_append_printf (string, " online: %s\n", up_device_bool_to_string (up_device_glue_get_online (priv->proxy_device))); + g_string_append_printf (string, " icon-name: '%s'\n", up_device_glue_get_icon_name (priv->proxy_device)); + /* if we can, get history */ if (up_device_glue_get_has_history (priv->proxy_device)) { up_device_to_text_history (device, string, "charge"); @@ -647,6 +650,9 @@ up_device_set_property (GObject *object, guint prop_id, const GValue *value, GPa case PROP_WARNING_LEVEL: up_device_glue_set_warning_level (device->priv->proxy_device, g_value_get_uint (value)); break; + case PROP_ICON_NAME: + up_device_glue_set_icon_name (device->priv->proxy_device, g_value_get_string (value)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -755,6 +761,9 @@ up_device_get_property (GObject *object, guint prop_id, GValue *value, GParamSpe case PROP_WARNING_LEVEL: g_value_set_uint (value, up_device_glue_get_warning_level (device->priv->proxy_device)); break; + case PROP_ICON_NAME: + g_value_set_string (value, up_device_glue_get_icon_name (device->priv->proxy_device)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -1140,6 +1149,19 @@ up_device_class_init (UpDeviceClass *klass) UP_DEVICE_LEVEL_UNKNOWN, G_PARAM_READWRITE)); + /** + * UpDevice:icon-name: + * + * The icon name, following the Icon Naming Speficiation + * + * Since: 1.0 + **/ + g_object_class_install_property (object_class, + PROP_ICON_NAME, + g_param_spec_string ("icon-name", + NULL, NULL, NULL, + G_PARAM_READWRITE)); + g_type_class_add_private (klass, sizeof (UpDevicePrivate)); } |