Update trash icon in nav bar on change

This commit is contained in:
Josh Megnauth 2024-03-21 00:44:40 -04:00
parent 2f5bbc5e7f
commit 6a5f23acec
No known key found for this signature in database
GPG key ID: 70813183462EFAD3

View file

@ -1101,7 +1101,22 @@ impl Application for App {
*progress = new_progress;
}
}
Message::RescanTrash => return self.rescan_trash(),
Message::RescanTrash => {
// Update trash icon if empty/full
let maybe_entity = self.nav_model.iter().find(|&entity| {
self.nav_model
.data::<Location>(entity)
.map(|loc| *loc == Location::Trash)
.unwrap_or_default()
});
if let Some(entity) = maybe_entity {
self.nav_model
.icon_set(entity, widget::icon::icon(tab::trash_icon_symbolic(16)));
}
return self.rescan_trash();
}
Message::Rename(entity_opt) => {
let entity = entity_opt.unwrap_or_else(|| self.tab_model.active());
if let Some(tab) = self.tab_model.data_mut::<Tab>(entity) {