2012-06-11 14:46:33 -05:00
|
|
|
#!/usr/bin/env python
|
2019-09-10 11:19:01 +02:00
|
|
|
# SPDX-License-Identifier: GPL-2.0+
|
2014-09-05 13:48:56 +02:00
|
|
|
|
2012-06-11 14:46:33 -05:00
|
|
|
#
|
2014-09-05 13:48:56 +02:00
|
|
|
# Copyright 2012 - 2014 Red Hat, Inc.
|
2012-06-11 14:46:33 -05:00
|
|
|
#
|
|
|
|
|
|
2015-11-11 10:37:07 +01:00
|
|
|
import gi
|
|
|
|
|
gi.require_version('NM', '1.0')
|
2014-09-05 13:48:56 +02:00
|
|
|
from gi.repository import NM
|
2012-06-11 14:46:33 -05:00
|
|
|
|
|
|
|
|
# This example asks settings service for all configured connections.
|
|
|
|
|
|
|
|
|
|
def print_values(setting, key, value, flags, data):
|
2017-12-02 12:44:50 +08:00
|
|
|
print(" %s.%s: %s" % (setting.get_name(), key, value))
|
2012-06-11 14:46:33 -05:00
|
|
|
|
2014-09-05 13:48:56 +02:00
|
|
|
if __name__ == "__main__":
|
2014-11-13 14:27:26 -05:00
|
|
|
# create Client object
|
|
|
|
|
client = NM.Client.new(None)
|
2014-09-05 13:48:56 +02:00
|
|
|
|
|
|
|
|
# get all connections
|
2014-11-13 14:27:26 -05:00
|
|
|
connections = client.get_connections()
|
2014-09-05 13:48:56 +02:00
|
|
|
|
|
|
|
|
# print the connections' details
|
2012-06-11 14:46:33 -05:00
|
|
|
for c in connections:
|
2017-12-02 12:44:50 +08:00
|
|
|
print("=== %s : %s ===" % (c.get_id(), c.get_path()))
|
2012-06-11 14:46:33 -05:00
|
|
|
c.for_each_setting_value(print_values, None)
|
2017-12-02 12:44:50 +08:00
|
|
|
print("\n")
|
2012-06-11 14:46:33 -05:00
|
|
|
|