I took a look at the sources of NetworkManager and I noted that there are
several files called nm-device.h that offer different interfaces. The one
exported in libnm-glib does not expose as much functionality as I need. In
particular the following function is not provided:
gboolean nm_device_disconnect (NMDevice *device, GError **error)
{
NMDevicePrivate *priv;
g_return_val_if_fail (device != NULL, FALSE);
g_return_val_if_fail (NM_IS_DEVICE (device), FALSE);
priv = NM_DEVICE_GET_PRIVATE (device);
if (priv->state <= NM_DEVICE_STATE_DISCONNECTED) {
g_set_error_literal (error, NM_DEVICE_ERROR,
NM_DEVICE_ERROR_NOT_ACTIVE,
"Cannot disconnect an inactive device.");
return FALSE;
}
priv->autoconnect_inhibit = TRUE;
nm_device_state_changed (device,
NM_DEVICE_STATE_DISCONNECTED,
NM_DEVICE_STATE_REASON_USER_REQUESTED);
return TRUE;
}
why is that so ? I wonder if this function is not exposed due to a
synchronization problem with the GUI.
-- Manuel
On 04/01/2014 08:16 PM, Dan Winship wrote:
On 04/01/2014 01:18 PM, Manuel Yguel wrote:
however in the include directory of libnm-glib the file nm-device.h
contains only the following function:
void nm_device_disconnect (NMDevice *device,
NMDeviceDeactivateFn callback, gpointer user_data);
I tried to use the last one with a dummy callback function and with a
pointer to a NMClient object but it did not disconnect the network.
Thanks for any hint or pointer.
A libnm-glib method that takes a callback is most likely asynchronous.
So you need to call nm_device_disconnect() and then run the main loop
until the callback gets called.
-- Dan
_______________________________________________
networkmanager-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/networkmanager-list