refactor: apply limit on the number of persisted sort names
This commit is contained in:
parent
84b73b0bdc
commit
e4ffec63a1
5 changed files with 61 additions and 16 deletions
|
|
@ -7,6 +7,7 @@ use cosmic::{
|
|||
iced::Subscription,
|
||||
theme, Application,
|
||||
};
|
||||
use ordermap::OrderMap;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
|
|
@ -107,13 +108,13 @@ pub enum TypeToSearch {
|
|||
#[derive(Clone, CosmicConfigEntry, Debug, Deserialize, Eq, PartialEq, Serialize)]
|
||||
#[serde(default)]
|
||||
pub struct State {
|
||||
pub sort_names: HashMap<String, (HeadingOptions, bool)>,
|
||||
pub sort_names: ordermap::OrderMap<String, (HeadingOptions, bool)>,
|
||||
}
|
||||
|
||||
impl Default for State {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
sort_names: HashMap::from_iter(dirs::download_dir().into_iter().map(|dir| {
|
||||
sort_names: OrderMap::from_iter(dirs::download_dir().into_iter().map(|dir| {
|
||||
(
|
||||
Location::Path(dir).normalize().to_string(),
|
||||
(HeadingOptions::Modified, false),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue