feat: refactor the settings page architecture

This commit is contained in:
Michael Aaron Murphy 2023-04-25 00:30:50 +02:00
parent efdd934e62
commit c015ad9948
No known key found for this signature in database
GPG key ID: B2732D4240C9212C
55 changed files with 2212 additions and 1635 deletions

View file

@ -1,47 +0,0 @@
// Copyright 2023 System76 <info@system76.com>
// SPDX-License-Identifier: GPL-3.0-only
#![allow(clippy::cast_precision_loss)]
#![allow(clippy::cast_sign_loss)]
#![allow(clippy::cast_possible_truncation)]
#![allow(clippy::cast_lossless)]
pub mod app;
pub use app::{Message, SettingsApp};
pub mod config;
#[macro_use]
pub mod localize;
pub mod widget;
pub mod page;
use cosmic::{iced::Application, settings};
use i18n_embed::DesktopLanguageRequester;
/// # Errors
///
/// Returns error if iced fails to run the application.
pub fn main() -> color_eyre::Result<()> {
color_eyre::install()?;
if std::env::var("RUST_SPANTRACE").is_err() {
std::env::set_var("RUST_SPANTRACE", "0");
}
let localizer = crate::localize::localizer();
let requested_languages = DesktopLanguageRequester::requested_languages();
if let Err(error) = localizer.select(&requested_languages) {
eprintln!("error while loading fluent localizations: {}", error);
}
settings::set_default_icon_theme("Pop");
let mut settings = settings();
settings.window.min_size = Some((600, 300));
SettingsApp::run(settings)?;
Ok(())
}