Deduplicate network_manager body
This commit is contained in:
parent
c283df795e
commit
17d3c6469e
|
@ -14,30 +14,15 @@ pub async fn network_manager(
|
||||||
_output: OutputChannel,
|
_output: OutputChannel,
|
||||||
dbus_conn: Arc<SyncConnection>,
|
dbus_conn: Arc<SyncConnection>,
|
||||||
) -> eyre::Result<Infallible> {
|
) -> eyre::Result<Infallible> {
|
||||||
let root_proxy = Proxy::new(
|
|
||||||
"org.freedesktop.NetworkManager",
|
|
||||||
"/org/freedesktop/NetworkManager",
|
|
||||||
Duration::from_secs(5),
|
|
||||||
dbus_conn.as_ref(),
|
|
||||||
);
|
|
||||||
|
|
||||||
let primary_connection = root_proxy.primary_connection().await?;
|
let destination = "org.freedesktop.NetworkManager";
|
||||||
let primary_connection_proxy = Proxy::new(
|
let timeout = Duration::from_secs(5);
|
||||||
"org.freedesktop.NetworkManager",
|
let connection = dbus_conn.as_ref();
|
||||||
primary_connection,
|
let make_proxy = |path| Proxy::new(destination, path, timeout, connection);
|
||||||
Duration::from_secs(5),
|
|
||||||
dbus_conn.as_ref(),
|
|
||||||
);
|
|
||||||
|
|
||||||
let specific_object = primary_connection_proxy.specific_object().await?;
|
let primary_connection = make_proxy("/org/freedesktop/NetworkManager".into()).primary_connection().await?;
|
||||||
let specific_object_proxy = Proxy::new(
|
let specific_object = make_proxy(primary_connection).specific_object().await?;
|
||||||
"org.freedesktop.NetworkManager",
|
let ssid = make_proxy(specific_object).ssid().await?;
|
||||||
specific_object,
|
|
||||||
Duration::from_secs(5),
|
|
||||||
dbus_conn.as_ref(),
|
|
||||||
);
|
|
||||||
|
|
||||||
let ssid = specific_object_proxy.ssid().await?;
|
|
||||||
|
|
||||||
log::warn!("got ssid: {}", String::from_utf8_lossy(&ssid));
|
log::warn!("got ssid: {}", String::from_utf8_lossy(&ssid));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue