GNOME Bugzilla – Bug 736233
nm_client_add_and_activate_connection needs better documentation
Last modified: 2014-10-05 15:21:41 UTC
As discussed in bug #693024, to use nm_client_add_and_activate_connection() properly you need to subscribe to the state property of the NMActiveConnection in the callback and then look for state changes to see if it succeeded. But there's no way to know this from the documentation, which just states that "the connection is then activated." [1] Since the callback receives a GError, a reasonable programmer would expect the callback to not be called until the activation has either succeeded or failed. I guess this probably affects nm_client_activate_connection as well. A quick check of gnome-control-center's network panel shows 15 uses of these functions, zero of which are correct. [1] https://developer.gnome.org/libnm-glib/0.9/NMClient.html#nm-client-add-and-activate-connection
added + * + * Note that the callback is invoked when NetworkManager has started activating + * the new connection, not when it finishes. You can used the returned + * #NMActiveConnection object (in particular, #NMActiveConnection:state) to + * track the activation to its completion. in both master and nm-0-9-10