Commit 3dc7b75d authored by Christian Kellner's avatar Christian Kellner
Browse files

device: Key is now an str/enum on bus/obj

The property is now a string on the bus and internally for the
Device GObject an proper enum. The conversion to/from string
happens in BoltExported.
parent b5245fd6
......@@ -209,7 +209,7 @@ bolt_device_get_property (GObject *object,
break;
case PROP_HAVE_KEY:
g_value_set_uint (value, dev->key);
g_value_set_enum (value, dev->key);
break;
case PROP_STORETIME:
......@@ -301,7 +301,7 @@ bolt_device_set_property (GObject *object,
break;
case PROP_HAVE_KEY:
dev->key = g_value_get_uint (value);
dev->key = g_value_get_enum (value);
break;
case PROP_STORETIME:
......@@ -433,10 +433,9 @@ bolt_device_class_init (BoltDeviceClass *klass)
G_PARAM_STATIC_STRINGS);
props[PROP_HAVE_KEY] =
g_param_spec_uint ("key",
g_param_spec_enum ("key",
"Key", NULL,
0,
BOLT_KEY_NEW,
BOLT_TYPE_KEY_STATE,
BOLT_KEY_MISSING,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS);
......
......@@ -218,7 +218,7 @@
</doc:para></doc:description></doc:doc>
</property>
<property name="Key" type="u" access="read">
<property name="Key" type="s" access="read">
<doc:doc><doc:description><doc:para>
If a key is associated with the device.
</doc:para></doc:description></doc:doc>
......
......@@ -369,6 +369,15 @@ class BoltDevice(ProxyWrapper):
return mapping.get(res, self.UNKNOWN)
@property
def key(self):
res = getattr(self, 'Key')
mapping = {'missing': self.KEY_MISSING,
'have': self.KEY_HAVE,
'new': self.KEY_NEW}
return mapping.get(res, self.MISSING)
@property
def label(self):
res = getattr(self, 'Label')
......
Markdown is supported
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