[MERGE] Using NetworkManager

Wouter van Heyst larstiq at larstiq.dyndns.org
Sat Feb 3 17:37:18 GMT 2007


On Sat, Feb 03, 2007 at 06:08:13PM +0100, Jelmer Vernooij wrote:
> The attached patch makes the GTK+ commit dialog set a sane default by
> asking NetworkManager (if available) whether there is a network
> connection.

A very nice idea.

>  from errors import show_bzr_error
>  
> +try:
> +    import dbus
> +    import dbus.glib
> +    bus = dbus.SystemBus()
> +    proxy_obj = bus.get_object('org.freedesktop.NetworkManager', 
> +                              '/org/freedesktop/NetworkManager')
> +    dbus_iface = dbus.Interface(proxy_obj, 'org.freedesktop.NetworkManager')
> +    have_nm = True
> +except ImportError:
> +    have_nm = False
> +

I don't know dbus, but how much of the statements inside the try are
subject to failure? I don't suppose the get_object query raises an
ImportError when it can't find /org/freedesktop/NetworkManager.

Wouter van Heyst
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: Digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20070203/9b1b7752/attachment.pgp 


More information about the bazaar mailing list