From 92032aa0d78e06195eca2553362c5659e4a2efaa Mon Sep 17 00:00:00 2001 From: Eduardo Flores Date: Tue, 19 Nov 2024 16:07:08 +0100 Subject: [PATCH] fix: localization and file structure refactor --- i18n/en/cosmic_ext_tweaks.ftl | 18 ++--- i18n/es-419/cosmic_ext_tweaks.ftl | 76 +++++++++++++++++++ i18n/es-MX/cosmic_ext_tweaks.ftl | 55 +++++++++++++- i18n/es/cosmic_ext_tweaks.ftl | 76 +++++++++++++++++++ i18n/fr/cosmic_ext_tweaks.ftl | 47 +++++++++++- i18n/sv/cosmic_ext_tweaks.ftl | 29 ++++++- src/app.rs | 16 ++-- src/{settings.rs => app/config.rs} | 10 +-- .../cosmic_panel_button_config.rs | 0 src/{core => app}/nav.rs | 0 src/app/resources.rs | 4 + src/app/settings.rs | 31 ++++++++ src/core/config.rs | 23 ------ src/core/localization.rs | 31 -------- src/core/localize.rs | 47 ++++++++++++ src/core/mod.rs | 5 +- src/main.rs | 8 +- src/pages/color_schemes/preview.rs | 4 +- src/pages/layouts/config.rs | 2 +- src/pages/panel.rs | 6 +- src/pages/snapshots.rs | 8 +- src/resources.rs | 4 - 22 files changed, 398 insertions(+), 102 deletions(-) create mode 100644 i18n/es-419/cosmic_ext_tweaks.ftl create mode 100644 i18n/es/cosmic_ext_tweaks.ftl rename src/{settings.rs => app/config.rs} (85%) rename src/{core => app}/cosmic_panel_button_config.rs (100%) rename src/{core => app}/nav.rs (100%) create mode 100644 src/app/resources.rs create mode 100644 src/app/settings.rs delete mode 100644 src/core/config.rs delete mode 100644 src/core/localization.rs create mode 100644 src/core/localize.rs delete mode 100644 src/resources.rs diff --git a/i18n/en/cosmic_ext_tweaks.ftl b/i18n/en/cosmic_ext_tweaks.ftl index a8d8506..238f31e 100644 --- a/i18n/en/cosmic_ext_tweaks.ftl +++ b/i18n/en/cosmic_ext_tweaks.ftl @@ -5,15 +5,14 @@ app-description = A tool to customize your COSMIC desktop experience. home = Home dock = Dock panel = Panel -layouts = Layouts color-schemes = Color schemes +layouts = Layouts snapshots = Snapshots color-schemes-error = Error loading color schemes import-color-scheme = Import color scheme delete-color-scheme = Delete color scheme -delete-layout = Delete layout -available-color-schemes-body = Find and install color schemes. +available-color-schemes-body = Find and install color schemes install-color-scheme = Install color scheme find-color-schemes = Find color schemes open-containing-folder = Open containing folder @@ -22,10 +21,7 @@ installed = Installed available = Available loading = Loading... show-more = Show more -about = About -find-themes = Find themes -# Panel only show-panel = Show panel force-icon-buttons-in-panel = Force icon buttons in panel @@ -40,10 +36,10 @@ cancel = Cancel close = Close create = Create -save-current-color-scheme = Save current color scheme - -save-current-layout = Save current layout +navigation = Navigation +save-current-color-scheme = Save current color scheme +color-scheme-name = Color scheme name create-snapshot = Create snapshot create-snapshot-description = You are about to create a snapshot, this will save the current state of your desktop and make it possible to restore it later on. restore-snapshot = Restore snapshot @@ -57,9 +53,11 @@ actions = Actions system = System user = User -color-scheme-name = Color scheme name +## Snapshots +application-opened = Application opened ## About +about = About repository = Repository support = Support website = Website diff --git a/i18n/es-419/cosmic_ext_tweaks.ftl b/i18n/es-419/cosmic_ext_tweaks.ftl new file mode 100644 index 0000000..4eb840c --- /dev/null +++ b/i18n/es-419/cosmic_ext_tweaks.ftl @@ -0,0 +1,76 @@ +app-title = Tweaks para COSMIC +app-description = Una herramienta para personalizar la apariencia de COSMIC. + +# Pages +home = Inicio +dock = Dock +panel = Panel +layouts = Acomodos de escritorio +color-schemes = Esquemas de color +snapshots = Copia de seguridad + +color-schemes-error = Error al cargar los esquemas de color +import-color-scheme = Importar esquema de color +delete-color-scheme = Eliminar esquema de color +available-color-schemes-body = Encuentra e instala esquemas de color +install-color-scheme = Instalar esquema de color +find-color-schemes = Buscar esquemas de color +open-containing-folder = Abrir carpeta contenedora +open-link = Abrir enlace +installed = Instalado +available = Disponible +loading = Cargando... +show-more = Mostrar mas + +show-panel = Mostrar panel +force-icon-buttons-in-panel = Forzar iconos en el panel + +padding = Relleno +padding-description = El relleno es el espacio entre los iconos y el borde del dock o panel. + +spacing = Espaciado +spacing-description = El espacio es la distancia entre los iconos en el dock o panel. + +save = Guardar +cancel = Cancelar +close = Cerrar +create = Crear + +navigation = Navegar + +save-current-color-scheme = Guardar esquema de color actual +color-scheme-name = Nombre del esquema de color +create-snapshot = Crear copia de seguridad +create-snapshot-description = Está a punto de crear una copia de seguridad; esto guardará el estado actual de su escritorio y permitirá restaurarlo más adelante +restore-snapshot = Restaurar copia de seguridad +delete-snapshot = Eliminar copia de seguridad +no-snapshots = No hay copias de seguridad disponibles +snapshot-name = Nombre de la copia de seguridad +name = Nombre +type = Tipo +created = Creado +actions = Acciones +system = Sistema +user = Usuario + +## Snapshots +application-opened = Aplicación abierta + +## About +about = Acerca de +repository = Repositorio +support = Soporte +website = Sitio web + +## Settings +settings = Ajustes + +### Appearance +appearance = Apariencia +theme = Tema +match-desktop = Igual al escritorio +dark = Oscruro +light = Claro + +# Menu +view = Ver diff --git a/i18n/es-MX/cosmic_ext_tweaks.ftl b/i18n/es-MX/cosmic_ext_tweaks.ftl index 0d37e1f..4eb840c 100644 --- a/i18n/es-MX/cosmic_ext_tweaks.ftl +++ b/i18n/es-MX/cosmic_ext_tweaks.ftl @@ -1,15 +1,29 @@ app-title = Tweaks para COSMIC app-description = Una herramienta para personalizar la apariencia de COSMIC. +# Pages home = Inicio dock = Dock panel = Panel +layouts = Acomodos de escritorio color-schemes = Esquemas de color -color-schemes-error = Error al cargar los esquemas de color. +snapshots = Copia de seguridad + +color-schemes-error = Error al cargar los esquemas de color import-color-scheme = Importar esquema de color delete-color-scheme = Eliminar esquema de color +available-color-schemes-body = Encuentra e instala esquemas de color +install-color-scheme = Instalar esquema de color +find-color-schemes = Buscar esquemas de color open-containing-folder = Abrir carpeta contenedora +open-link = Abrir enlace installed = Instalado +available = Disponible +loading = Cargando... +show-more = Mostrar mas + +show-panel = Mostrar panel +force-icon-buttons-in-panel = Forzar iconos en el panel padding = Relleno padding-description = El relleno es el espacio entre los iconos y el borde del dock o panel. @@ -19,5 +33,44 @@ spacing-description = El espacio es la distancia entre los iconos en el dock o p save = Guardar cancel = Cancelar +close = Cerrar +create = Crear + +navigation = Navegar + save-current-color-scheme = Guardar esquema de color actual color-scheme-name = Nombre del esquema de color +create-snapshot = Crear copia de seguridad +create-snapshot-description = Está a punto de crear una copia de seguridad; esto guardará el estado actual de su escritorio y permitirá restaurarlo más adelante +restore-snapshot = Restaurar copia de seguridad +delete-snapshot = Eliminar copia de seguridad +no-snapshots = No hay copias de seguridad disponibles +snapshot-name = Nombre de la copia de seguridad +name = Nombre +type = Tipo +created = Creado +actions = Acciones +system = Sistema +user = Usuario + +## Snapshots +application-opened = Aplicación abierta + +## About +about = Acerca de +repository = Repositorio +support = Soporte +website = Sitio web + +## Settings +settings = Ajustes + +### Appearance +appearance = Apariencia +theme = Tema +match-desktop = Igual al escritorio +dark = Oscruro +light = Claro + +# Menu +view = Ver diff --git a/i18n/es/cosmic_ext_tweaks.ftl b/i18n/es/cosmic_ext_tweaks.ftl new file mode 100644 index 0000000..4eb840c --- /dev/null +++ b/i18n/es/cosmic_ext_tweaks.ftl @@ -0,0 +1,76 @@ +app-title = Tweaks para COSMIC +app-description = Una herramienta para personalizar la apariencia de COSMIC. + +# Pages +home = Inicio +dock = Dock +panel = Panel +layouts = Acomodos de escritorio +color-schemes = Esquemas de color +snapshots = Copia de seguridad + +color-schemes-error = Error al cargar los esquemas de color +import-color-scheme = Importar esquema de color +delete-color-scheme = Eliminar esquema de color +available-color-schemes-body = Encuentra e instala esquemas de color +install-color-scheme = Instalar esquema de color +find-color-schemes = Buscar esquemas de color +open-containing-folder = Abrir carpeta contenedora +open-link = Abrir enlace +installed = Instalado +available = Disponible +loading = Cargando... +show-more = Mostrar mas + +show-panel = Mostrar panel +force-icon-buttons-in-panel = Forzar iconos en el panel + +padding = Relleno +padding-description = El relleno es el espacio entre los iconos y el borde del dock o panel. + +spacing = Espaciado +spacing-description = El espacio es la distancia entre los iconos en el dock o panel. + +save = Guardar +cancel = Cancelar +close = Cerrar +create = Crear + +navigation = Navegar + +save-current-color-scheme = Guardar esquema de color actual +color-scheme-name = Nombre del esquema de color +create-snapshot = Crear copia de seguridad +create-snapshot-description = Está a punto de crear una copia de seguridad; esto guardará el estado actual de su escritorio y permitirá restaurarlo más adelante +restore-snapshot = Restaurar copia de seguridad +delete-snapshot = Eliminar copia de seguridad +no-snapshots = No hay copias de seguridad disponibles +snapshot-name = Nombre de la copia de seguridad +name = Nombre +type = Tipo +created = Creado +actions = Acciones +system = Sistema +user = Usuario + +## Snapshots +application-opened = Aplicación abierta + +## About +about = Acerca de +repository = Repositorio +support = Soporte +website = Sitio web + +## Settings +settings = Ajustes + +### Appearance +appearance = Apariencia +theme = Tema +match-desktop = Igual al escritorio +dark = Oscruro +light = Claro + +# Menu +view = Ver diff --git a/i18n/fr/cosmic_ext_tweaks.ftl b/i18n/fr/cosmic_ext_tweaks.ftl index 9c5dc41..ce7a7b1 100644 --- a/i18n/fr/cosmic_ext_tweaks.ftl +++ b/i18n/fr/cosmic_ext_tweaks.ftl @@ -1,21 +1,27 @@ app-title = Tweaks pour COSMIC app-description = Un outil pour customizer votre COSMIC expérience. +# Pages home = Home dock = Dock panel = Panneau +layouts = Layouts color-schemes = Color schemes +snapshots = Snapshots + color-schemes-error = Error loading color schemes import-color-scheme = Import color scheme delete-color-scheme = Delete color scheme +available-color-schemes-body = Find and install color schemes install-color-scheme = Install color scheme +find-color-schemes = Find color schemes open-containing-folder = Ouvrir le dossier open-link = Ouvrir le lien installed = Installés available = Disponibles loading = Chargement... +show-more = Show more -# Panel only show-panel = Afficher le panneau force-icon-buttons-in-panel = Forcer l'affichage des boutons avec des icons dans le panneau @@ -27,5 +33,44 @@ spacing-description = L'espacement est l'espace entre les icônes dans le dock o save = Sauvegarder cancel = Annuler +close = Close +create = Create + +navigation = Navigation + save-current-color-scheme = Save current color scheme color-scheme-name = Color scheme name +create-snapshot = Create snapshot +create-snapshot-description = You are about to create a snapshot, this will save the current state of your desktop and make it possible to restore it later on. +restore-snapshot = Restore snapshot +delete-snapshot = Delete snapshot +no-snapshots = No snapshots available +snapshot-name = Snapshot name +name = Name +type = Type +created = Created +actions = Actions +system = System +user = User + +## Snapshots +application-opened = Application opened + +## About +about = About +repository = Repository +support = Support +website = Website + +## Settings +settings = Settings + +### Appearance +appearance = Appearance +theme = Theme +match-desktop = Match desktop +dark = Dark +light = Light + +# Menu +view = View diff --git a/i18n/sv/cosmic_ext_tweaks.ftl b/i18n/sv/cosmic_ext_tweaks.ftl index 0006469..94e8b1e 100644 --- a/i18n/sv/cosmic_ext_tweaks.ftl +++ b/i18n/sv/cosmic_ext_tweaks.ftl @@ -1,13 +1,18 @@ app-title = Tweaks för COSMIC app-description = Ett verktyg för att anpassa din COSMIC-skrivbordsupplevelse. +# Pages home = Hem dock = Docka panel = Panel color-schemes = Färgscheman +layouts = Layouts +snapshots = Snapshots + color-schemes-error = Ett fel uppstod när färgscheman skulle läsas in import-color-scheme = Importera färgschema delete-color-scheme = Ta bort färgschema +available-color-schemes-body = Find and install color schemes install-color-scheme = Installera färgschema find-color-schemes = Hitta färgschema open-containing-folder = Öppna innehållande mapp @@ -16,10 +21,7 @@ installed = Installerat available = Tillgängligt loading = Laddar... show-more = Visa mer -about = Om -find-themes = Hitta teman -# Panel endast show-panel = Visa panel force-icon-buttons-in-panel = Forcera ikonknappar i panelen @@ -31,10 +33,31 @@ spacing-description = Avståndet är utrymmet mellan ikonerna i dockan eller pan save = Spara cancel = Avbryt +close = Close +create = Create + +navigation = Navigation + save-current-color-scheme = Spara nuvarande färgschema color-scheme-name = Färgschema namn +create-snapshot = Create snapshot +create-snapshot-description = You are about to create a snapshot, this will save the current state of your desktop and make it possible to restore it later on. +restore-snapshot = Restore snapshot +delete-snapshot = Delete snapshot +no-snapshots = No snapshots available +snapshot-name = Snapshot name +name = Name +type = Type +created = Created +actions = Actions +system = System +user = User + +## Snapshots +application-opened = Application opened ## Om +about = Om repository = Förråd support = Support website = Hemsida diff --git a/src/app.rs b/src/app.rs index 81ec86d..827bfbf 100644 --- a/src/app.rs +++ b/src/app.rs @@ -24,7 +24,9 @@ use key_bind::key_binds; use pages::color_schemes::providers::cosmic_themes::CosmicTheme; use crate::{ - core::{icons, nav::Page}, + app::config::{AppTheme, TweaksConfig, CONFIG_VERSION}, + app::nav::Page, + core::icons, fl, pages::{ self, @@ -34,10 +36,14 @@ use crate::{ panel::Panel, snapshots::{config::SnapshotKind, Snapshots}, }, - settings::{AppTheme, TweaksSettings, CONFIG_VERSION}, }; +pub mod config; +pub mod cosmic_panel_button_config; mod key_bind; +pub mod nav; +pub mod resources; +pub mod settings; pub mod style; pub struct TweakTool { @@ -56,7 +62,7 @@ pub struct TweakTool { context_page: ContextPage, app_themes: Vec, config_handler: Option, - config: TweaksSettings, + config: TweaksConfig, available: Vec, status: Status, limit: usize, @@ -133,7 +139,7 @@ impl Action for TweaksAction { #[derive(Clone, Debug)] pub struct Flags { pub config_handler: Option, - pub config: TweaksSettings, + pub config: TweaksConfig, } impl Application for TweakTool { @@ -215,7 +221,7 @@ impl Application for TweakTool { )), app.update(Message::Snapshots( pages::snapshots::Message::CreateSnapshot( - "Application opened".into(), + fl!("application-opened"), SnapshotKind::System, ), )), diff --git a/src/settings.rs b/src/app/config.rs similarity index 85% rename from src/settings.rs rename to src/app/config.rs index 28c1ca6..6a6595e 100644 --- a/src/settings.rs +++ b/src/app/config.rs @@ -9,24 +9,24 @@ use crate::app::TweakTool; pub const CONFIG_VERSION: u64 = 1; #[derive(Clone, Default, Debug, Eq, PartialEq, Deserialize, Serialize, CosmicConfigEntry)] -pub struct TweaksSettings { +pub struct TweaksConfig { pub app_theme: AppTheme, } -impl TweaksSettings { +impl TweaksConfig { pub fn config_handler() -> Option { Config::new(TweakTool::APP_ID, CONFIG_VERSION).ok() } - pub fn config() -> TweaksSettings { + pub fn config() -> TweaksConfig { match Self::config_handler() { Some(config_handler) => { - TweaksSettings::get_entry(&config_handler).unwrap_or_else(|(errs, config)| { + TweaksConfig::get_entry(&config_handler).unwrap_or_else(|(errs, config)| { log::info!("errors loading config: {:?}", errs); config }) } - None => TweaksSettings::default(), + None => TweaksConfig::default(), } } } diff --git a/src/core/cosmic_panel_button_config.rs b/src/app/cosmic_panel_button_config.rs similarity index 100% rename from src/core/cosmic_panel_button_config.rs rename to src/app/cosmic_panel_button_config.rs diff --git a/src/core/nav.rs b/src/app/nav.rs similarity index 100% rename from src/core/nav.rs rename to src/app/nav.rs diff --git a/src/app/resources.rs b/src/app/resources.rs new file mode 100644 index 0000000..47e915b --- /dev/null +++ b/src/app/resources.rs @@ -0,0 +1,4 @@ +pub const COSMIC_LAYOUT: &str = include_str!("../../res/layouts/cosmic.ron"); +pub const MAC_LAYOUT: &str = include_str!("../../res/layouts/mac.ron"); +pub const WINDOWS_LAYOUT: &str = include_str!("../../res/layouts/windows.ron"); +pub const UBUNTU_LAYOUT: &str = include_str!("../../res/layouts/ubuntu.ron"); diff --git a/src/app/settings.rs b/src/app/settings.rs new file mode 100644 index 0000000..de903eb --- /dev/null +++ b/src/app/settings.rs @@ -0,0 +1,31 @@ +use crate::core::localize; + +use super::icons::{IconCache, ICON_CACHE}; +use std::sync::Mutex; + +pub fn settings() -> cosmic::app::Settings { + cosmic::app::Settings::default().size_limits( + cosmic::iced::Limits::NONE + .min_width(360.0) + .min_height(180.0), + ) +} + +pub fn flags() -> crate::app::Flags { + crate::app::Flags { + config_handler: crate::app::config::TweaksConfig::config_handler(), + config: crate::app::config::TweaksConfig::config(), + } +} + +pub fn init() { + // Icon cache + ICON_CACHE.get_or_init(|| Mutex::new(IconCache::new())); + + // Localize + localize::localize(); + + // Logger + std::env::set_var("RUST_LOG", "cosmic_ext_tweaks=info"); + pretty_env_logger::init(); +} diff --git a/src/core/config.rs b/src/core/config.rs deleted file mode 100644 index 0c8a5a9..0000000 --- a/src/core/config.rs +++ /dev/null @@ -1,23 +0,0 @@ -use super::icons::{IconCache, ICON_CACHE}; -use std::sync::Mutex; - -pub fn get() -> (cosmic::app::Settings, crate::app::Flags) { - ICON_CACHE.get_or_init(|| Mutex::new(IconCache::new())); - init_logger(); - ( - cosmic::app::Settings::default().size_limits( - cosmic::iced::Limits::NONE - .min_width(360.0) - .min_height(180.0), - ), - crate::app::Flags { - config_handler: crate::settings::TweaksSettings::config_handler(), - config: crate::settings::TweaksSettings::config(), - }, - ) -} - -fn init_logger() { - std::env::set_var("RUST_LOG", "cosmic_ext_tweaks=info"); - pretty_env_logger::init(); -} diff --git a/src/core/localization.rs b/src/core/localization.rs deleted file mode 100644 index 922fb93..0000000 --- a/src/core/localization.rs +++ /dev/null @@ -1,31 +0,0 @@ -use i18n_embed::{ - fluent::{fluent_language_loader, FluentLanguageLoader}, - LanguageLoader, -}; -use once_cell::sync::Lazy; -use rust_embed::RustEmbed; - -#[derive(RustEmbed)] -#[folder = "i18n/"] -struct Localizations; - -pub static LANGUAGE_LOADER: Lazy = Lazy::new(|| { - let loader: FluentLanguageLoader = fluent_language_loader!(); - - loader - .load_fallback_language(&Localizations) - .expect("Error while loading fallback language"); - - loader -}); - -#[macro_export] -macro_rules! fl { - ($message_id:literal) => {{ - i18n_embed_fl::fl!($crate::core::localization::LANGUAGE_LOADER, $message_id) - }}; - - ($message_id:literal, $($args:expr),*) => {{ - i18n_embed_fl::fl!($crate::core::localization::LANGUAGE_LOADER, $message_id, $($args), *) - }}; -} diff --git a/src/core/localize.rs b/src/core/localize.rs new file mode 100644 index 0000000..bf860cc --- /dev/null +++ b/src/core/localize.rs @@ -0,0 +1,47 @@ +// SPDX-License-Identifier: GPL-3.0-only + +use i18n_embed::{ + fluent::{fluent_language_loader, FluentLanguageLoader}, + DefaultLocalizer, LanguageLoader, Localizer, +}; +use once_cell::sync::Lazy; +use rust_embed::RustEmbed; + +#[derive(RustEmbed)] +#[folder = "i18n/"] +struct Localizations; + +pub static LANGUAGE_LOADER: Lazy = Lazy::new(|| { + let loader: FluentLanguageLoader = fluent_language_loader!(); + + loader + .load_fallback_language(&Localizations) + .expect("Error while loading fallback language"); + + loader +}); + +#[macro_export] +macro_rules! fl { + ($message_id:literal) => {{ + i18n_embed_fl::fl!($crate::core::localize::LANGUAGE_LOADER, $message_id) + }}; + + ($message_id:literal, $($args:expr),*) => {{ + i18n_embed_fl::fl!($crate::core::localize::LANGUAGE_LOADER, $message_id, $($args), *) + }}; +} + +// Get the `Localizer` to be used for localizing this library. +pub fn localizer() -> Box { + Box::from(DefaultLocalizer::new(&*LANGUAGE_LOADER, &Localizations)) +} + +pub fn localize() { + let localizer = localizer(); + let requested_languages = i18n_embed::DesktopLanguageRequester::requested_languages(); + + if let Err(error) = localizer.select(&requested_languages) { + eprintln!("Error while loading language for App List {}", error); + } +} diff --git a/src/core/mod.rs b/src/core/mod.rs index 2258f28..086db6b 100644 --- a/src/core/mod.rs +++ b/src/core/mod.rs @@ -1,5 +1,2 @@ -pub mod config; -pub mod cosmic_panel_button_config; pub mod icons; -pub mod localization; -pub mod nav; +pub mod localize; diff --git a/src/main.rs b/src/main.rs index 86aa88f..17a0bb5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,10 +1,10 @@ mod app; mod core; mod pages; -mod resources; -mod settings; + +use app::settings; fn main() -> cosmic::iced::Result { - let (settings, flags) = core::config::get(); - cosmic::app::run::(settings, flags) + settings::init(); + cosmic::app::run::(settings::settings(), settings::flags()) } diff --git a/src/pages/color_schemes/preview.rs b/src/pages/color_schemes/preview.rs index b5d9fe9..ba999f4 100644 --- a/src/pages/color_schemes/preview.rs +++ b/src/pages/color_schemes/preview.rs @@ -29,7 +29,7 @@ pub fn installed<'a>( .padding(spacing.space_xxs) .into(), widget::row::with_children(vec![ - widget::container(widget::text("Navigation")) + widget::container(widget::text(fl!("navigation"))) .padding(spacing.space_xxs) .width(90.0) .height(Length::Fill) @@ -90,7 +90,7 @@ pub fn available<'a>(color_scheme: &ColorScheme) -> Element<'a, crate::app::Mess .padding([spacing.space_xxs, spacing.space_none]) .into(), widget::row::with_children(vec![ - widget::container(widget::text("Navigation")) + widget::container(widget::text(fl!("navigation"))) .padding(spacing.space_xxs) .width(90.0) .height(Length::Fill) diff --git a/src/pages/layouts/config.rs b/src/pages/layouts/config.rs index 26ce965..a43eb53 100644 --- a/src/pages/layouts/config.rs +++ b/src/pages/layouts/config.rs @@ -2,7 +2,7 @@ use super::{ preview::{LayoutPreview, PanelProperties, Position}, Message, }; -use crate::resources; +use crate::app::resources; use cosmic::{widget, Element}; use cosmic_ext_config_templates::Schema; use serde::{Deserialize, Serialize}; diff --git a/src/pages/panel.rs b/src/pages/panel.rs index 5c8fb57..28c8c7b 100644 --- a/src/pages/panel.rs +++ b/src/pages/panel.rs @@ -6,10 +6,8 @@ use cosmic_panel_config::CosmicPanelConfig; use serde::{Deserialize, Serialize}; use crate::{ - core::{ - cosmic_panel_button_config::{CosmicPanelButtonConfig, IndividualConfig, Override}, - icons, - }, + app::cosmic_panel_button_config::{CosmicPanelButtonConfig, IndividualConfig, Override}, + core::icons, fl, }; diff --git a/src/pages/snapshots.rs b/src/pages/snapshots.rs index a2d9e81..e1448f0 100644 --- a/src/pages/snapshots.rs +++ b/src/pages/snapshots.rs @@ -166,10 +166,10 @@ impl Snapshots { match self.config.set_snapshots(helper, snapshots) { Ok(written) => { if !written { - log::error!("Failed to write layouts to config"); + log::error!("Failed to write snapshots to config"); } } - Err(e) => log::error!("Failed to set layouts: {}", e), + Err(e) => log::error!("Failed to set snapshots: {}", e), } } } @@ -195,10 +195,10 @@ impl Snapshots { match self.config.set_snapshots(helper, snapshots) { Ok(written) => { if !written { - log::error!("Failed to write layouts to config"); + log::error!("Failed to write snapshots to config"); } } - Err(e) => log::error!("Failed to set layouts: {}", e), + Err(e) => log::error!("Failed to set snapshots: {}", e), } } } diff --git a/src/resources.rs b/src/resources.rs deleted file mode 100644 index 98cd1df..0000000 --- a/src/resources.rs +++ /dev/null @@ -1,4 +0,0 @@ -pub const COSMIC_LAYOUT: &str = include_str!("../res/layouts/cosmic.ron"); -pub const MAC_LAYOUT: &str = include_str!("../res/layouts/mac.ron"); -pub const WINDOWS_LAYOUT: &str = include_str!("../res/layouts/windows.ron"); -pub const UBUNTU_LAYOUT: &str = include_str!("../res/layouts/ubuntu.ron");