summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDaniel Gnoutcheff <daniel@gnoutcheff.name>2010-08-06 21:02:50 -0400
committerDaniel Gnoutcheff <daniel@gnoutcheff.name>2010-08-07 01:19:45 -0400
commit8b1cac703cfd1e21d3e85cc9cd9ab0837ffd3d67 (patch)
tree50652878e3e0f7602b33e9016e0d12142054f2b1 /examples
parentf8a92d44cbec14c855f5c2b813b0940851889833 (diff)
downloadNetworkManager-8b1cac703cfd1e21d3e85cc9cd9ab0837ffd3d67.tar.gz
examples: update for user settings removal
Some of the example code broke when we removed user settings services. Oops!
Diffstat (limited to 'examples')
-rw-r--r--examples/python/list-connections.py9
-rw-r--r--examples/python/nm-state.py5
-rw-r--r--examples/python/vpn.py10
3 files changed, 9 insertions, 15 deletions
diff --git a/examples/python/list-connections.py b/examples/python/list-connections.py
index ad8d9047c4..de2ca18729 100644
--- a/examples/python/list-connections.py
+++ b/examples/python/list-connections.py
@@ -70,14 +70,13 @@ 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
+ service_name = "org.freedesktop.NetworkManager"
proxy = bus.get_object(service_name, "/org/freedesktop/NetworkManagerSettings")
settings = dbus.Interface(proxy, "org.freedesktop.NetworkManagerSettings")
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)
@@ -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()
diff --git a/examples/python/nm-state.py b/examples/python/nm-state.py
index fddd2da629..1ee4752814 100644
--- a/examples/python/nm-state.py
+++ b/examples/python/nm-state.py
@@ -53,10 +53,7 @@ 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.ActiveConnection", "Connection")
- con_service = prop_iface.Get("org.freedesktop.NetworkManager.ActiveConnection", "ServiceName")
-
- # ask the provider of the connection for its details
- service_proxy = bus.get_object(con_service, con_path)
+ service_proxy = bus.get_object("org.freedesktop.NetworkManagerSystemSettings", con_path)
con_iface = dbus.Interface(service_proxy, "org.freedesktop.NetworkManagerSettings.Connection")
con_details = con_iface.GetSettings()
con_name = con_details['connection']['id']
diff --git a/examples/python/vpn.py b/examples/python/vpn.py
index 4b4057fc2b..7e53f4bd9c 100644
--- a/examples/python/vpn.py
+++ b/examples/python/vpn.py
@@ -37,7 +37,7 @@ DBusGMainLoop(set_as_default=True)
def get_connections():
bus = dbus.SystemBus()
- proxy = bus.get_object('org.freedesktop.NetworkManagerUserSettings', '/org/freedesktop/NetworkManagerSettings')
+ proxy = bus.get_object('org.freedesktop.NetworkManagerSystemSettings', '/org/freedesktop/NetworkManagerSettings')
iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.NetworkManagerSettings')
return iface.ListConnections()
@@ -45,7 +45,7 @@ def get_connections():
def get_connection_by_uuid(uuid):
bus = dbus.SystemBus()
for c in get_connections():
- proxy = bus.get_object('org.freedesktop.NetworkManagerUserSettings', c)
+ proxy = bus.get_object('org.freedesktop.NetworkManagerSystemSettings', c)
iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.NetworkManagerSettings.Connection')
settings = iface.GetSettings()
if settings['connection']['uuid'] == uuid:
@@ -57,7 +57,7 @@ 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)
+ proxy = bus.get_object('org.freedesktop.NetworkManagerSystemSettings', c)
iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.NetworkManagerSettings.Connection')
settings = iface.GetSettings()
conn = settings['connection']
@@ -76,7 +76,7 @@ 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)
+ proxy = bus.get_object('org.freedesktop.NetworkManagerSystemSettings', path)
iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.NetworkManagerSettings.Connection')
settings = iface.GetSettings()
@@ -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.NetworkManagerSystemSettings',
connection_path,
device_path,
"/",