breadman: address design-review findings (settings, note list, editor)

Settings screen:
- Widen the AdwClamp to 900px, left-aligned to the note-list gutter,
  instead of PreferencesPage's own ~600px clamp that made the screen
  read as a narrower, bolted-on app.
- Remove the floating Save button; every control now applies instantly
  (switches/combo/spin on change, entry rows via show_apply_button),
  matching what AdwSwitchRow's own design language already implies.
- Replace ActionRow+suffix-Entry with real AdwEntryRow/AdwPasswordEntryRow
  so fields are row-width instead of sized by leftover label space.
- Default type now uses the same pill-row widget as the New Note dialog
  and editor, instead of a fourth type-picker variant.
- Local Classifier group description notes the paths are shared with
  breadpad.

Note list (All/Upcoming/Todo/Idea/Note/Question):
- Replaced the two-line card (huge dead gap between title and actions)
  with Archive's tighter single-line row layout, shared via the new
  views::row module. Unifies the edit affordance (pencil in both active
  and archive rows) and drops the type badge in views already filtered
  to one type.
- Type badges now tint per-type (matching the existing note-card-{type}
  accent-bar colors) instead of one flat cream fill for every type.
- Empty states are centered with type-specific copy and a "+ New X"
  action instead of top-anchored generic text.
- Search bar is now scoped to note-list views (was rendering uselessly
  on Settings/Errors).
- Archive sort bug: it was sorting by `created` while displaying
  `completed` ("done {date}"), which is why rows could appear out of
  order. Now sorts by `completed`.
- Sidebar and row-action icons are now real GTK symbolic icons instead
  of a mix of emoji, Unicode glyphs, and thin monochrome characters.

Editor: converted from a bare GtkPopover (no scrim, no title, anchored
wherever the triggering button happened to be) to an AdwDialog with
AdwEntryRow fields, a shared header bar, and copy/placeholders unified
with the New Note dialog. Delete uses destructive-action styling.

Also: destructive-action buttons (breadman's row/editor delete, and
breadpad-shared's .danger-btn) now use a hardcoded red instead of
pywal's @red - a blue-toned wallpaper's "red" palette slot can itself
render blue, which made delete indistinguishable from confirm/accent
buttons regardless of which CSS class was already applied.
This commit is contained in:
Breadway 2026-07-31 07:18:03 +08:00
parent 926d351949
commit de7965edae
10 changed files with 667 additions and 642 deletions

View file

@ -13,13 +13,11 @@
//! directly to a named stack page.
//!
//! One view isn't a stack page at all: "editor" opens the per-note editor
//! popover (`editor::build_editor_popover`), normally only reachable by
//! clicking a real note card's edit button. Screenshot mode calls the same
//! builder function directly against the first real note in the store
//! (bypassing the button/click-handler entirely — there's no clean way to
//! synthesize a click on a button that only ever existed as a local inside
//! `build_note_card`, never stored anywhere else), with no-op save/delete/
//! error callbacks since nothing here should actually persist a change.
//! dialog (`editor::open_editor`), normally only reachable by clicking a
//! real note row's edit button. Screenshot mode calls the same builder
//! function directly against the first real note in the store (bypassing
//! the button/click-handler entirely), with no-op save/delete/error
//! callbacks since nothing here should actually persist a change.
use gtk4::prelude::*;
use std::path::PathBuf;
@ -57,7 +55,6 @@ pub fn dispatch(
window: &gtk4::ApplicationWindow,
req: ScreenshotRequest,
state: crate::AppState,
editor_anchor: gtk4::Button,
) {
let output = req.output;
let (width, height) = (req.width as i32, req.height as i32);
@ -68,7 +65,7 @@ pub fn dispatch(
let root = root.clone();
let state = state.clone();
gtk4::glib::timeout_add_local_once(PRE_POPUP_DELAY, move || {
crate::show_add_note_window(&root, state, move |dialog| {
crate::show_add_note_window(&root, state, breadpad_shared::types::NoteType::Note, move |dialog| {
let output = output.clone();
dialog.connect_map(move |_| {
let output = output.clone();
@ -83,10 +80,10 @@ pub fn dispatch(
}
if req.view == "editor" {
window.connect_map(move |_| {
window.connect_map(move |root| {
let output = output.clone();
let state = state.clone();
let editor_anchor = editor_anchor.clone();
let root = root.clone();
gtk4::glib::timeout_add_local_once(PRE_POPUP_DELAY, move || {
let Some(note) = state.notes.borrow().first().cloned() else {
eprintln!("breadman: no notes in the store to build the editor view from");
@ -94,7 +91,10 @@ pub fn dispatch(
};
let morning = state.cfg.borrow().reminders.default_morning.clone();
let store = Arc::new(state.write_store());
let popover = crate::editor::build_editor_popover(
// AdwDialog handles its own presentation/centering - no more
// manual popover anchor/position/autohide juggling.
let dialog = crate::editor::open_editor(
root.upcast_ref::<gtk4::Widget>(),
&note,
store,
morning,
@ -102,24 +102,13 @@ pub fn dispatch(
Rc::new(|| {}),
Rc::new(|_| {}),
);
popover.set_parent(&editor_anchor);
// Parenting to the whole window (rather than a small,
// concretely-placed widget like the real edit-button call
// site does) left the popover positioned above the window
// entirely (GTK4's default Popover position is Top) — off
// the top of the canvas and clipped out of every capture.
// Anchoring to a real button plus an explicit Bottom
// position keeps it inside the visible canvas.
popover.set_position(gtk4::PositionType::Bottom);
popover.set_autohide(false);
let output = output.clone();
popover.connect_map(move |_| {
dialog.connect_map(move |_| {
let output = output.clone();
gtk4::glib::timeout_add_local_once(SETTLE_DELAY, move || {
finish(bread_screenshots::capture_region(0, 0, width, height, &output));
});
});
popover.popup();
});
});
return;