Merge branch 'master' of https://github.com/Wifx/gonetworkmanager
This commit is contained in:
commit
594bfca331
1 changed files with 15 additions and 1 deletions
16
Settings.go
16
Settings.go
|
@ -10,7 +10,7 @@ const (
|
||||||
|
|
||||||
/* Methods */
|
/* Methods */
|
||||||
SettingsListConnections = SettingsInterface + ".ListConnections"
|
SettingsListConnections = SettingsInterface + ".ListConnections"
|
||||||
SettingsGetConnectionByUuid = SettingsInterface + ".GetConnectionByUuid"
|
SettingsGetConnectionByUUID = SettingsInterface + ".GetConnectionByUuid"
|
||||||
SettingsAddConnection = SettingsInterface + ".AddConnection"
|
SettingsAddConnection = SettingsInterface + ".AddConnection"
|
||||||
SettingsAddConnectionUnsaved = SettingsInterface + ".AddConnectionUnsaved"
|
SettingsAddConnectionUnsaved = SettingsInterface + ".AddConnectionUnsaved"
|
||||||
SettingsLoadConnections = SettingsInterface + ".LoadConnections"
|
SettingsLoadConnections = SettingsInterface + ".LoadConnections"
|
||||||
|
@ -27,6 +27,9 @@ type Settings interface {
|
||||||
// ListConnections gets list the saved network connections known to NetworkManager
|
// ListConnections gets list the saved network connections known to NetworkManager
|
||||||
ListConnections() ([]Connection, error)
|
ListConnections() ([]Connection, error)
|
||||||
|
|
||||||
|
// GetConnectionByUUID gets the connection, given that connection's UUID.
|
||||||
|
GetConnectionByUUID(uuid string) (Connection, error)
|
||||||
|
|
||||||
// AddConnection adds new connection and save it to disk.
|
// AddConnection adds new connection and save it to disk.
|
||||||
AddConnection(settings ConnectionSettings) (Connection, error)
|
AddConnection(settings ConnectionSettings) (Connection, error)
|
||||||
|
|
||||||
|
@ -72,6 +75,17 @@ func (s *settings) ListConnections() ([]Connection, error) {
|
||||||
return connections, nil
|
return connections, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetConnectionByUUID gets the connection, given that connection's UUID.
|
||||||
|
func (s *settings) GetConnectionByUUID(uuid string) (Connection, error) {
|
||||||
|
var path dbus.ObjectPath
|
||||||
|
err := s.callWithReturn(&path, SettingsGetConnectionByUUID, uuid)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return NewConnection(path)
|
||||||
|
}
|
||||||
|
|
||||||
func (s *settings) AddConnection(settings ConnectionSettings) (Connection, error) {
|
func (s *settings) AddConnection(settings ConnectionSettings) (Connection, error) {
|
||||||
var path dbus.ObjectPath
|
var path dbus.ObjectPath
|
||||||
err := s.callWithReturn(&path, SettingsAddConnection, settings)
|
err := s.callWithReturn(&path, SettingsAddConnection, settings)
|
||||||
|
|
Reference in a new issue