Pin bread-theme to v0.7.1; document Super+U and unshipped ONNX model
Some checks failed
check / check (push) Failing after 1s
Some checks failed
check / check (push) Failing after 1s
bread-screenshots is not on the v0.7.1 tag, so it is rev-pinned instead of floating on branch=main. bread-theme v0.7.1 has no adw/chip helpers; breadman keeps local shims. CLAUDE.md records the single-trunk workflow.
This commit is contained in:
parent
fde2c7571d
commit
b9c2702168
11 changed files with 113 additions and 51 deletions
|
|
@ -3,7 +3,6 @@
|
|||
//! flagged in design review as the weakest surface in the app). AdwDialog
|
||||
//! gives us the scrim, the title, and correct modal anchoring for free.
|
||||
|
||||
use bread_theme::adw;
|
||||
use breadpad_shared::{
|
||||
parser::parse_rule_based,
|
||||
scheduler::Scheduler,
|
||||
|
|
@ -54,25 +53,25 @@ pub fn open_editor(
|
|||
.margin_end(16)
|
||||
.build();
|
||||
|
||||
let group = adw::preferences_group("Details", None);
|
||||
let group = libadwaita::PreferencesGroup::builder().title("Details").build();
|
||||
|
||||
let body_row = libadwaita::EntryRow::builder().title("Body").build();
|
||||
body_row.set_text(¬e.body);
|
||||
group.add(&body_row);
|
||||
|
||||
let type_row = adw::action_row("Type", None);
|
||||
let type_row = libadwaita::ActionRow::builder().title("Type").build();
|
||||
let type_pill_box = gtk4::Box::builder().orientation(gtk4::Orientation::Horizontal).spacing(4).valign(gtk4::Align::Center).build();
|
||||
let selected_type: Rc<RefCell<String>> = Rc::new(RefCell::new(note.note_type.as_str().to_string()));
|
||||
let type_pills: Vec<(gtk4::Button, &'static str)> = NoteType::all_builtin().iter().map(|&name| (bread_theme::gtk::chip(name), name)).collect();
|
||||
let type_pills: Vec<(gtk4::Button, &'static str)> = NoteType::all_builtin().iter().map(|&name| (crate::theme_widgets::chip(name), name)).collect();
|
||||
for (btn, name) in &type_pills {
|
||||
bread_theme::gtk::set_chip_active(btn, *name == selected_type.borrow().as_str());
|
||||
crate::theme_widgets::set_chip_active(btn, *name == selected_type.borrow().as_str());
|
||||
let sel = selected_type.clone();
|
||||
let name = *name;
|
||||
let all_btns: Vec<gtk4::Button> = type_pills.iter().map(|(b, _)| b.clone()).collect();
|
||||
btn.connect_clicked(move |clicked| {
|
||||
*sel.borrow_mut() = name.to_string();
|
||||
for b in &all_btns { bread_theme::gtk::set_chip_active(b, false); }
|
||||
bread_theme::gtk::set_chip_active(clicked, true);
|
||||
for b in &all_btns { crate::theme_widgets::set_chip_active(b, false); }
|
||||
crate::theme_widgets::set_chip_active(clicked, true);
|
||||
});
|
||||
type_pill_box.append(btn);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ use std::sync::Arc;
|
|||
|
||||
mod editor;
|
||||
mod screenshot;
|
||||
mod theme_widgets;
|
||||
mod views;
|
||||
|
||||
// ── Args ─────────────────────────────────────────────────────────────────────
|
||||
|
|
@ -357,7 +358,7 @@ fn build_app_window(
|
|||
// Needed once before constructing any adw:: widget (see views::settings) —
|
||||
// also forces dark mode, since bread-theme's palette is a fixed dark base
|
||||
// regardless of the system GTK preference.
|
||||
bread_theme::adw::init();
|
||||
theme_widgets::init_adw();
|
||||
|
||||
let store = Arc::new(Store::new()?);
|
||||
let notes = store.load_all()?;
|
||||
|
|
@ -627,9 +628,8 @@ fn show_add_note_window(parent: >k4::ApplicationWindow, state: AppState, prese
|
|||
.build();
|
||||
vbox.append(&body_entry);
|
||||
|
||||
// Type pills — same bread_theme::gtk::chip widget the editor dialog and
|
||||
// settings screen use, instead of three different type-picker widgets
|
||||
// across the app.
|
||||
// Type pills — same chip widget the editor dialog and settings screen
|
||||
// use, instead of three different type-picker widgets across the app.
|
||||
vbox.append(>k4::Label::builder().label("Type").xalign(0.0).build());
|
||||
let chip_box = gtk4::Box::builder()
|
||||
.orientation(gtk4::Orientation::Horizontal)
|
||||
|
|
@ -638,17 +638,17 @@ fn show_add_note_window(parent: >k4::ApplicationWindow, state: AppState, prese
|
|||
let selected_type: Rc<RefCell<NoteType>> = Rc::new(RefCell::new(preselect.clone()));
|
||||
let chips: Vec<(gtk4::Button, NoteType)> = NoteType::all_builtin()
|
||||
.iter()
|
||||
.map(|&name| (bread_theme::gtk::chip(name), NoteType::from_str(name)))
|
||||
.map(|&name| (theme_widgets::chip(name), NoteType::from_str(name)))
|
||||
.collect();
|
||||
for (btn, nt) in &chips {
|
||||
bread_theme::gtk::set_chip_active(btn, *nt == preselect);
|
||||
theme_widgets::set_chip_active(btn, *nt == preselect);
|
||||
let sel = selected_type.clone();
|
||||
let nt_c = nt.clone();
|
||||
let all_btns: Vec<gtk4::Button> = chips.iter().map(|(b, _)| b.clone()).collect();
|
||||
btn.connect_clicked(move |clicked| {
|
||||
*sel.borrow_mut() = nt_c.clone();
|
||||
for b in &all_btns { bread_theme::gtk::set_chip_active(b, false); }
|
||||
bread_theme::gtk::set_chip_active(clicked, true);
|
||||
for b in &all_btns { theme_widgets::set_chip_active(b, false); }
|
||||
theme_widgets::set_chip_active(clicked, true);
|
||||
});
|
||||
chip_box.append(btn);
|
||||
}
|
||||
|
|
|
|||
23
breadman/src/theme_widgets.rs
Normal file
23
breadman/src/theme_widgets.rs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
//! Local stand-ins for `bread_theme::gtk::{chip, set_chip_active}` and
|
||||
//! `bread_theme::adw::init`, which are not on bread-theme v0.7.1.
|
||||
|
||||
use gtk4::prelude::*;
|
||||
|
||||
pub fn chip(label: &str) -> gtk4::Button {
|
||||
gtk4::Button::builder().label(label).css_classes(["chip"]).build()
|
||||
}
|
||||
|
||||
pub fn set_chip_active(chip: &impl IsA<gtk4::Widget>, active: bool) {
|
||||
if active {
|
||||
chip.add_css_class("active");
|
||||
} else {
|
||||
chip.remove_css_class("active");
|
||||
}
|
||||
}
|
||||
|
||||
/// Initializes libadwaita and forces dark mode (bread-theme's palette is a
|
||||
/// fixed dark base regardless of the system GTK preference).
|
||||
pub fn init_adw() {
|
||||
libadwaita::init().expect("failed to initialize libadwaita");
|
||||
libadwaita::StyleManager::default().set_color_scheme(libadwaita::ColorScheme::ForceDark);
|
||||
}
|
||||
|
|
@ -92,10 +92,10 @@ pub fn build(cfg: &Config, on_save: impl Fn(Config) + 'static) -> gtk4::Scrolled
|
|||
let selected_type: Rc<RefCell<String>> = Rc::new(RefCell::new(cfg.settings.default_type.clone()));
|
||||
let type_pills: Vec<(gtk4::Button, &'static str)> = NoteType::all_builtin()
|
||||
.iter()
|
||||
.map(|&name| (bread_theme::gtk::chip(name), name))
|
||||
.map(|&name| (crate::theme_widgets::chip(name), name))
|
||||
.collect();
|
||||
for (btn, name) in &type_pills {
|
||||
bread_theme::gtk::set_chip_active(btn, *name == selected_type.borrow().as_str());
|
||||
crate::theme_widgets::set_chip_active(btn, *name == selected_type.borrow().as_str());
|
||||
type_pill_box.append(btn);
|
||||
}
|
||||
general_list.append(&field_row("Default type", None, &type_pill_box));
|
||||
|
|
@ -260,8 +260,8 @@ pub fn build(cfg: &Config, on_save: impl Fn(Config) + 'static) -> gtk4::Scrolled
|
|||
let all_btns: Vec<gtk4::Button> = type_pills.iter().map(|(b, _)| b.clone()).collect();
|
||||
btn.connect_clicked(move |clicked| {
|
||||
*sel.borrow_mut() = name.to_string();
|
||||
for b in &all_btns { bread_theme::gtk::set_chip_active(b, false); }
|
||||
bread_theme::gtk::set_chip_active(clicked, true);
|
||||
for b in &all_btns { crate::theme_widgets::set_chip_active(b, false); }
|
||||
crate::theme_widgets::set_chip_active(clicked, true);
|
||||
apply_now();
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue