Commit 631998da authored by Christian Kellner's avatar Christian Kellner Committed by Christian Kellner
Browse files

Power supply: add name property for all supplies

parent b6a21039
......@@ -11,11 +11,13 @@
typedef struct _GbbPowerSupplyPrivate {
GUdevDevice *udevice;
char *id;
} GbbPowerSupplyPrivate;
enum {
PROP_SUPPLY_0,
PROP_UDEV_DEVICE,
PROP_NAME,
PROP_SUPPLY_LAST
};
......@@ -46,12 +48,18 @@ gbb_power_supply_get_property(GObject *object,
{
GbbPowerSupply *ps = GBB_POWER_SUPPLY(object);
GbbPowerSupplyPrivate *priv = SUPPLY_GET_PRIV(ps);
const char *name;
switch (prop_id) {
case PROP_UDEV_DEVICE:
g_value_set_object(value, priv->udevice);
break;
case PROP_NAME:
name = g_udev_device_get_name(priv->udevice);
g_value_set_string(value, name);
break;
}
}
......@@ -89,6 +97,12 @@ gbb_power_supply_class_init(GbbPowerSupplyClass *klass)
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_NAME);
supply_props[PROP_NAME] =
g_param_spec_string("name", NULL, NULL,
NULL,
G_PARAM_READABLE |
G_PARAM_STATIC_NAME);
g_object_class_install_properties(gobject_class,
PROP_SUPPLY_LAST,
supply_props);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment