After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 736233 - nm_client_add_and_activate_connection needs better documentation
nm_client_add_and_activate_connection needs better documentation
Status: RESOLVED FIXED
Product: NetworkManager
Classification: Platform
Component: API
0.9.x
Other Linux
: Normal normal
: ---
Assigned To: NetworkManager maintainer(s)
NetworkManager maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2014-09-07 14:05 UTC by Michael Catanzaro
Modified: 2014-10-05 15:21 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Michael Catanzaro 2014-09-07 14:05:03 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
Comment 1 Dan Winship 2014-10-05 15:21:41 UTC
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