Clean up old warnings and set up tasks to build all active projects #287

Merged
savanni merged 9 commits from nix-build-updates into main 2025-01-19 19:57:13 +00:00
3 changed files with 20 additions and 8 deletions
Showing only changes of commit 35abcfcf28 - Show all commits

1
Cargo.lock generated
View File

@ -3540,6 +3540,7 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
name = "screenplay"
version = "0.1.0"
dependencies = [
"async-std",
"glib",
"gtk4",
]

View File

@ -7,5 +7,6 @@ license = "GPL-3.0-only"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
async-std = "1.13.0"
glib = { version = "0.18" }
gtk = { version = "0.7", package = "gtk4" }

View File

@ -67,7 +67,7 @@ impl Screenplay {
pub fn new(gtk_app: &gtk::Application, screens: Vec<Screen>) -> Result<Self, Error> {
let window = gtk::ApplicationWindow::new(gtk_app);
let (sender, receiver) = gtk::glib::MainContext::channel(gtk::glib::Priority::DEFAULT);
let (sender, receiver) = async_std::channel::unbounded();
let layout = gtk::Box::builder()
.orientation(gtk::Orientation::Horizontal)
@ -89,11 +89,15 @@ impl Screenplay {
layout.append(&frame);
listbox.connect_row_activated(move |_, row| {
match row.index() {
-1 => sender.send(Action::Deselect),
idx => sender.send(Action::SelectPage(idx as usize)),
}
.unwrap()
let sender = sender.clone();
let row = row.clone();
glib::spawn_future_local(async move {
match row.index() {
-1 => sender.send(Action::Deselect).await,
idx => sender.send(Action::SelectPage(idx as usize)).await,
}
.unwrap()
});
});
screens.iter().for_each(|Screen { title, .. }| {
@ -107,8 +111,14 @@ impl Screenplay {
let storybook = Self { frame, screens };
{
let mut storybook = storybook.clone();
receiver.attach(None, move |message| storybook.process_action(message));
glib::spawn_future_local({
let mut storybook = storybook.clone();
async move {
while let Ok(msg) = receiver.recv().await {
storybook.process_action(msg);
}
}
});
}
Ok(storybook)