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",
|
"udev",
|
||||||
"upower_dbus",
|
"upower_dbus",
|
||||||
"url",
|
"url",
|
||||||
"ustr",
|
|
||||||
"xkb-data",
|
"xkb-data",
|
||||||
"zbus 4.4.0",
|
"zbus 4.4.0",
|
||||||
"zbus_polkit",
|
"zbus_polkit",
|
||||||
|
|
@ -7487,18 +7486,6 @@ version = "2.1.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da"
|
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]]
|
[[package]]
|
||||||
name = "usvg"
|
name = "usvg"
|
||||||
version = "0.42.0"
|
version = "0.42.0"
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,6 @@ url = "2.5.2"
|
||||||
xkb-data = "0.2.1"
|
xkb-data = "0.2.1"
|
||||||
zbus = { version = "4.4.0", features = ["tokio"], optional = true }
|
zbus = { version = "4.4.0", features = ["tokio"], optional = true }
|
||||||
zbus_polkit = { version = "4.0.0" }
|
zbus_polkit = { version = "4.0.0" }
|
||||||
ustr = "1.0.0"
|
|
||||||
fontdb = "0.16.2"
|
fontdb = "0.16.2"
|
||||||
fixed_decimal = "0.5.6"
|
fixed_decimal = "0.5.6"
|
||||||
mime = "0.3.17"
|
mime = "0.3.17"
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ use cosmic::{
|
||||||
Apply, Element, Task,
|
Apply, Element, Task,
|
||||||
};
|
};
|
||||||
use cosmic_config::ConfigSet;
|
use cosmic_config::ConfigSet;
|
||||||
use ustr::Ustr;
|
|
||||||
|
|
||||||
const INTERFACE_FONT: &str = "interface_font";
|
const INTERFACE_FONT: &str = "interface_font";
|
||||||
const MONOSPACE_FONT: &str = "monospace_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>(
|
pub fn selection_context<'a>(
|
||||||
families: &'a [Arc<str>],
|
families: &'a [Arc<str>],
|
||||||
search: &'a str,
|
search: &'a str,
|
||||||
current_font: &'a str,
|
current_font: &str,
|
||||||
system: bool,
|
system: bool,
|
||||||
) -> Element<'a, super::Message> {
|
) -> Element<'a, super::Message> {
|
||||||
let space_l = theme::active().cosmic().spacing.space_l;
|
let space_l = theme::active().cosmic().spacing.space_l;
|
||||||
|
|
@ -152,12 +151,10 @@ impl Model {
|
||||||
match message {
|
match message {
|
||||||
Message::InterfaceFontFamily(id) => {
|
Message::InterfaceFontFamily(id) => {
|
||||||
if let Some(family) = self.interface_font_families.get(id) {
|
if let Some(family) = self.interface_font_families.get(id) {
|
||||||
let family = Ustr::from(family);
|
|
||||||
|
|
||||||
update_config(
|
update_config(
|
||||||
INTERFACE_FONT,
|
INTERFACE_FONT,
|
||||||
FontConfig {
|
FontConfig {
|
||||||
family,
|
family: family.to_string(),
|
||||||
weight: cosmic::iced::font::Weight::Normal,
|
weight: cosmic::iced::font::Weight::Normal,
|
||||||
style: cosmic::iced::font::Style::Normal,
|
style: cosmic::iced::font::Style::Normal,
|
||||||
stretch: cosmic::iced::font::Stretch::Normal,
|
stretch: cosmic::iced::font::Stretch::Normal,
|
||||||
|
|
@ -166,8 +163,9 @@ impl Model {
|
||||||
|
|
||||||
self.interface_font_family = Some(id);
|
self.interface_font_family = Some(id);
|
||||||
|
|
||||||
|
let family = family.clone();
|
||||||
tokio::spawn(async move {
|
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(
|
update_config(
|
||||||
MONOSPACE_FONT,
|
MONOSPACE_FONT,
|
||||||
FontConfig {
|
FontConfig {
|
||||||
family: Ustr::from(family),
|
family: family.to_string(),
|
||||||
weight: cosmic::iced::font::Weight::Normal,
|
weight: cosmic::iced::font::Weight::Normal,
|
||||||
style: cosmic::iced::font::Style::Normal,
|
style: cosmic::iced::font::Style::Normal,
|
||||||
stretch: cosmic::iced::font::Stretch::Normal,
|
stretch: cosmic::iced::font::Stretch::Normal,
|
||||||
|
|
|
||||||
|
|
@ -1550,10 +1550,16 @@ impl page::Page<crate::pages::Message> for Page {
|
||||||
} else {
|
} else {
|
||||||
&self.font_filter
|
&self.font_filter
|
||||||
};
|
};
|
||||||
let current_font = cosmic::config::interface_font().family.as_str();
|
|
||||||
|
|
||||||
font_config::selection_context(filter, &self.font_search, current_font, true)
|
let current_font = cosmic::config::interface_font();
|
||||||
.map(crate::pages::Message::Appearance)
|
|
||||||
|
font_config::selection_context(
|
||||||
|
filter,
|
||||||
|
&self.font_search,
|
||||||
|
current_font.family.as_str(),
|
||||||
|
true,
|
||||||
|
)
|
||||||
|
.map(crate::pages::Message::Appearance)
|
||||||
}
|
}
|
||||||
|
|
||||||
ContextView::MonospaceFont => {
|
ContextView::MonospaceFont => {
|
||||||
|
|
@ -1562,10 +1568,16 @@ impl page::Page<crate::pages::Message> for Page {
|
||||||
} else {
|
} else {
|
||||||
&self.font_filter
|
&self.font_filter
|
||||||
};
|
};
|
||||||
let current_font = cosmic::config::monospace_font().family.as_str();
|
|
||||||
|
|
||||||
font_config::selection_context(filter, &self.font_search, current_font, false)
|
let current_font = cosmic::config::monospace_font();
|
||||||
.map(crate::pages::Message::Appearance)
|
|
||||||
|
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(),
|
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(
|
let system_font = crate::widget::go_next_with_item(
|
||||||
&descriptions[interface_font_txt],
|
&descriptions[interface_font_txt],
|
||||||
text::body(cosmic::config::interface_font().family.as_str()),
|
text::body(cosmic::config::interface_font().family),
|
||||||
Message::DisplaySystemFont,
|
Message::DisplaySystemFont,
|
||||||
);
|
);
|
||||||
|
|
||||||
let mono_font = crate::widget::go_next_with_item(
|
let mono_font = crate::widget::go_next_with_item(
|
||||||
&descriptions[monospace_font_txt],
|
&descriptions[monospace_font_txt],
|
||||||
text::body(cosmic::config::monospace_font().family.as_str()),
|
text::body(cosmic::config::monospace_font().family),
|
||||||
Message::DisplayMonoFont,
|
Message::DisplayMonoFont,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue