diff --git a/linux/changelog.d/4111.added.md b/linux/changelog.d/4111.added.md new file mode 100644 index 0000000000..478733d230 --- /dev/null +++ b/linux/changelog.d/4111.added.md @@ -0,0 +1 @@ +A table tab's Structure view shares the tab's bottom bar instead of stacking a second one. diff --git a/linux/crates/app/src/ui/browse_tab/imp.rs b/linux/crates/app/src/ui/browse_tab/imp.rs index 52775ceeb0..bccfe04630 100644 --- a/linux/crates/app/src/ui/browse_tab/imp.rs +++ b/linux/crates/app/src/ui/browse_tab/imp.rs @@ -34,6 +34,18 @@ pub struct BrowseTab { #[template_child] pub view_toggle: TemplateChild, #[template_child] + pub structure_start: TemplateChild, + #[template_child] + pub structure_end: TemplateChild, + #[template_child] + pub structure_details: TemplateChild, + #[template_child] + pub structure_secondary: TemplateChild, + #[template_child] + pub structure_primary: TemplateChild, + #[template_child] + pub structure_more: TemplateChild, + #[template_child] pub data_start: TemplateChild, #[template_child] pub data_end: TemplateChild, @@ -58,6 +70,8 @@ pub struct BrowseTab { #[template_child] pub action_bar: TemplateChild, #[template_child] + pub overflow_button: TemplateChild, + #[template_child] pub more_button: TemplateChild, #[template_child] pub export_button: TemplateChild, diff --git a/linux/crates/app/src/ui/browse_tab/layout.rs b/linux/crates/app/src/ui/browse_tab/layout.rs index 33852ad23c..ebd8c986d1 100644 --- a/linux/crates/app/src/ui/browse_tab/layout.rs +++ b/linux/crates/app/src/ui/browse_tab/layout.rs @@ -40,6 +40,7 @@ pub(super) fn build(tab: &BrowseTab, init: &LayoutInit<'_>) -> BrowseTabWidgets imp.inner_stack.set_visible_child_name("loading"); imp.read_only_banner.set_revealed(init.read_only); let page_sizes = page_size_choices(&imp.page_size_dropdown, init.page_size); + imp.overflow_button.set_menu_model(Some(&overflow_menu(&page_sizes))); imp.more_button.set_menu_model(Some(&more_menu(&page_sizes))); connect_controls(tab, page_sizes.clone()); BrowseTabWidgets { @@ -62,23 +63,12 @@ pub(super) fn build(tab: &BrowseTab, init: &LayoutInit<'_>) -> BrowseTabWidgets } fn more_menu(page_sizes: &[u64]) -> gio::Menu { - let export = gio::MenuItem::new(Some(&gettext("_Export Rows…")), Some("browse.export")); - // The window's Export Results key reaches this tab's Export. - if let Some(key) = crate::application::triggers_for("win.export-results").first() { - export.set_attribute_value("accel", Some(&key.to_variant())); - } let actions = gio::Menu::new(); actions.append(Some(&gettext("_Filter Rows")), Some("browse.filter")); actions.append(Some(&gettext("Col_umns…")), Some("grid.columns")); - actions.append_item(&export); + actions.append_item(&export_item()); actions.append(Some(&gettext("_Count Rows")), Some("browse.count-rows")); actions.append(Some(&gettext("_Highlight Rules…")), Some("grid.highlight-rules")); - let sizes = gio::Menu::new(); - for size in page_sizes { - let item = gio::MenuItem::new(Some(&format_thousands(*size)), None); - item.set_action_and_target_value(Some("browse.page-size"), Some(&size.to_variant())); - sizes.append_item(&item); - } let rows = gio::Menu::new(); rows.append(Some(&gettext("_Insert Row")), Some("grid.insert-row")); rows.append(Some(&gettext("_Delete Selected Rows")), Some("grid.delete-rows")); @@ -90,10 +80,40 @@ fn more_menu(page_sizes: &[u64]) -> gio::Menu { menu.append_section(None, &actions); menu.append_section(None, &rows); menu.append_section(None, &pages); - menu.append_section(Some(&gettext("Rows per Page")), &sizes); + menu.append_section(Some(&gettext("Rows per Page")), &page_size_menu(page_sizes)); + menu +} + +// Holds only what the medium breakpoint takes off the bar. +fn overflow_menu(page_sizes: &[u64]) -> gio::Menu { + let actions = gio::Menu::new(); + actions.append(Some(&gettext("Col_umns…")), Some("grid.columns")); + actions.append_item(&export_item()); + let menu = gio::Menu::new(); + menu.append_section(None, &actions); + menu.append_section(Some(&gettext("Rows per Page")), &page_size_menu(page_sizes)); menu } +fn export_item() -> gio::MenuItem { + let export = gio::MenuItem::new(Some(&gettext("_Export Rows…")), Some("browse.export")); + // The window's Export Results key reaches this tab's Export. + if let Some(key) = crate::application::triggers_for("win.export-results").first() { + export.set_attribute_value("accel", Some(&key.to_variant())); + } + export +} + +fn page_size_menu(page_sizes: &[u64]) -> gio::Menu { + let sizes = gio::Menu::new(); + for size in page_sizes { + let item = gio::MenuItem::new(Some(&format_thousands(*size)), None); + item.set_action_and_target_value(Some("browse.page-size"), Some(&size.to_variant())); + sizes.append_item(&item); + } + sizes +} + /// An inline editor that slides down above the grid. It lives in the /// tab so the user's in-progress rules survive a click into a cell or /// the SQL editor. It offers what the connection's engine evaluates, and @@ -303,6 +323,7 @@ mod tests { fn every_action_in_the_more_menu_has_an_access_key_of_its_own() { // A page size is a number, which takes no key. crate::test_support::assert_access_keys(&more_menu(&[])); + crate::test_support::assert_access_keys(&overflow_menu(&[])); } #[test] diff --git a/linux/crates/app/src/ui/browse_tab/mod.rs b/linux/crates/app/src/ui/browse_tab/mod.rs index f0c701b4f0..bf262b3d9a 100644 --- a/linux/crates/app/src/ui/browse_tab/mod.rs +++ b/linux/crates/app/src/ui/browse_tab/mod.rs @@ -440,6 +440,9 @@ impl BrowseTab { pub fn set_structure(&self, structure: &crate::ui::structure_tab::StructureTab) { libadwaita::prelude::BinExt::set_child(&*self.imp().structure_host, Some(structure)); + let imp = self.imp(); + structure.dock_actions(&imp.structure_details, &imp.structure_secondary, &imp.structure_primary); + self.sync_structure_actions(); self.emit_by_name::<()>("save-action-changed", &[]); } @@ -465,6 +468,9 @@ impl BrowseTab { } imp.data_start.set_visible(!structure); imp.data_end.set_visible(!structure); + imp.structure_start.set_visible(structure); + imp.structure_end.set_visible(structure); + self.sync_structure_actions(); let actions = imp.browse_actions.get().filter(|_| !structure); self.insert_action_group("browse", actions); if let Some(model) = imp.model.borrow_mut().as_mut() { @@ -473,6 +479,11 @@ impl BrowseTab { self.emit_by_name::<()>("save-action-changed", &[]); } + fn sync_structure_actions(&self) { + let structure = self.structure_tab().filter(|_| self.shows_structure()); + self.insert_action_group("structure", structure.as_ref().and_then(|tab| tab.command_actions())); + } + fn save_selected_view(&self) { if let Some(action) = self.shown_save_action() { action.activate(None); diff --git a/linux/crates/app/src/ui/browse_tab/tests/mod.rs b/linux/crates/app/src/ui/browse_tab/tests/mod.rs index 49a600fc2c..a18735d900 100644 --- a/linux/crates/app/src/ui/browse_tab/tests/mod.rs +++ b/linux/crates/app/src/ui/browse_tab/tests/mod.rs @@ -351,6 +351,12 @@ impl Drop for Shown { } } +// A window's size request also covers its frame, which leaves the content 10 px short under xvfb. +pub(super) fn hold_size(window: &impl IsA, tab: &BrowseTab, width: i32, height: i32) { + tab.set_size_request(width, height); + window.upcast_ref::().set_default_size(width, height); +} + /// The files and preferences a test tab reads. pub(super) struct TabStores { root: tempfile::TempDir, @@ -1748,6 +1754,26 @@ fn table_commands_follow_the_selected_view_from_the_switch_and_controls() { tab.imp().view_toggle.activate_action("table.save", None).unwrap(); assert_eq!(schema_saves.count(), 1); assert_eq!(row_saves.count(), 0); + let save = structure.imp().save_button.get(); + assert_eq!(save.parent(), Some(tab.imp().structure_primary.get().upcast())); + assert!(!structure.imp().action_bar.is_visible()); + wait_until(WAIT, || save.is_mapped()).expect("the docked Save control"); + assert!(save.grab_focus()); + assert!(crate::ui::a11y::holds_focus(&save)); + use crate::application::ShortcutOwner; + use crate::test_support::shortcut_keys::{keystroke, owner_controller, shortcuts, trigger_keys}; + let ctrl_s = shortcuts(&owner_controller(tab, ShortcutOwner::BrowseTab).expect("the table's keys")) + .into_iter() + .find(|shortcut| { + shortcut + .trigger() + .is_some_and(|trigger| trigger_keys(&trigger).contains(&keystroke("s"))) + }) + .and_then(|shortcut| shortcut.action()) + .expect("Ctrl+S is bound"); + assert!(ctrl_s.activate(gtk4::ShortcutActionFlags::empty(), &save, None)); + assert_eq!(schema_saves.count(), 2); + assert_eq!(row_saves.count(), 0); assert!(tab.activate_action("grid.insert-row", None).is_err()); tab.imp().view_toggle.activate_action("table.refresh", None).unwrap(); assert_eq!(row_refreshes.count(), 0); @@ -1755,11 +1781,94 @@ fn table_commands_follow_the_selected_view_from_the_switch_and_controls() { tab.imp().view_stack.set_visible_child_name("data"); tab.activate_action("table.save", None).unwrap(); assert_eq!(row_saves.count(), 1); - assert_eq!(schema_saves.count(), 1); + assert_eq!(schema_saves.count(), 2); + assert!(tab.activate_action("structure.save", None).is_err()); structure.shutdown(); drop(shown); } +#[gtk4::test] +fn the_compact_structure_bar_fits_while_dirty_and_saving() { + use crate::ui::structure_tab::{ + ColumnsInput, SaveInput as StructureSave, StructureMode, StructureTab, StructureTabInit, + }; + use gtk4::subclass::prelude::ObjectSubclassIsExt; + use libadwaita::prelude::{AdwDialogExt, AdwWindowExt}; + + let mut script = serving_table(); + script.dialect = Arc::new(tablepro_driver_postgres::PgDialect::new( + &tablepro_core::ServerInfo::new("PostgreSQL", "18.0", 18, 0, 0), + )); + script.query_bound.always(FakeReply::ok(rows(&["Ada"]))); + let harness = Harness::open(script, []); + let tab = harness.tab(); + let window = crate::test_support::OwnedWindow::presented( + libadwaita::Window::builder() + .default_width(360) + .default_height(400) + .content(tab) + .build(), + ); + tab.offer_structure(); + let tracker = crate::services::structure_tracker_handle::StructureTrackerHandle::default(); + let structure = StructureTab::new(StructureTabInit { + tracker: tracker.clone(), + schema: None, + table: "new_table".into(), + mode: StructureMode::New, + session: harness.session.clone(), + tasks: harness.runtime.as_ref().unwrap().tasks(), + first_load: crate::ui::tab_load::FirstLoad::Now, + }); + structure.send(ColumnsInput::AddColumn); + tab.set_structure(&structure); + let imp = tab.imp(); + imp.view_stack.set_visible_child_name("structure"); + wait_until(WAIT, || imp.structure_more.is_mapped()).expect("the compact Structure bar"); + let actions = structure.command_actions().expect("Structure commands"); + assert!(actions.is_action_enabled("save") && actions.is_action_enabled("discard")); + assert!(!actions.is_action_enabled("drop") && !actions.is_action_enabled("stop")); + assert!(!imp.structure_details.is_visible() && !imp.structure_secondary.is_visible()); + assert!(structure.imp().save_button.is_mapped()); + let (dirty_width, ..) = imp.action_bar.measure(gtk4::Orientation::Horizontal, -1); + assert!(dirty_width <= 360, "the dirty bar needs {dirty_width}px"); + let stops = crate::test_support::SignalLog::connect(&structure, "stop-save-requested", |_| ()); + structure.send(StructureSave::SaveStarted); + crate::test_support::after_next_frame(&*window); + assert!(!actions.is_action_enabled("save") && !actions.is_action_enabled("discard")); + assert!(actions.is_action_enabled("stop")); + assert!(structure.imp().saving_spinner.is_mapped()); + let (saving_width, ..) = imp.action_bar.measure(gtk4::Orientation::Horizontal, -1); + assert!(saving_width <= 360, "the saving bar needs {saving_width}px"); + imp.structure_more.activate_action("structure.stop", None).unwrap(); + assert_eq!(stops.count(), 1); + structure.send(StructureSave::SaveFailed("rolled back".into())); + assert!(actions.is_action_enabled("save") && actions.is_action_enabled("discard")); + assert!(!actions.is_action_enabled("stop")); + imp.structure_more.activate_action("structure.discard", None).unwrap(); + wait_until(WAIT, || window.visible_dialog().is_some()).expect("Discard asks first"); + let dialog = window + .visible_dialog() + .unwrap() + .downcast::() + .unwrap(); + assert!(tracker.has_pending()); + dialog.emit_by_name::<()>("response", &[&"discard"]); + dialog.force_close(); + wait_until(WAIT, || !tracker.has_pending()).expect("Discard clears the Structure draft"); + assert!(!actions.is_action_enabled("save") && !actions.is_action_enabled("discard")); + window.set_size_request(1_000, 400); + wait_until(WAIT, || { + imp.structure_secondary.is_mapped() && !imp.structure_more.is_mapped() + }) + .expect("the wide Structure controls return"); + assert!(imp.structure_details.is_mapped()); + assert!(structure.imp().discard_button.is_mapped()); + imp.view_stack.set_visible_child_name("data"); + assert!(imp.structure_more.activate_action("structure.discard", None).is_err()); + structure.shutdown(); +} + #[gtk4::test] fn the_paginator_says_how_long_the_page_took() { use gtk4::subclass::prelude::ObjectSubclassIsExt; @@ -1801,19 +1910,15 @@ fn the_bottom_bar_offers_the_column_chooser() { script.query_bound.always(FakeReply::ok(rows(&["Ada"]))); let harness = Harness::open(script, []); let tab = harness.tab(); - let window = crate::test_support::OwnedWindow::presented( - libadwaita::Window::builder() - .default_width(1000) - .default_height(500) - .content(tab) - .build(), - ); + let window = libadwaita::Window::builder().content(tab).build(); + hold_size(&window, tab, 1_200, 500); + let window = crate::test_support::OwnedWindow::presented(window); let button = crate::test_support::find_by_action_name(tab, "grid.columns") .and_downcast::() .expect("a Columns button"); // A pending initial surface configure can otherwise overwrite the later resize. wait_until(WAIT, || { - window.is_mapped() && tab.width() >= 900 && !harness.shown().is_empty() + window.is_mapped() && tab.width() >= 1_200 && !harness.shown().is_empty() }) .expect("the wide window is allocated"); assert!(tab.current_breakpoint().is_none()); @@ -1827,7 +1932,7 @@ fn the_bottom_bar_offers_the_column_chooser() { chooser.close(); wait_until(WAIT, || window.visible_dialog().is_none() && chooser.parent().is_none()).expect("the chooser closes"); - window.set_default_size(600, 500); + hold_size(&*window, tab, 600, 500); assert!( wait_until(WAIT, || tab.width() > 0 && tab.width() <= 600).is_ok(), "the tab did not resize: window width {}, tab width {}", @@ -1852,3 +1957,115 @@ fn the_bottom_bar_offers_the_column_chooser() { wait_until(WAIT, || window.visible_dialog().is_some()).expect("More opens Columns"); window.visible_dialog().expect("the chooser").close(); } + +fn switch_labels(tab: &BrowseTab) -> Vec { + use gtk4::subclass::prelude::ObjectSubclassIsExt; + crate::test_support::descendants(&tab.imp().view_toggle.get()) + .into_iter() + .filter_map(|widget| widget.downcast::().ok()) + .filter(|label| !label.label().is_empty()) + .collect() +} + +fn bar_shortfall(tab: &BrowseTab) -> Option { + use gtk4::subclass::prelude::ObjectSubclassIsExt; + let cut: Vec = switch_labels(tab) + .iter() + .filter(|label| label.layout().is_ellipsized() || label.layout().pixel_size().0 > label.width()) + .map(|label| label.label().to_string()) + .collect(); + let (needs, ..) = tab.imp().action_bar.measure(gtk4::Orientation::Horizontal, -1); + (!cut.is_empty() || needs > tab.width()) + .then(|| format!("cut {cut:?}, the bar needs {needs} px of {}", tab.width())) +} + +fn menu_actions(menu: >k4::gio::MenuModel) -> Vec { + (0..menu.n_items()) + .filter_map(|index| menu.item_link(index, gtk4::gio::MENU_LINK_SECTION)) + .flat_map(|section| { + (0..section.n_items()) + .filter_map(|index| { + section + .item_attribute_value(index, gtk4::gio::MENU_ATTRIBUTE_ACTION, None) + .and_then(|value| value.get::()) + }) + .collect::>() + }) + .collect() +} + +#[gtk4::test] +fn the_view_switch_keeps_its_names_in_a_1200_px_window() { + use crate::ui::structure_tab::{ColumnsInput, StructureMode, StructureTab, StructureTabInit}; + use gtk4::subclass::prelude::ObjectSubclassIsExt; + + let mut script = serving_table(); + script.query_bound.always(FakeReply::ok(rows(&["Ada"]))); + let harness = Harness::open(script, []); + let tab = harness.tab(); + tab.offer_structure(); + let window = libadwaita::Window::builder().content(tab).build(); + hold_size(&window, tab, 1_200, 400); + let window = crate::test_support::OwnedWindow::presented(window); + let imp = tab.imp(); + let columns = crate::test_support::find_by_action_name(tab, "grid.columns") + .and_downcast::() + .expect("a Columns button"); + wait_until(WAIT, || { + window.is_mapped() && tab.width() >= 1_200 && harness.shown().len() == 1 + }) + .expect("the tab fills the window"); + let names: Vec = switch_labels(tab) + .iter() + .map(|label| label.label().to_string()) + .collect(); + assert_eq!(names, ["Data", "Structure"]); + assert!( + wait_until(WAIT, || bar_shortfall(tab).is_none()).is_ok(), + "{:?}", + bar_shortfall(tab) + ); + assert!(columns.is_visible() && imp.export_button.is_visible() && imp.page_size_dropdown.is_mapped()); + assert!(!imp.overflow_button.is_visible()); + + // What a 1200 px window leaves the tab beside the sidebar at its widest. + hold_size(&*window, tab, 920, 400); + wait_until(WAIT, || { + tab.width() > 0 && tab.width() <= 920 && imp.overflow_button.is_mapped() + }) + .expect("the tab beside the sidebar"); + assert!( + wait_until(WAIT, || bar_shortfall(tab).is_none()).is_ok(), + "{:?}", + bar_shortfall(tab) + ); + assert!(!columns.is_visible() && !imp.export_button.is_visible() && !imp.page_size_dropdown.is_mapped()); + assert!(!imp.more_button.is_visible()); + let moved = menu_actions(&imp.overflow_button.menu_model().expect("the overflow menu")); + for action in ["grid.columns", "browse.export", "browse.page-size"] { + assert!( + moved.iter().any(|found| found == action), + "the overflow menu lacks {action}" + ); + } + + let structure = StructureTab::new(StructureTabInit { + tracker: crate::services::structure_tracker_handle::StructureTrackerHandle::default(), + schema: None, + table: "new_table".into(), + mode: StructureMode::New, + session: harness.session.clone(), + tasks: harness.runtime.as_ref().unwrap().tasks(), + first_load: crate::ui::tab_load::FirstLoad::Now, + }); + structure.send(ColumnsInput::AddColumn); + tab.set_structure(&structure); + imp.view_stack.set_visible_child_name("structure"); + wait_until(WAIT, || structure.imp().save_button.is_mapped()).expect("the one Structure bar"); + assert!( + wait_until(WAIT, || bar_shortfall(tab).is_none()).is_ok(), + "{:?}", + bar_shortfall(tab) + ); + structure.shutdown(); +} diff --git a/linux/crates/app/src/ui/structure_tab/imp.rs b/linux/crates/app/src/ui/structure_tab/imp.rs index 8961911a50..6bbab60a07 100644 --- a/linux/crates/app/src/ui/structure_tab/imp.rs +++ b/linux/crates/app/src/ui/structure_tab/imp.rs @@ -82,8 +82,10 @@ pub struct StructureTab { pub saving_spinner: TemplateChild, #[template_child] pub stop_button: TemplateChild, + #[template_child] + pub action_bar: TemplateChild, - pub(super) save_action: OnceCell, + pub(super) actions: OnceCell, pub(super) model: RefCell>, pub(super) queue: RefCell>, pub(super) dispatching: Cell, diff --git a/linux/crates/app/src/ui/structure_tab/mod.rs b/linux/crates/app/src/ui/structure_tab/mod.rs index c382790e37..726424c040 100644 --- a/linux/crates/app/src/ui/structure_tab/mod.rs +++ b/linux/crates/app/src/ui/structure_tab/mod.rs @@ -376,6 +376,22 @@ impl StructureTab { ) } + pub(crate) fn dock_actions(&self, details: >k::Box, secondary: >k::Box, primary: >k::Box) { + let imp = self.imp(); + imp.action_bar.set_visible(false); + for (control, target) in [ + (imp.pending_label.get().upcast::(), details), + (imp.drop_button.get().upcast(), details), + (imp.stop_button.get().upcast(), secondary), + (imp.discard_button.get().upcast(), secondary), + (imp.saving_spinner.get().upcast(), primary), + (imp.save_button.get().upcast(), primary), + ] { + imp.action_bar.remove(&control); + target.append(&control); + } + } + /// A read of the table's definition is running. pub fn is_loading(&self) -> bool { self.imp() diff --git a/linux/crates/app/src/ui/structure_tab/structure_actions.rs b/linux/crates/app/src/ui/structure_tab/structure_actions.rs index 4ebcf288ca..589c1ed569 100644 --- a/linux/crates/app/src/ui/structure_tab/structure_actions.rs +++ b/linux/crates/app/src/ui/structure_tab/structure_actions.rs @@ -2,28 +2,41 @@ use gtk4::gio; use gtk4::prelude::*; use gtk4::subclass::prelude::*; -use super::{SaveInput, StructureTab}; +use super::{SaveInput, StructureTab, StructureTabInput, TableInput}; use crate::application::{ShortcutOwner, local_shortcut_controller}; impl StructureTab { - pub(crate) fn save_action(&self) -> Option { - self.imp().save_action.get().cloned() - } - pub(super) fn install_actions(&self) { let imp = self.imp(); - let save = gio::SimpleAction::new("save", None); - let sender = self.sender(); - save.connect_activate(move |_, _| sender.input(SaveInput::Save)); - imp.save_button - .bind_property("sensitive", &save, "enabled") - .sync_create() - .build(); let group = gio::SimpleActionGroup::new(); - group.add_action(&save); - let _ = imp.save_action.set(save); + let commands: [(_, _, _, fn() -> StructureTabInput); 4] = [ + ("save", &imp.save_button, "sensitive", || SaveInput::Save.into()), + ("discard", &imp.discard_button, "sensitive", || { + SaveInput::ConfirmDiscard.into() + }), + ("drop", &imp.drop_button, "visible", || { + TableInput::DropTableRequested.into() + }), + ("stop", &imp.stop_button, "visible", || SaveInput::StopSaving.into()), + ]; + for (name, button, property, message) in commands { + let action = gio::SimpleAction::new(name, None); + let sender = self.sender(); + action.connect_activate(move |_, _| sender.input(message())); + button.bind_property(property, &action, "enabled").sync_create().build(); + group.add_action(&action); + } self.insert_action_group("structure", Some(&group)); + let _ = imp.actions.set(group); self.add_controller(local_shortcut_controller(ShortcutOwner::StructureTab)); crate::ui::a11y::announce_key_shortcuts(&imp.save_button.get(), "structure.save"); } + + pub(crate) fn command_actions(&self) -> Option<&gio::SimpleActionGroup> { + self.imp().actions.get() + } + + pub(crate) fn save_action(&self) -> Option { + self.command_actions()?.lookup_action("save").and_downcast() + } } diff --git a/linux/crates/app/src/ui/structure_tab/tests.rs b/linux/crates/app/src/ui/structure_tab/tests.rs index 5964a480ad..a9517d48bd 100644 --- a/linux/crates/app/src/ui/structure_tab/tests.rs +++ b/linux/crates/app/src/ui/structure_tab/tests.rs @@ -982,6 +982,14 @@ fn stop_saving_shows_only_while_a_save_runs() { }); let imp = harness.tab().imp(); let (stop, save) = (imp.stop_button.get(), imp.save_button.get()); + assert!(imp.action_bar.is_visible()); + assert!( + save.is_ancestor(&imp.action_bar.get()), + "standalone Save left its own bar" + ); + let actions = harness.tab().command_actions().expect("Structure commands"); + assert!(actions.is_action_enabled("drop")); + assert!(!actions.is_action_enabled("stop")); assert!(!stop.is_visible()); assert!(save.is_sensitive()); diff --git a/linux/data/resources/ui/browse-tab.ui b/linux/data/resources/ui/browse-tab.ui index 3c81d1368c..15c77a89ab 100644 --- a/linux/data/resources/ui/browse-tab.ui +++ b/linux/data/resources/ui/browse-tab.ui @@ -2,9 +2,39 @@ + +
+ + _Discard Changes… + structure.discard + + + _Stop Saving + structure.stop + action-disabled + +
+
+ + Drop _Table… + structure.drop + action-disabled + +
+