aboutsummaryrefslogtreecommitdiff
path: root/src/preferences/pages/editor.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/preferences/pages/editor.rs')
-rw-r--r--src/preferences/pages/editor.rs24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/preferences/pages/editor.rs b/src/preferences/pages/editor.rs
index d4acb94..336a488 100644
--- a/src/preferences/pages/editor.rs
+++ b/src/preferences/pages/editor.rs
@@ -33,7 +33,7 @@ pub struct EditorPage {
}
impl EditorPage {
- pub fn new(preferences: &UserPreferences, sender: Sender<PreferencesInput>) -> Self {
+ pub fn new(preferences: &UserPreferences, sender: &Sender<PreferencesInput>) -> Self {
let container = gtk::Box::new(gtk::Orientation::Vertical, 20);
container.set_margin_top(20);
container.set_margin_bottom(20);
@@ -57,7 +57,9 @@ impl EditorPage {
});
}
font_size_box.append(&font_size_spin);
- font_size_box.append(&gtk::Label::new(Some(&tr!("preferences.editor.font_size.unit"))));
+ font_size_box.append(&gtk::Label::new(Some(&tr!(
+ "preferences.editor.font_size.unit"
+ ))));
container.append(&font_size_box);
// Editor Style section
@@ -68,7 +70,10 @@ impl EditorPage {
container.append(&style_label);
// Soft Wrap Lines
- let soft_wrap_row = create_switch_row(&tr!("preferences.editor.editor_style.soft_wrap_lines"), preferences.soft_wrap_lines);
+ let soft_wrap_row = create_switch_row(
+ &tr!("preferences.editor.editor_style.soft_wrap_lines"),
+ preferences.soft_wrap_lines,
+ );
let soft_wrap_switch = soft_wrap_row.1.clone();
{
let sender = sender.clone();
@@ -80,8 +85,10 @@ impl EditorPage {
container.append(&soft_wrap_row.0);
// Use Custom Font
- let custom_font_row =
- create_switch_row(&tr!("preferences.editor.editor_style.use_custom_font"), preferences.use_custom_editor_font);
+ let custom_font_row = create_switch_row(
+ &tr!("preferences.editor.editor_style.use_custom_font"),
+ preferences.use_custom_editor_font,
+ );
let custom_font_switch = custom_font_row.1.clone();
container.append(&custom_font_row.0);
@@ -90,6 +97,8 @@ impl EditorPage {
font_row.append(&gtk::Label::new(Some(&tr!("preferences.editor.font"))));
let font_button = gtk::FontButton::new();
+
+ #[allow(clippy::cast_possible_truncation)]
font_button.set_font(&format!(
"{} {}",
preferences.custom_editor_font_name, preferences.editor_font_size as i32
@@ -140,15 +149,16 @@ impl EditorPage {
pub fn sync_from(&self, preferences: &UserPreferences) {
self.font_size_spin.set_value(preferences.editor_font_size);
- self.soft_wrap_switch.set_active(preferences.soft_wrap_lines);
+ self.soft_wrap_switch
+ .set_active(preferences.soft_wrap_lines);
self.custom_font_switch
.set_active(preferences.use_custom_editor_font);
self.font_button
.set_sensitive(preferences.use_custom_editor_font);
+ #[allow(clippy::cast_possible_truncation)] // Font size is always a small positive number
self.font_button.set_font(&format!(
"{} {}",
preferences.custom_editor_font_name, preferences.editor_font_size as i32
));
}
}
-