olpc-mesh: fix companion path and active channel property types

Companion device should be an object path instead of a string, and
the introspection data property type for the active channel was
wrong.
This commit is contained in:
Dan Williams 2010-01-14 14:30:02 -08:00
parent d41c35fbf8
commit d20c61a1d6
2 changed files with 22 additions and 9 deletions

View file

@ -7,12 +7,14 @@
The hardware address of the device.
</tp:docstring>
</property>
<property name="Companion" type="s" access="read">
<property name="Companion" type="o" access="read">
<tp:docstring>
The object path of the companion device.
</tp:docstring>
</property>
<property name="ActiveChannel" type="o" access="read">
<property name="ActiveChannel" type="u" access="read">
<tp:docstring>
The currently active channel.
</tp:docstring>

View file

@ -682,7 +682,10 @@ get_property (GObject *object, guint prop_id,
g_value_take_string (value, nm_ether_ntop (&hw_addr));
break;
case PROP_COMPANION:
g_value_set_string (value, nm_device_get_path (priv->companion));
if (priv->companion)
g_value_set_boxed (value, nm_device_get_path (priv->companion));
else
g_value_set_boxed (value, "/");
break;
case PROP_ACTIVE_CHANNEL:
g_value_set_uint (value, nm_device_olpc_mesh_get_channel (device));
@ -749,13 +752,15 @@ nm_device_olpc_mesh_class_init (NMDeviceOlpcMeshClass *klass)
"Hardware MAC address",
NULL,
G_PARAM_READABLE));
g_object_class_install_property
(object_class, PROP_COMPANION,
g_param_spec_string (NM_DEVICE_OLPC_MESH_COMPANION,
"Companion device",
"Companion device object path",
NULL,
G_PARAM_READABLE));
g_param_spec_boxed (NM_DEVICE_OLPC_MESH_COMPANION,
"Companion device",
"Companion device object path",
DBUS_TYPE_G_OBJECT_PATH,
G_PARAM_READABLE));
g_object_class_install_property
(object_class, PROP_ACTIVE_CHANNEL,
g_param_spec_uint (NM_DEVICE_OLPC_MESH_ACTIVE_CHANNEL,
@ -801,7 +806,11 @@ companion_notify_cb (NMDeviceWifi *companion, GParamSpec *pspec, gpointer user_d
/* disconnect from mesh if someone starts using the companion */
static void
companion_state_changed_cb (NMDeviceWifi *companion, NMDeviceState state, NMDeviceState old_state, NMDeviceStateReason reason, gpointer user_data)
companion_state_changed_cb (NMDeviceWifi *companion,
NMDeviceState state,
NMDeviceState old_state,
NMDeviceStateReason reason,
gpointer user_data)
{
NMDeviceOlpcMesh *self = NM_DEVICE_OLPC_MESH (user_data);
NMDeviceState self_state = nm_device_get_state (NM_DEVICE (self));
@ -880,6 +889,8 @@ is_companion (NMDeviceOlpcMesh *self, NMDevice *other)
g_signal_connect (G_OBJECT (other), "autoconnect-allowed",
G_CALLBACK (companion_autoconnect_allowed_cb), self);
g_object_notify (G_OBJECT (self), NM_DEVICE_OLPC_MESH_COMPANION);
return TRUE;
}