Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions i18n/en/cosmic_files.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ theme = Theme
match-desktop = Match desktop
dark = Dark
light = Light
enable-thumbnails = Thumbnails

### Type to Search
type-to-search = Type to Search
Expand Down
21 changes: 20 additions & 1 deletion src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ use wayland_client::{Proxy, protocol::wl_output::WlOutput};
use crate::{
clipboard::{ClipboardCopy, ClipboardKind, ClipboardPaste},
config::{
AppTheme, Config, DesktopConfig, Favorite, IconSizes, TIME_CONFIG_ID, TabConfig,
AppTheme, Config, DesktopConfig, Favorite, IconSizes, TIME_CONFIG_ID, TabConfig, ThumbCfg,
TimeConfig, TypeToSearch,
},
dialog::{Dialog, DialogKind, DialogMessage, DialogResult},
Expand Down Expand Up @@ -387,6 +387,7 @@ pub enum Message {
TabPrev,
TabClose(Option<Entity>),
TabConfig(TabConfig),
ThumbConfig(ThumbCfg),
TabMessage(Option<Entity>, tab::Message),
TabNew,
TabRescan(
Expand Down Expand Up @@ -1905,6 +1906,18 @@ impl App {
},
))
})
.add({
let thumb_cfg = self.config.thumb_cfg;
widget::settings::item::builder(fl!("enable-thumbnails")).toggler(
thumb_cfg.enabled,
move |enabled| {
Message::ThumbConfig(ThumbCfg {
enabled,
..thumb_cfg
})
},
)
})
.into(),
widget::settings::section()
.title(fl!("type-to-search"))
Expand Down Expand Up @@ -3803,6 +3816,12 @@ impl Application for App {
return self.update_config();
}
}
Message::ThumbConfig(config) => {
if config != self.config.thumb_cfg {
config_set!(thumb_cfg, config);
return self.update_config();
}
}
Message::ToggleFoldersFirst => {
let mut config = self.config.tab;
config.folders_first = !config.folders_first;
Expand Down
2 changes: 2 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ pub struct ThumbCfg {
pub jobs: NonZeroU16,
pub max_mem_mb: NonZeroU16,
pub max_size_mb: NonZeroU16,
pub enabled: bool,
}

impl Default for ThumbCfg {
Expand All @@ -306,6 +307,7 @@ impl Default for ThumbCfg {
jobs: 4.try_into().unwrap(),
max_mem_mb: 2000.try_into().unwrap(),
max_size_mb: 64.try_into().unwrap(),
enabled: true,
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/tab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5614,7 +5614,7 @@ impl Tab {
};

for item in items.iter() {
if item.thumbnail_opt.is_some() {
if item.thumbnail_opt.is_some() || !self.thumb_config.enabled {
// Skip items that already have a mime type and thumbnail
continue;
}
Expand Down
Loading