update iced

This commit is contained in:
Ashley Wulber 2024-10-30 22:51:08 -04:00 committed by Ashley Wulber
parent 11faa567f3
commit 5b5cd77e7c
45 changed files with 2360 additions and 1537 deletions

View file

@ -1,5 +1,8 @@
use super::{NetworkManagerEvent, NetworkManagerState};
use cosmic::iced::{self, subscription};
use cosmic::{
iced::{self, Subscription},
iced_futures::stream,
};
use cosmic_dbus_networkmanager::nm::NetworkManager;
use futures::{SinkExt, StreamExt};
use std::{fmt::Debug, hash::Hash};
@ -10,15 +13,18 @@ pub fn active_conns_subscription<I: 'static + Hash + Copy + Send + Sync + Debug>
conn: Connection,
) -> iced::Subscription<NetworkManagerEvent> {
let initial = State::Continue(conn);
subscription::channel(id, 50, move |mut output| {
let mut state = initial;
Subscription::run_with_id(
id,
stream::channel(50, move |mut output| {
let mut state = initial;
async move {
loop {
state = start_listening(state, &mut output).await;
async move {
loop {
state = start_listening(state, &mut output).await;
}
}
}
})
}),
)
}
#[derive(Debug, Clone)]