Merge remote-tracking branch 'origin/rm-userset'
There; it's merged. Yay!
This commit is contained in:
@@ -41,8 +41,8 @@ con = dbus.Dictionary({
|
||||
|
||||
bus = dbus.SystemBus()
|
||||
|
||||
proxy = bus.get_object("org.freedesktop.NetworkManagerSystemSettings", "/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)
|
||||
|
||||
|
@@ -70,25 +70,24 @@ def connection_to_string(config):
|
||||
print ""
|
||||
|
||||
|
||||
def print_one_services_connections(service_name, desc):
|
||||
def print_connections():
|
||||
# Ask the settings service for the list of connections it provides
|
||||
proxy = bus.get_object(service_name, "/org/freedesktop/NetworkManagerSettings")
|
||||
settings = dbus.Interface(proxy, "org.freedesktop.NetworkManagerSettings")
|
||||
service_name = "org.freedesktop.NetworkManager"
|
||||
proxy = bus.get_object(service_name, "/org/freedesktop/NetworkManager/Settings")
|
||||
settings = dbus.Interface(proxy, "org.freedesktop.NetworkManager.Settings")
|
||||
connection_paths = settings.ListConnections()
|
||||
|
||||
print "%s connections --------------------------------------------\n" % desc
|
||||
|
||||
# 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')
|
||||
@@ -106,7 +105,5 @@ def print_one_services_connections(service_name, desc):
|
||||
|
||||
print ""
|
||||
|
||||
# Print out connection information for all connections
|
||||
print_one_services_connections("org.freedesktop.NetworkManagerSystemSettings", "System")
|
||||
print_one_services_connections("org.freedesktop.NetworkManagerUserSettings", "User")
|
||||
print_connections()
|
||||
|
||||
|
@@ -53,11 +53,8 @@ for a in active:
|
||||
# needed to connect to a specific network. Lets get those details so we
|
||||
# can find the user-readable name of the connection.
|
||||
con_path = prop_iface.Get("org.freedesktop.NetworkManager.Connection.Active", "Connection")
|
||||
con_service = prop_iface.Get("org.freedesktop.NetworkManager.Connection.Active", "ServiceName")
|
||||
|
||||
# ask the provider of the connection for its details
|
||||
service_proxy = bus.get_object(con_service, con_path)
|
||||
con_iface = dbus.Interface(service_proxy, "org.freedesktop.NetworkManagerSettings.Connection")
|
||||
service_proxy = bus.get_object("org.freedesktop.NetworkManager", con_path)
|
||||
con_iface = dbus.Interface(service_proxy, "org.freedesktop.NetworkManager.Settings.Connection")
|
||||
con_details = con_iface.GetSettings()
|
||||
con_name = con_details['connection']['id']
|
||||
|
||||
|
@@ -37,16 +37,16 @@ DBusGMainLoop(set_as_default=True)
|
||||
|
||||
def get_connections():
|
||||
bus = dbus.SystemBus()
|
||||
proxy = bus.get_object('org.freedesktop.NetworkManagerUserSettings', '/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()
|
||||
|
||||
|
||||
def get_connection_by_uuid(uuid):
|
||||
bus = dbus.SystemBus()
|
||||
for c in get_connections():
|
||||
proxy = bus.get_object('org.freedesktop.NetworkManagerUserSettings', c)
|
||||
iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.NetworkManagerSettings.Connection')
|
||||
proxy = bus.get_object('org.freedesktop.NetworkManager', c)
|
||||
iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.NetworkManager.Settings.Connection')
|
||||
settings = iface.GetSettings()
|
||||
if settings['connection']['uuid'] == uuid:
|
||||
return c
|
||||
@@ -57,8 +57,8 @@ def get_connection_by_uuid(uuid):
|
||||
def list_uuids():
|
||||
bus = dbus.SystemBus()
|
||||
for c in get_connections():
|
||||
proxy = bus.get_object('org.freedesktop.NetworkManagerUserSettings', c)
|
||||
iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.NetworkManagerSettings.Connection')
|
||||
proxy = bus.get_object('org.freedesktop.NetworkManager', c)
|
||||
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'])
|
||||
@@ -76,8 +76,8 @@ def get_active_connection_path(uuid):
|
||||
iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.DBus.Properties')
|
||||
path = iface.Get('org.freedesktop.NetworkManager.Connection.Active', 'Connection')
|
||||
|
||||
proxy = bus.get_object('org.freedesktop.NetworkManagerUserSettings', path)
|
||||
iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.NetworkManagerSettings.Connection')
|
||||
proxy = bus.get_object('org.freedesktop.NetworkManager', path)
|
||||
iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.NetworkManager.Settings.Connection')
|
||||
settings = iface.GetSettings()
|
||||
|
||||
if settings['connection']['uuid'] == uuid:
|
||||
@@ -112,7 +112,7 @@ def activate_connection(connection_path, device_path):
|
||||
bus = dbus.SystemBus()
|
||||
proxy = bus.get_object('org.freedesktop.NetworkManager', '/org/freedesktop/NetworkManager')
|
||||
iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.NetworkManager')
|
||||
iface.ActivateConnection('org.freedesktop.NetworkManagerUserSettings',
|
||||
iface.ActivateConnection('org.freedesktop.NetworkManager',
|
||||
connection_path,
|
||||
device_path,
|
||||
"/",
|
||||
|
Reference in New Issue
Block a user