When is an interface not an interface?

View: New views
2 Messages — Rating Filter:   Alert me  

When is an interface not an interface?

by Will Stephenson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

...when it can be modified at will by its implementors.  Warning, rant ahead.

The DBUS interface org.freedesktop.NetworkManager.Connection.Active is
declared once in nm-active-connection.xml, including the signal
PropertiesChanged.

In nm-vpn-connection.xml this same interface is redeclared without the signal,
because the same file also declares
org.freedesktop.NetworkManager.VPN.Connection with a signal of the same name.
The Vpn property is also omitted.

As a result my interface object to a Connection.Active never receives
PropertiesChanged, because VPN.Connection emits this signal and
Connection.Active does not.

This is sloppy OO.  VPN connection objects should fulfil the interface that
they appear to advertise, allowing client authors to treat them as
activeconnections.  Not to mention that including the both bindings headers
from nm-active-connection.xml and nm-vpn-connection.xml gets me a compiler
error due to multiple definitions of the same class, so I have to maintain my
own copy of those files with the competing interface removed, increasing the
chance that I get out of sync with the NM I am building for.

I don't see any reason for the extra interface, can it be removed and can VPN
connections emit Connection.Active.PropertiesChanged?

Will
_______________________________________________
NetworkManager-list mailing list
NetworkManager-list@...
http://mail.gnome.org/mailman/listinfo/networkmanager-list

Re: When is an interface not an interface?

by Dan Williams :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, 2009-10-27 at 12:07 +0100, Will Stephenson wrote:
> ...when it can be modified at will by its implementors.  Warning, rant ahead.
>
> The DBUS interface org.freedesktop.NetworkManager.Connection.Active is
> declared once in nm-active-connection.xml, including the signal
> PropertiesChanged.

> In nm-vpn-connection.xml this same interface is redeclared without the signal,
> because the same file also declares
> org.freedesktop.NetworkManager.VPN.Connection with a signal of the same name.

https://bugzilla.gnome.org/show_bug.cgi?id=569294

The duplication is due to a limitation of dbus-glib.

> The Vpn property is also omitted.

An oversight, as the object actually does implement the property in
question.

> As a result my interface object to a Connection.Active never receives
> PropertiesChanged, because VPN.Connection emits this signal and
> Connection.Active does not.

We can and should attempt to fix this in NetworkManager as it's not
possible yet for this to be fixed in dbus-glib.

> This is sloppy OO.  VPN connection objects should fulfil the interface that
> they appear to advertise, allowing client authors to treat them as

The intention has always been to have the VPN objects implement the full
ActiveConnection D-Bus interface.  

> activeconnections.  Not to mention that including the both bindings headers
> from nm-active-connection.xml and nm-vpn-connection.xml gets me a compiler
> error due to multiple definitions of the same class, so I have to maintain my
> own copy of those files with the competing interface removed, increasing the
> chance that I get out of sync with the NM I am building for.

While NM specifically doesn't install the introspection XML for a reason
(the generated HTML document, not the introspection XML, is the official
API documentation the developers should be using), I understand the
issue it should be fixed.

I've synchronized the introspection XML here:

671f00c86f047dfe57f43726a0eefadaad6f2734 (master)
86eb8b831184a84e76caf7eacbc6aed856091196 (0.7.x)

though that doesn't fix PropertiesChanged signal emission for the other
dbus interface, which will take a bit more work.

Dan


_______________________________________________
NetworkManager-list mailing list
NetworkManager-list@...
http://mail.gnome.org/mailman/listinfo/networkmanager-list