Add optional automatic annotation copying
This commit is contained in:
parent
f65d5548de
commit
6477f8b500
5 changed files with 67 additions and 4 deletions
|
|
@ -133,6 +133,8 @@ mod imp {
|
|||
pub(super) draw_line_width_btn: TemplateChild<gtk::SpinButton>,
|
||||
#[template_child]
|
||||
pub(super) draw_clear_btn: TemplateChild<gtk::Button>,
|
||||
#[template_child]
|
||||
pub(super) draw_auto_copy_btn: TemplateChild<gtk::ToggleButton>,
|
||||
}
|
||||
|
||||
#[glib::object_subclass]
|
||||
|
|
@ -475,6 +477,18 @@ mod imp {
|
|||
imp.draw_color_btn
|
||||
.set_rgba(&gdk::RGBA::new(0.96, 0.22, 0.22, 1.0));
|
||||
|
||||
// Persist automatic clipboard updates as an app preference.
|
||||
let settings = LpApplication::default().settings();
|
||||
imp.draw_auto_copy_btn
|
||||
.set_active(settings.boolean("auto-copy-annotations"));
|
||||
imp.draw_auto_copy_btn.connect_toggled(move |btn| {
|
||||
if let Err(err) =
|
||||
settings.set_boolean("auto-copy-annotations", btn.is_active())
|
||||
{
|
||||
tracing::warn!("Failed to save auto-copy setting: {err}");
|
||||
}
|
||||
});
|
||||
|
||||
// Connect draw mode button (headerbar toggle)
|
||||
imp.draw_mode_button.connect_toggled(glib::clone!(
|
||||
#[weak]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue