feat: helper for loading fonts

This commit is contained in:
Ashley Wulber 2023-05-10 13:15:56 -04:00
parent 0c1396cac3
commit eb0fcf5278
No known key found for this signature in database
GPG key ID: 5216D4F46A90A820
3 changed files with 19 additions and 15 deletions

View file

@ -1,6 +1,7 @@
/// Copyright 2022 System76 <info@system76.com>
// SPDX-License-Identifier: MPL-2.0
use cosmic::{
font::load_fonts,
iced::{self, Application, Command, Length, Subscription},
iced::{
subscription,
@ -196,6 +197,7 @@ pub enum Message {
ToggleNavBar,
ToggleNavBarCondensed,
ToggleWarning,
FontsLoaded,
}
impl From<Page> for Message {
@ -343,7 +345,7 @@ impl Application for Window {
window.insert_page(Page::Accessibility);
window.insert_page(Page::Applications);
(window, Command::none())
(window, load_fonts().map(|_| Message::FontsLoaded))
}
fn title(&self) -> String {
@ -422,6 +424,7 @@ impl Application for Window {
_ => (),
},
Message::ToggleWarning => self.toggle_warning(),
Message::FontsLoaded => {}
}
ret
}