Add settings bindings
This commit is contained in:
parent
e660731756
commit
e2c2fdea8f
3 changed files with 36 additions and 15 deletions
|
|
@ -1,3 +1,28 @@
|
|||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
pub mod connection;
|
||||
|
||||
use self::connection::Connection;
|
||||
use crate::interface::settings::{connection::ConnectionSettingsProxy, SettingsProxy};
|
||||
use zbus::Result;
|
||||
|
||||
pub struct NetworkManagerSettings<'a>(SettingsProxy<'a>);
|
||||
|
||||
impl<'a> NetworkManagerSettings<'a> {
|
||||
pub async fn new(connection: &'a zbus::Connection) -> Result<NetworkManagerSettings<'a>> {
|
||||
SettingsProxy::new(connection).await.map(Self)
|
||||
}
|
||||
|
||||
pub async fn list_connections(&'a self) -> Result<Vec<Connection<'a>>> {
|
||||
let connections = self.0.list_connections().await?;
|
||||
let mut out = Vec::with_capacity(connections.len());
|
||||
for connection in connections {
|
||||
let connection = ConnectionSettingsProxy::builder(self.0.connection())
|
||||
.path(connection)?
|
||||
.build()
|
||||
.await?;
|
||||
out.push(connection.into());
|
||||
}
|
||||
Ok(out)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue