NetworkMangerSettings -> NetworkManager.Settings
Just for consistency, make settings related stuff live under the org.freedesktop.NetworkManager namespace, rather than its own org.freedesktop.NetworkManagerSettings namespace. Renames are done for DBus interface names, DBus object paths, and polkit actions.
This commit is contained in:
@@ -41,8 +41,8 @@ con = dbus.Dictionary({
|
||||
|
||||
bus = dbus.SystemBus()
|
||||
|
||||
proxy = bus.get_object("org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManagerSettings")
|
||||
settings = dbus.Interface(proxy, "org.freedesktop.NetworkManagerSettings")
|
||||
proxy = bus.get_object("org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager/Settings")
|
||||
settings = dbus.Interface(proxy, "org.freedesktop.NetworkManager.Settings")
|
||||
|
||||
settings.AddConnection(con)
|
||||
|
||||
|
@@ -73,21 +73,21 @@ def connection_to_string(config):
|
||||
def print_connections():
|
||||
# Ask the settings service for the list of connections it provides
|
||||
service_name = "org.freedesktop.NetworkManager"
|
||||
proxy = bus.get_object(service_name, "/org/freedesktop/NetworkManagerSettings")
|
||||
settings = dbus.Interface(proxy, "org.freedesktop.NetworkManagerSettings")
|
||||
proxy = bus.get_object(service_name, "/org/freedesktop/NetworkManager/Settings")
|
||||
settings = dbus.Interface(proxy, "org.freedesktop.NetworkManager.Settings")
|
||||
connection_paths = settings.ListConnections()
|
||||
|
||||
# List each connection's name, UUID, and type
|
||||
for path in connection_paths:
|
||||
con_proxy = bus.get_object(service_name, path)
|
||||
connection = dbus.Interface(con_proxy, "org.freedesktop.NetworkManagerSettings.Connection")
|
||||
connection = dbus.Interface(con_proxy, "org.freedesktop.NetworkManager.Settings.Connection")
|
||||
config = connection.GetSettings()
|
||||
|
||||
# Now get secrets too; we grab the secrets for each type of connection
|
||||
# (since there isn't a "get all secrets" call because most of the time
|
||||
# you only need 'wifi' secrets or '802.1x' secrets, not everything) and
|
||||
# merge that into the configuration data
|
||||
connection_secrets = dbus.Interface(con_proxy, "org.freedesktop.NetworkManagerSettings.Connection.Secrets")
|
||||
connection_secrets = dbus.Interface(con_proxy, "org.freedesktop.NetworkManager.Settings.Connection.Secrets")
|
||||
merge_secrets(connection_secrets, config, '802-11-wireless')
|
||||
merge_secrets(connection_secrets, config, '802-11-wireless-security')
|
||||
merge_secrets(connection_secrets, config, '802-1x')
|
||||
|
@@ -54,7 +54,7 @@ for a in active:
|
||||
# can find the user-readable name of the connection.
|
||||
con_path = prop_iface.Get("org.freedesktop.NetworkManager.ActiveConnection", "Connection")
|
||||
service_proxy = bus.get_object("org.freedesktop.NetworkManager", con_path)
|
||||
con_iface = dbus.Interface(service_proxy, "org.freedesktop.NetworkManagerSettings.Connection")
|
||||
con_iface = dbus.Interface(service_proxy, "org.freedesktop.NetworkManager.Settings.Connection")
|
||||
con_details = con_iface.GetSettings()
|
||||
con_name = con_details['connection']['id']
|
||||
|
||||
|
@@ -37,8 +37,8 @@ DBusGMainLoop(set_as_default=True)
|
||||
|
||||
def get_connections():
|
||||
bus = dbus.SystemBus()
|
||||
proxy = bus.get_object('org.freedesktop.NetworkManager', '/org/freedesktop/NetworkManagerSettings')
|
||||
iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.NetworkManagerSettings')
|
||||
proxy = bus.get_object('org.freedesktop.NetworkManager', '/org/freedesktop/NetworkManager/Settings')
|
||||
iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.NetworkManager.Settings')
|
||||
return iface.ListConnections()
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ def get_connection_by_uuid(uuid):
|
||||
bus = dbus.SystemBus()
|
||||
for c in get_connections():
|
||||
proxy = bus.get_object('org.freedesktop.NetworkManager', c)
|
||||
iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.NetworkManagerSettings.Connection')
|
||||
iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.NetworkManager.Settings.Connection')
|
||||
settings = iface.GetSettings()
|
||||
if settings['connection']['uuid'] == uuid:
|
||||
return c
|
||||
@@ -58,7 +58,7 @@ def list_uuids():
|
||||
bus = dbus.SystemBus()
|
||||
for c in get_connections():
|
||||
proxy = bus.get_object('org.freedesktop.NetworkManager', c)
|
||||
iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.NetworkManagerSettings.Connection')
|
||||
iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.NetworkManager.Settings.Connection')
|
||||
settings = iface.GetSettings()
|
||||
conn = settings['connection']
|
||||
print "%s - %s (%s)" % (conn['uuid'], conn['id'], conn['type'])
|
||||
@@ -77,7 +77,7 @@ def get_active_connection_path(uuid):
|
||||
path = iface.Get('org.freedesktop.NetworkManager.Connection.Active', 'Connection')
|
||||
|
||||
proxy = bus.get_object('org.freedesktop.NetworkManager', path)
|
||||
iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.NetworkManagerSettings.Connection')
|
||||
iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.NetworkManager.Settings.Connection')
|
||||
settings = iface.GetSettings()
|
||||
|
||||
if settings['connection']['uuid'] == uuid:
|
||||
|
Reference in New Issue
Block a user