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 693669 - expose NMDevice:available-connections
expose NMDevice:available-connections
Status: RESOLVED FIXED
Product: NetworkManager
Classification: Platform
Component: API
unspecified
Other All
: Normal normal
: ---
Assigned To: NetworkManager maintainer(s)
NetworkManager maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2013-02-12 18:18 UTC by Dan Winship
Modified: 2013-02-14 14:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
libnm-glib: fix NMRemoteConnection GInitable implementation (1.07 KB, patch)
2013-02-12 18:18 UTC, Dan Winship
committed Details | Review
libnm-util, libnm-glib: Make NMRemoteConnection instantiable by NMObject (3.89 KB, patch)
2013-02-12 18:18 UTC, Dan Winship
committed Details | Review
libnm-glib: add NMDevice:available-connections (5.41 KB, patch)
2013-02-12 18:18 UTC, Dan Winship
committed Details | Review

Description Dan Winship 2013-02-12 18:18:16 UTC
noticed in another bug; NMDevice is not exposing its new(ish)
available-connections property.
Comment 1 Dan Winship 2013-02-12 18:18:18 UTC
Created attachment 235804 [details] [review]
libnm-glib: fix NMRemoteConnection GInitable implementation

apparently this never got tested...
Comment 2 Dan Winship 2013-02-12 18:18:19 UTC
Created attachment 235805 [details] [review]
libnm-util, libnm-glib: Make NMRemoteConnection instantiable by NMObject

In order to resolve NMRemoteConnection-valued properties, NMObject
needs to be able to create NMRemoteConnections. But NMObject assumes
that all the objects it will be creating have "dbus-connection" and
"dbus-path" properties. So add those properties to NMRemoteConnection,
aliasing the existing "bus" and "path" properties (and ensure that
whichever version gets set, we keep that value, rather than letting it
get overwritten by the NULL default value of the other one).
Comment 3 Dan Winship 2013-02-12 18:18:21 UTC
Created attachment 235806 [details] [review]
libnm-glib: add NMDevice:available-connections

NMDevice has a D-Bus "AvailableConnections" property, but we weren't
exposing it on NMDevice. Fix that.
Comment 4 Jiri Klimes 2013-02-14 12:58:57 UTC
Review of attachment 235804 [details] [review]:

Good catch. I wonder how it could work, probably it didn't but was not used.
Comment 5 Jiri Klimes 2013-02-14 13:05:10 UTC
Review of attachment 235805 [details] [review]:

Looks fine.

::: libnm-glib/nm-remote-connection.c
@@ +546,3 @@
+							  "DBus Object Path",
+							  NULL,
+							 "DBusGConnection",

Should be indented with spaces. I know there are tabs on many places in g_object_class_install_property(), but we could use spaces for new code.
Comment 6 Jiri Klimes 2013-02-14 13:11:42 UTC
Review of attachment 235806 [details] [review]:

Other than that it is OK.

::: libnm-glib/nm-device.c
@@ +343,3 @@
+		for (i = 0; i < priv->available_connections->len; i++)
+			g_object_unref (priv->available_connections->pdata[i]);
+		g_ptr_array_free (priv->available_connections, TRUE);

Freeing in dispose() could be simplified a bit:
if (priv->available_connections) {
    g_ptr_array_foreach (priv->available_connections, (GFunc) g_object_unref, NULL);
    g_ptr_array_free (priv->available_connections, TRUE);
    priv->available_connections = NULL;
}

@@ +1291,3 @@
+ * @device: a #NMDevice
+ *
+ * Gets the #NMRemoteConnections currently known to the daemon that could

#NMRemoteConnections  ->  #NMRemoteConnection<!-- -->s
Comment 7 Dan Winship 2013-02-14 14:09:56 UTC
(In reply to comment #6)
> Review of attachment 235806 [details] [review]:
> + * Gets the #NMRemoteConnections currently known to the daemon that could
> 
> #NMRemoteConnections  ->  #NMRemoteConnection<!-- -->s

nope, gtk-doc got fixed at some point (quite a while ago now) to recognize regular plurals. eg, "#SoupSessions" in http://git.gnome.org/browse/libsoup/tree/libsoup/soup-session.c#n3027 becomes http://developer.gnome.org/libsoup/2.41/SoupSession.html#SoupSession--idle-timeout
Comment 8 Dan Winship 2013-02-14 14:33:38 UTC
fixed the indentation. I left the code in dispose() as it was, because
it's consistent with other libnm-glib code (and I don't like casting
function pointers to types with different numbers of arguments).

Attachment 235804 [details] pushed as 7c5cf25 - libnm-glib: fix NMRemoteConnection GInitable implementation
Attachment 235805 [details] pushed as 24cda2b - libnm-util, libnm-glib: Make NMRemoteConnection instantiable by NMObject
Attachment 235806 [details] pushed as 43f259e - libnm-glib: add NMDevice:available-connections