Cleaned up namespace: networkmanager.applet.
[cnetworkmanager.git] / networkmanager / applet / __init__.py
blobd78ae068592cfc084074d8fcebd9f8292abed701
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"""
6 import dbus
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
24 Methods:
25 ListConnections ( ) → ao
27 Signals:
28 NewConnection ( o: connection )
29 """
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(
45 signals = {
46 "NewConnection": [void, [Connection]],
50 "Alias"
51 Applet = NetworkManagerSettings