1 # -*- coding: utf-8 -*-
2 """'Applet' is what NM calls NetworkManagerSettings.
3 It is renamed in this library to reduce confusion with 'Settings'
4 which is the nested map returned by NMS.Connection.GetSettings"""
7 from ..dbusclient
import DBusClient
8 from ..dbusclient
.func
import *
9 from connection
import Connection
11 __all__
= ["Applet", "Connection",]
13 # need better/shorter names? or hide them?
14 SYSTEM_SERVICE
= "org.freedesktop.NetworkManagerSystemSettings"
15 USER_SERVICE
= "org.freedesktop.NetworkManagerUserSettings"
17 # TODO NMS.System, not in spec
19 class NetworkManagerSettings(DBusClient
):
20 """NetworkManagerSettings
22 The NM Settings client library
25 ListConnections ( ) → ao
28 NewConnection ( o: connection )
31 # FIXME into DBusCLient ctor
32 OPATH
= "/org/freedesktop/NetworkManagerSettings"
33 IFACE
= "org.freedesktop.NetworkManagerSettings"
35 def __init__(self
, service
):
36 # default_interface because knetworkmanager doesnt provide introspection
37 super(NetworkManagerSettings
, self
).__init
__(dbus
.SystemBus(), service
, self
.OPATH
, default_interface
= self
.IFACE
)
38 # need instance specific adaptors for user/system conn factories
39 self
._add
_adaptor
("methods", "ListConnections", seq_adaptor(self
._create
_connection
))
41 def _create_connection(self
, opath
):
42 return Connection(self
.bus_name
, opath
)
44 NetworkManagerSettings
._add
_adaptors
(
46 "NewConnection": [void
, [Connection
]],
51 Applet
= NetworkManagerSettings