generated from cosmic-utils/cosmic-app-template
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Work on config saving and also localize
- Loading branch information
Aaron Honeycutt
committed
May 24, 2024
1 parent
64d0f50
commit 0ed0f1f
Showing
5 changed files
with
61 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// use crate::app::icon_cache::{IconCache, ICON_CACHE}; | ||
use crate::app::Flags; | ||
use cosmic::app::Settings; | ||
use cosmic::iced::{Limits, Size}; | ||
use std::sync::Mutex; | ||
|
||
use super::config::CosmicBackupsConfig; | ||
// use super::localize::set_localization; | ||
|
||
pub fn init() -> (Settings, Flags) { | ||
// set_localization(); | ||
// set_icon_cache(); | ||
set_logger(); | ||
let settings = get_app_settings(); | ||
let flags = get_flags(); | ||
(settings, flags) | ||
} | ||
|
||
pub fn get_app_settings() -> Settings { | ||
let config = CosmicBackupsConfig::config(); | ||
|
||
let mut settings = Settings::default(); | ||
settings = settings.theme(config.app_theme.theme()); | ||
settings = settings.size_limits(Limits::NONE.min_width(400.0).min_height(180.0)); | ||
settings = settings.size(Size::new(800.0, 800.0)); | ||
settings = settings.debug(false); | ||
settings | ||
} | ||
|
||
pub fn set_logger() { | ||
env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("warn")).init(); | ||
} | ||
|
||
// pub fn set_icon_cache() { | ||
// ICON_CACHE.get_or_init(|| Mutex::new(IconCache::new())); | ||
// } | ||
|
||
pub fn get_flags() -> Flags { | ||
let (config_handler, config) = ( | ||
CosmicBackupsConfig::config_handler(), | ||
CosmicBackupsConfig::config(), | ||
); | ||
|
||
let flags = Flags { | ||
config_handler, | ||
config, | ||
}; | ||
flags | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
|
||
pub mod localization; | ||
// pub mod localization; |