examples: update python examples
Update the raw D-Bus python examples to use newer APIs where appropriate (and split the add-connection example into 1.0-only and 0.9-compatible versions). Update the gi-based python examples for the various API changes since they were last updated. Also add a comment to the ruby add-connection example pointing out that it's still using the old settings APIs.
This commit is contained in:
@@ -23,21 +23,16 @@
|
||||
from gi.repository import NM
|
||||
|
||||
# This example asks settings service for all configured connections.
|
||||
# Unfortunately, at this time since libnm still makes heavy use of
|
||||
# GValue and GHashTable (rather than GVariant), libnm isn't fully
|
||||
# usable from GObject Introspection-ready languages. Most functions will
|
||||
# work fine, but e.g. nm_connection_to_dbus() causes failures.
|
||||
|
||||
|
||||
def print_values(setting, key, value, flags, data):
|
||||
print " %s.%s: %s" % (setting.get_name(), key, value)
|
||||
|
||||
if __name__ == "__main__":
|
||||
# create RemoteSettings object
|
||||
settings = NM.RemoteSettings.new(None)
|
||||
# create Client object
|
||||
client = NM.Client.new(None)
|
||||
|
||||
# get all connections
|
||||
connections = settings.list_connections()
|
||||
connections = client.get_connections()
|
||||
|
||||
# print the connections' details
|
||||
for c in connections:
|
||||
|
Reference in New Issue
Block a user