mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-29 13:50:13 +01:00
wifi: add and use nm_device_wifi_get_scanning()
Don't read GObject properties. It's inefficient and harder to track who calls who.
This commit is contained in:
parent
d2ee666dd7
commit
f1da7cb452
3 changed files with 16 additions and 7 deletions
|
|
@ -130,7 +130,6 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason)
|
|||
{
|
||||
NMDeviceOlpcMesh *self = NM_DEVICE_OLPC_MESH (device);
|
||||
NMDeviceOlpcMeshPrivate *priv = NM_DEVICE_OLPC_MESH_GET_PRIVATE (self);
|
||||
gboolean scanning;
|
||||
|
||||
/* disconnect companion device, if it is connected */
|
||||
if (nm_device_get_act_request (NM_DEVICE (priv->companion))) {
|
||||
|
|
@ -145,8 +144,7 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason)
|
|||
}
|
||||
|
||||
/* wait with continuing configuration until the companion device is done scanning */
|
||||
g_object_get (priv->companion, NM_DEVICE_WIFI_SCANNING, &scanning, NULL);
|
||||
if (scanning) {
|
||||
if (nm_device_wifi_get_scanning (NM_DEVICE_WIFI (priv->companion))) {
|
||||
priv->stage1_waiting = TRUE;
|
||||
return NM_ACT_STAGE_RETURN_POSTPONE;
|
||||
}
|
||||
|
|
@ -248,13 +246,14 @@ companion_notify_cb (NMDeviceWifi *companion, GParamSpec *pspec, gpointer user_d
|
|||
{
|
||||
NMDeviceOlpcMesh *self = NM_DEVICE_OLPC_MESH (user_data);
|
||||
NMDeviceOlpcMeshPrivate *priv = NM_DEVICE_OLPC_MESH_GET_PRIVATE (self);
|
||||
gboolean scanning;
|
||||
|
||||
nm_assert (NM_IS_DEVICE_WIFI (companion));
|
||||
nm_assert (priv->companion == (gpointer) companion);
|
||||
|
||||
if (!priv->stage1_waiting)
|
||||
return;
|
||||
|
||||
g_object_get (companion, NM_DEVICE_WIFI_SCANNING, &scanning, NULL);
|
||||
if (!scanning) {
|
||||
if (!nm_device_wifi_get_scanning (NM_DEVICE_WIFI (companion))) {
|
||||
priv->stage1_waiting = FALSE;
|
||||
nm_device_activate_schedule_stage1_device_prepare (NM_DEVICE (self), FALSE);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -209,6 +209,14 @@ _ap_dump (NMDeviceWifi *self,
|
|||
nm_wifi_ap_to_string (ap, buf, sizeof (buf), now_msec));
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_device_wifi_get_scanning (NMDeviceWifi *self)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_DEVICE_WIFI (self), FALSE);
|
||||
|
||||
return NM_DEVICE_WIFI_GET_PRIVATE (self)->is_scanning;
|
||||
}
|
||||
|
||||
static void
|
||||
_notify_scanning (NMDeviceWifi *self)
|
||||
{
|
||||
|
|
@ -3276,7 +3284,7 @@ get_property (GObject *object, guint prop_id,
|
|||
nm_dbus_utils_g_value_set_object_path (value, priv->current_ap);
|
||||
break;
|
||||
case PROP_SCANNING:
|
||||
g_value_set_boolean (value, priv->is_scanning);
|
||||
g_value_set_boolean (value, nm_device_wifi_get_scanning (self));
|
||||
break;
|
||||
case PROP_LAST_SCAN:
|
||||
g_value_set_int64 (value,
|
||||
|
|
|
|||
|
|
@ -42,4 +42,6 @@ void _nm_device_wifi_request_scan (NMDeviceWifi *self,
|
|||
|
||||
GPtrArray *nmtst_ssids_options_to_ptrarray (GVariant *value, GError **error);
|
||||
|
||||
gboolean nm_device_wifi_get_scanning (NMDeviceWifi *self);
|
||||
|
||||
#endif /* __NETWORKMANAGER_DEVICE_WIFI_H__ */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue