breadman: rebuild settings as plain GTK4, fix AdwDialog sizing, present-ordering bug

The libadwaita-based settings screen (previous commit) had two real bugs a
closer look (and a screenshot from the real running app) caught:

- AdwSpinRow's internal GtkSpinButton has no width constraint of its own,
  so once the row was widened to 900px, the spin button stretched to fill
  it - the digits and +/- buttons ended up stranded behind a huge empty
  bordered box, the exact bug the design review flagged, just worse.
- bread-theme's shared `entry, spinbutton` rule outlines every field with
  an always-visible @overlay border, which on a light-cream overlay colour
  reads as a stark white outline against the dark theme.

Rather than keep fighting libadwaita's internal row/spin-button opinions
(there's no supported way to reach in and constrain them), settings.rs is
now plain GTK4 mirroring bos-settings' own Row.svelte/NumberField.svelte/
TextField.svelte design exactly: same tokens (12/16px row padding, ch-width
inputs, transparent-at-rest border, accent border only on focus), built on
a plain `list.boxed-list` for the native rounded-corner-run + divider
styling. Full control over sizing, no internal widget to hunt for.

Also fixed a real ordering bug in the editor AdwDialog conversion:
`open_editor` used to call `dialog.present()` internally before returning,
so callers that connected `dialog.connect_map` afterward (screenshot mode)
missed the signal entirely - it can fire synchronously inside `present`.
Presentation now happens at each call site, after wiring `connect_map`.
Also gave the dialog's content an explicit height/vexpand + min-content-
height, since the ScrolledWindow had none and the whole dialog was
collapsing to just its header bar.

breadpad-shared's bread-theme dependency also gets fixed here: it was
still pinned to an old GitHub-mirror tag (v0.2.8) while breadman pinned
the same crate to git.breadway.dev's dev branch - two different copies of
bread-theme compiled into the same binary, so breadman's actual runtime
CSS (built through breadpad_shared::theme) never saw any of the shared
stylesheet fixes above regardless of what breadman's own direct
dependency resolved to.
This commit is contained in:
Breadway 2026-07-31 08:58:36 +08:00
parent 26cb31354f
commit ae296c7154
7 changed files with 230 additions and 190 deletions

View file

@ -20,6 +20,7 @@
//! callbacks since nothing here should actually persist a change.
use gtk4::prelude::*;
use libadwaita::prelude::*;
use std::path::PathBuf;
use std::rc::Rc;
use std::sync::Arc;
@ -92,9 +93,10 @@ pub fn dispatch(
let morning = state.cfg.borrow().reminders.default_morning.clone();
let store = Arc::new(state.write_store());
// AdwDialog handles its own presentation/centering - no more
// manual popover anchor/position/autohide juggling.
// manual popover anchor/position/autohide juggling. Must
// connect `map` BEFORE presenting, or the signal (which can
// fire synchronously inside `present`) is missed entirely.
let dialog = crate::editor::open_editor(
root.upcast_ref::<gtk4::Widget>(),
&note,
store,
morning,
@ -109,6 +111,7 @@ pub fn dispatch(
finish(bread_screenshots::capture_region(0, 0, width, height, &output));
});
});
dialog.present(Some(root.upcast_ref::<gtk4::Widget>()));
});
});
return;