diff --git a/crates/ledger-cli/src/main.rs b/crates/ledger-cli/src/main.rs index 3a6bfb9e..ad72abe7 100644 --- a/crates/ledger-cli/src/main.rs +++ b/crates/ledger-cli/src/main.rs @@ -170,10 +170,6 @@ impl ledger_gui::owner::Owner for ViewerOwner { ) } - fn close_books(&self) -> Result { - ledger_host::commands::close_books(&self.common) - } - fn new_books(&self, id: &str, currency: &str) -> Result { ledger_host::commands::new_books_and_home(&self.common, id, currency) } diff --git a/crates/ledger-gui/src/owner.rs b/crates/ledger-gui/src/owner.rs index 64d4b096..db1f41de 100644 --- a/crates/ledger-gui/src/owner.rs +++ b/crates/ledger-gui/src/owner.rs @@ -1,14 +1,16 @@ //! The viewer's Books menu (plan P2 "Viewer menu", D-19, D-32): the //! owner's own actions on the books, handed to the books server (back up -//! now, restore, new books, close the books, the format upgrade) or to the +//! now, restore, new books, the format upgrade) or to the //! owner's agent (connect). The viewer itself still never writes the //! books. //! //! ```text -//! GOAL: the owner backs up, restores, starts new books, closes the books -//! and connects an agent from the viewer, without a terminal. +//! GOAL: the owner backs up, restores, starts new books and connects an +//! agent from the viewer, without a terminal. (There is no "Close the +//! books": the app is the host, and a company's tab, or the window, +//! closes it: WB-app-2, WB-app-4.) //! SOURCE: plan P2 ("Viewer menu (D-19)": "Back up now", "Restore…", -//! "New books…", "Close the books" and "Connect an assistant…"; the +//! "New books…" and "Connect an assistant…"; the //! page it opens carries the two connect buttons; "Nothing in the viewer writes a book"); D-32 //! (no confinement: the viewer asks the server itself, as the //! command line does); plan 3.9 and D-39 (the format upgrade: the @@ -286,8 +288,6 @@ pub trait Owner: Send + Sync { fn make_key(&self, _book: &str) -> Result { Err("not here".into()) } - /// Close the books: everything holding them lets go. - fn close_books(&self) -> Result; /// New, empty books `id` in `currency`. fn new_books(&self, id: &str, currency: &str) -> Result; /// Back the books `book` up now. @@ -410,8 +410,6 @@ enum Dialog { NewBooks { id: String, currency: String }, /// "Restore…": the backup, then its preview. Restore(Box), - /// "Close the books": asked first. - Close, /// The format upgrade: the go-ahead, with the owner passphrase. Upgrade(Box), } @@ -760,14 +758,6 @@ impl OwnerMenu { Box::new(move || o.apply_update()), )); } - ui.separator(); - if ui - .button(format!("{} Close the books", icon::POWER)) - .on_hover_text("Close the books now: assistants' sessions and every other holder let go") - .clicked() - { - self.dialog = Dialog::Close; - } }) }) .inner; @@ -854,26 +844,6 @@ impl OwnerMenu { ); } } - Dialog::Close => { - egui::Modal::new(self.scope.unwrap_or(egui::Id::NULL).with("owner-close")).show(ctx, |ui| { - ui.heading("Close the books?"); - ui.label("Assistants' sessions and everything else holding them let go. They open again when something holds them."); - ui.horizontal(|ui| { - if ui.button("Close the books").clicked() { - let o = owner.clone(); - run = Some(( - "Close the books".into(), - Effect::Changes("Closing the books"), - Box::new(move || o.close_books().map(|l| vec![l])), - )); - close = true; - } - if ui.button("Cancel").clicked() { - close = true; - } - }); - }); - } Dialog::NewBooks { id, currency } => { egui::Modal::new(self.scope.unwrap_or(egui::Id::NULL).with("owner-new-books")) .show(ctx, |ui| { diff --git a/crates/ledger-gui/tests/assistants.rs b/crates/ledger-gui/tests/assistants.rs index 28ba5ceb..6e1659a9 100644 --- a/crates/ledger-gui/tests/assistants.rs +++ b/crates/ledger-gui/tests/assistants.rs @@ -207,9 +207,6 @@ impl Owner for Fake { self.note(format!("connect {} {book}", agent.key())); Ok(vec![format!("{} reaches the books.", agent.label())]) } - fn close_books(&self) -> Result { - Err("not here".into()) - } fn new_books(&self, _: &str, _: &str) -> Result { Err("not here".into()) } diff --git a/crates/ledger-gui/tests/dock.rs b/crates/ledger-gui/tests/dock.rs index 067ed350..c9b7f842 100644 --- a/crates/ledger-gui/tests/dock.rs +++ b/crates/ledger-gui/tests/dock.rs @@ -28,9 +28,6 @@ struct Fake { } impl Owner for Fake { - fn close_books(&self) -> Result { - Err("not here".into()) - } fn new_books(&self, _: &str, _: &str) -> Result { Err("not here".into()) } diff --git a/crates/ledger-gui/tests/format_upgrade.rs b/crates/ledger-gui/tests/format_upgrade.rs index 2ed43663..5d8738f0 100644 --- a/crates/ledger-gui/tests/format_upgrade.rs +++ b/crates/ledger-gui/tests/format_upgrade.rs @@ -80,9 +80,6 @@ struct Fake { } impl Owner for Fake { - fn close_books(&self) -> Result { - Err("not in these tests".into()) - } fn new_books(&self, _id: &str, _currency: &str) -> Result { Err("not in these tests".into()) } diff --git a/crates/ledger-gui/tests/owner_menu.rs b/crates/ledger-gui/tests/owner_menu.rs index cbd2ab1f..ad83141e 100644 --- a/crates/ledger-gui/tests/owner_menu.rs +++ b/crates/ledger-gui/tests/owner_menu.rs @@ -33,10 +33,6 @@ impl Fake { } impl Owner for Fake { - fn close_books(&self) -> Result { - self.said("close".into()); - Ok("The books are closing.".into()) - } fn new_books(&self, id: &str, currency: &str) -> Result { self.said(format!("new {id} {currency}")); Ok(format!("Made new books \"{id}\" ({currency}).")) @@ -247,19 +243,11 @@ fn the_books_menu_hands_each_action_to_the_owner_and_writes_nothing() { "restore /media/disk/acme.git acme 7" ); - // Close the books: asked first; cancelled, nothing; then done. + // There is no "Close the books": a company's tab, or the window, closes + // the books (WB-app-2, WB-app-4). open_menu(&mut h); - h.get_by_label_contains("Close the books").click(); - h.run_steps(3); - h.get_by_label("Cancel").click(); - h.run_steps(3); - assert_eq!(f.asked.lock().unwrap().len(), start + 4); - open_menu(&mut h); - h.get_by_label_contains("Close the books").click(); - h.run_steps(3); - h.get_by_label("Close the books").click(); - settle(&mut h, &f, start + 5); - assert_eq!(f.asked.lock().unwrap()[start + 4], "close"); + assert!(h.query_by_label_contains("Close the books").is_none()); + h.run_steps(2); // The viewer wrote nothing of the books. drop(h); @@ -409,7 +397,4 @@ fn screenshots() { settle(&mut h, &f, n + 1); shot(&mut h, "restore-plan"); h.get_by_label("Cancel").click(); - open_menu(&mut h); - h.get_by_label_contains("Close the books").click(); - shot(&mut h, "close"); } diff --git a/crates/ledger-gui/tests/serving.rs b/crates/ledger-gui/tests/serving.rs index 6c5b7da5..00762696 100644 --- a/crates/ledger-gui/tests/serving.rs +++ b/crates/ledger-gui/tests/serving.rs @@ -173,9 +173,6 @@ impl Owner for Fake { fn serve_exited(&self) -> Option { self.exited.lock().unwrap().clone() } - fn close_books(&self) -> Result { - Err("not here".into()) - } fn new_books(&self, _: &str, _: &str) -> Result { Err("not here".into()) } @@ -461,9 +458,6 @@ fn a_window_with_no_server_asks_nothing_of_any() { // An owner that does not host a server: the default. struct Plain; impl Owner for Plain { - fn close_books(&self) -> Result { - Err("not here".into()) - } fn new_books(&self, _: &str, _: &str) -> Result { Err("not here".into()) } diff --git a/crates/ledger-gui/tests/sidenav.rs b/crates/ledger-gui/tests/sidenav.rs index 2df51108..4c78b799 100644 --- a/crates/ledger-gui/tests/sidenav.rs +++ b/crates/ledger-gui/tests/sidenav.rs @@ -36,9 +36,6 @@ use std::sync::{Arc, OnceLock}; struct Quiet; impl Owner for Quiet { - fn close_books(&self) -> Result { - Err("not here".into()) - } fn new_books(&self, _: &str, _: &str) -> Result { Err("not here".into()) } diff --git a/crates/ledger-gui/tests/tabs.rs b/crates/ledger-gui/tests/tabs.rs index af260588..515176a8 100644 --- a/crates/ledger-gui/tests/tabs.rs +++ b/crates/ledger-gui/tests/tabs.rs @@ -578,9 +578,6 @@ struct Agentic { } impl Owner for Agentic { - fn close_books(&self) -> Result { - Err("not here".into()) - } fn new_books(&self, _: &str, _: &str) -> Result { Err("not here".into()) } @@ -2095,10 +2092,6 @@ impl Gated { } impl Owner for Gated { - fn close_books(&self) -> Result { - self.block(); - Ok("The books are closing.".into()) - } fn new_books(&self, _: &str, _: &str) -> Result { Err("not here".into()) } diff --git a/crates/ledger-gui/tests/update_notice.rs b/crates/ledger-gui/tests/update_notice.rs index 94a691a5..91d3be45 100644 --- a/crates/ledger-gui/tests/update_notice.rs +++ b/crates/ledger-gui/tests/update_notice.rs @@ -33,9 +33,6 @@ impl Fake { } impl Owner for Fake { - fn close_books(&self) -> Result { - Err("not in these tests".into()) - } fn new_books(&self, _: &str, _: &str) -> Result { Err("not in these tests".into()) } diff --git a/crates/ledger-gui/tests/welcome.rs b/crates/ledger-gui/tests/welcome.rs index 05fdb0c1..b8fcc736 100644 --- a/crates/ledger-gui/tests/welcome.rs +++ b/crates/ledger-gui/tests/welcome.rs @@ -35,9 +35,6 @@ impl Fake { } impl Owner for Fake { - fn close_books(&self) -> Result { - Err("not here".into()) - } fn new_books(&self, id: &str, currency: &str) -> Result { self.said(format!("new {id} {currency}")); let (_, root) = self.root_path();