On Wed, 21 Dec 2011 10:21:45 -0200, Lamarque V. Souza wrote:
You should use the Settings path to get the settings for a connection:
I figured that out minutes before I saw your reply :S
DBUS Service: "org.freedesktop.NetworkManager"
DBUS Object Path: "/org/freedesktop/NetworkManager"
DBUS Interface: "org.freedesktop.NetworkManager"
This little snippet made me think. Depending which Object you're working with you have different Interfaces available to manipulate the object. I found the Settings object, eventually. Initially I was trying to work with a Devices object.
Now that I know this, I went over the example again and did see getConnection was indeed returning a settings path.
You should try QtNetworkManager instead of creating your program from scratch:
https://projects.kde.org/projects/kdereview/libnm-qt
QtNetworkManager make those details transparent. Unfortunately there is not small example of how to use it. I use it in Plasma NetworkManagement, but Plasma NM is a big program. If you want to try take a look at manager.h and connection.h, those probably contain the methods you are looking for.
This is great news. The bad news is that I am very new to Qt and C++ so it may be too tricky for me to get started without examples.
The functionality I need is the basic set: getting interfaces, IP addresses, default gateway, setting an IP addresses... Not much past that. Do you think you could put together a small example that lists interfaces and sets an IP address on an interface?
The GObject and Python APIs look so simple :(
Thanks for your reply,
--Daniel Devine