breadman: capture every stack page + the editor and new-note windows

--view (and now --screenshot) already opened any named stack page
directly, so the other 9 pages (upcoming/todo/reminder/idea/note/
question/archive/settings/errors) needed zero new code — just registry
entries in bread-capture.

Two more real windows needed actual wiring: the per-note editor popover
(editor::build_editor_popover, normally only reachable via a specific
note card's edit button — screenshot mode calls the builder directly
against the first real note in the store instead, since there's no
button handle to synthesize a click on) and the "New Note" modal
(show_add_note_window, same on_build-hook pattern already used for
breadbar's wifi add-network dialog).

The editor popover's first attempt parented it to the whole window,
which put it at GTK4 Popover's default Top position — entirely above the
window, clipped off the canvas in every capture despite mapping
successfully (no error, just invisible). Anchoring to a real button
(new_note_btn) with an explicit Bottom position fixed it.
This commit is contained in:
Breadway 2026-07-29 17:27:05 +08:00
parent 55f5b6c3ae
commit 77b402833f
2 changed files with 96 additions and 9 deletions

View file

@ -506,7 +506,7 @@ fn build_app_window(
let state_c = state.clone();
let window_c = window.clone();
new_note_btn.connect_clicked(move |_| {
show_add_note_window(&window_c, state_c.clone());
show_add_note_window(&window_c, state_c.clone(), |_| {});
});
}
@ -527,7 +527,7 @@ fn build_app_window(
stack.set_visible_child_name(initial);
if let Some(req) = screenshot_req {
screenshot::dispatch(&window, req);
screenshot::dispatch(&window, req, state.clone(), new_note_btn.clone());
}
window.present();
@ -796,7 +796,7 @@ fn build_note_card(note: &Note, state: AppState) -> gtk4::Box {
// ── Add note window ───────────────────────────────────────────────────────────
fn show_add_note_window(parent: &gtk4::ApplicationWindow, state: AppState) {
fn show_add_note_window(parent: &gtk4::ApplicationWindow, state: AppState, on_build: impl FnOnce(&gtk4::Window)) {
let win = gtk4::Window::builder()
.title("New Note")
.transient_for(parent)
@ -981,6 +981,7 @@ fn show_add_note_window(parent: &gtk4::ApplicationWindow, state: AppState) {
});
}
on_build(&win);
win.present();
body_entry.grab_focus();
}