fix: libcosmic api changes
This commit is contained in:
parent
521c1a4a17
commit
f0dd262d5d
4 changed files with 25 additions and 29 deletions
13
Cargo.lock
generated
13
Cargo.lock
generated
|
|
@ -1684,7 +1684,6 @@ dependencies = [
|
|||
"udev",
|
||||
"upower_dbus",
|
||||
"url",
|
||||
"ustr",
|
||||
"xkb-data",
|
||||
"zbus 4.4.0",
|
||||
"zbus_polkit",
|
||||
|
|
@ -7487,18 +7486,6 @@ version = "2.1.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da"
|
||||
|
||||
[[package]]
|
||||
name = "ustr"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "18b19e258aa08450f93369cf56dd78063586adf19e92a75b338a800f799a0208"
|
||||
dependencies = [
|
||||
"ahash 0.8.11",
|
||||
"byteorder",
|
||||
"lazy_static",
|
||||
"parking_lot 0.12.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "usvg"
|
||||
version = "0.42.0"
|
||||
|
|
|
|||
|
|
@ -67,7 +67,6 @@ url = "2.5.2"
|
|||
xkb-data = "0.2.1"
|
||||
zbus = { version = "4.4.0", features = ["tokio"], optional = true }
|
||||
zbus_polkit = { version = "4.0.0" }
|
||||
ustr = "1.0.0"
|
||||
fontdb = "0.16.2"
|
||||
fixed_decimal = "0.5.6"
|
||||
mime = "0.3.17"
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ use cosmic::{
|
|||
Apply, Element, Task,
|
||||
};
|
||||
use cosmic_config::ConfigSet;
|
||||
use ustr::Ustr;
|
||||
|
||||
const INTERFACE_FONT: &str = "interface_font";
|
||||
const MONOSPACE_FONT: &str = "monospace_font";
|
||||
|
|
@ -67,7 +66,7 @@ pub fn load_font_families() -> (Vec<Arc<str>>, Vec<Arc<str>>) {
|
|||
pub fn selection_context<'a>(
|
||||
families: &'a [Arc<str>],
|
||||
search: &'a str,
|
||||
current_font: &'a str,
|
||||
current_font: &str,
|
||||
system: bool,
|
||||
) -> Element<'a, super::Message> {
|
||||
let space_l = theme::active().cosmic().spacing.space_l;
|
||||
|
|
@ -152,12 +151,10 @@ impl Model {
|
|||
match message {
|
||||
Message::InterfaceFontFamily(id) => {
|
||||
if let Some(family) = self.interface_font_families.get(id) {
|
||||
let family = Ustr::from(family);
|
||||
|
||||
update_config(
|
||||
INTERFACE_FONT,
|
||||
FontConfig {
|
||||
family,
|
||||
family: family.to_string(),
|
||||
weight: cosmic::iced::font::Weight::Normal,
|
||||
style: cosmic::iced::font::Style::Normal,
|
||||
stretch: cosmic::iced::font::Stretch::Normal,
|
||||
|
|
@ -166,8 +163,9 @@ impl Model {
|
|||
|
||||
self.interface_font_family = Some(id);
|
||||
|
||||
let family = family.clone();
|
||||
tokio::spawn(async move {
|
||||
set_gnome_font_name(family.as_str()).await;
|
||||
set_gnome_font_name(family.as_ref()).await;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -191,7 +189,7 @@ impl Model {
|
|||
update_config(
|
||||
MONOSPACE_FONT,
|
||||
FontConfig {
|
||||
family: Ustr::from(family),
|
||||
family: family.to_string(),
|
||||
weight: cosmic::iced::font::Weight::Normal,
|
||||
style: cosmic::iced::font::Style::Normal,
|
||||
stretch: cosmic::iced::font::Stretch::Normal,
|
||||
|
|
|
|||
|
|
@ -1550,10 +1550,16 @@ impl page::Page<crate::pages::Message> for Page {
|
|||
} else {
|
||||
&self.font_filter
|
||||
};
|
||||
let current_font = cosmic::config::interface_font().family.as_str();
|
||||
|
||||
font_config::selection_context(filter, &self.font_search, current_font, true)
|
||||
.map(crate::pages::Message::Appearance)
|
||||
let current_font = cosmic::config::interface_font();
|
||||
|
||||
font_config::selection_context(
|
||||
filter,
|
||||
&self.font_search,
|
||||
current_font.family.as_str(),
|
||||
true,
|
||||
)
|
||||
.map(crate::pages::Message::Appearance)
|
||||
}
|
||||
|
||||
ContextView::MonospaceFont => {
|
||||
|
|
@ -1562,10 +1568,16 @@ impl page::Page<crate::pages::Message> for Page {
|
|||
} else {
|
||||
&self.font_filter
|
||||
};
|
||||
let current_font = cosmic::config::monospace_font().family.as_str();
|
||||
|
||||
font_config::selection_context(filter, &self.font_search, current_font, false)
|
||||
.map(crate::pages::Message::Appearance)
|
||||
let current_font = cosmic::config::monospace_font();
|
||||
|
||||
font_config::selection_context(
|
||||
filter,
|
||||
&self.font_search,
|
||||
current_font.family.as_str(),
|
||||
false,
|
||||
)
|
||||
.map(crate::pages::Message::Appearance)
|
||||
}
|
||||
|
||||
ContextView::IconsAndToolkit => self.icons_and_toolkit(),
|
||||
|
|
@ -2065,13 +2077,13 @@ pub fn experimental() -> Section<crate::pages::Message> {
|
|||
|
||||
let system_font = crate::widget::go_next_with_item(
|
||||
&descriptions[interface_font_txt],
|
||||
text::body(cosmic::config::interface_font().family.as_str()),
|
||||
text::body(cosmic::config::interface_font().family),
|
||||
Message::DisplaySystemFont,
|
||||
);
|
||||
|
||||
let mono_font = crate::widget::go_next_with_item(
|
||||
&descriptions[monospace_font_txt],
|
||||
text::body(cosmic::config::monospace_font().family.as_str()),
|
||||
text::body(cosmic::config::monospace_font().family),
|
||||
Message::DisplayMonoFont,
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue