config: store font names in Arc
This commit is contained in:
parent
ca134e683b
commit
d9eb14e2bc
6 changed files with 21 additions and 14 deletions
14
src/theme.rs
14
src/theme.rs
|
|
@ -1,7 +1,6 @@
|
|||
use std::{
|
||||
cell::{Cell, RefCell},
|
||||
cmp::Ordering,
|
||||
ops::Mul,
|
||||
use {
|
||||
crate::utils::clonecell::CloneCell,
|
||||
std::{cell::Cell, cmp::Ordering, ops::Mul, sync::Arc},
|
||||
};
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||
|
|
@ -290,15 +289,18 @@ pub const DEFAULT_FONT: &str = "monospace 8";
|
|||
pub struct Theme {
|
||||
pub colors: ThemeColors,
|
||||
pub sizes: ThemeSizes,
|
||||
pub font: RefCell<String>,
|
||||
pub font: CloneCell<Arc<String>>,
|
||||
pub default_font: Arc<String>,
|
||||
}
|
||||
|
||||
impl Default for Theme {
|
||||
fn default() -> Self {
|
||||
let default_font = Arc::new(DEFAULT_FONT.to_string());
|
||||
Self {
|
||||
colors: Default::default(),
|
||||
sizes: Default::default(),
|
||||
font: RefCell::new(DEFAULT_FONT.to_string()),
|
||||
font: CloneCell::new(default_font.clone()),
|
||||
default_font,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue