Merge pull request #1498 from jpttrssn/calculate-size-desktop
fix: Update data on preview in desktop mode
This commit is contained in:
commit
a4d1548a33
1 changed files with 32 additions and 8 deletions
40
src/app.rs
40
src/app.rs
|
|
@ -3701,7 +3701,10 @@ impl Application for App {
|
|||
id,
|
||||
Window::new(WindowKind::Preview(entity_opt, preview_kind)),
|
||||
);
|
||||
return command.map(|_id| cosmic::action::none());
|
||||
return Task::batch([
|
||||
self.update_desktop(), // Force re-calculating of directory sizes
|
||||
command.map(|_id| cosmic::action::none()),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -6275,18 +6278,39 @@ impl Application for App {
|
|||
}
|
||||
}
|
||||
|
||||
let mut selected_preview = None;
|
||||
if self.core.window.show_context {
|
||||
if let ContextPage::Preview(entity_opt, PreviewKind::Selected) = self.context_page {
|
||||
selected_preview = Some(entity_opt.unwrap_or_else(|| self.tab_model.active()));
|
||||
let mut selected_previews = Vec::new();
|
||||
match self.mode {
|
||||
Mode::App => {
|
||||
if self.core.window.show_context {
|
||||
if let ContextPage::Preview(entity_opt, PreviewKind::Selected) =
|
||||
self.context_page
|
||||
{
|
||||
selected_previews
|
||||
.push(Some(entity_opt.unwrap_or_else(|| self.tab_model.active())));
|
||||
}
|
||||
}
|
||||
}
|
||||
Mode::Desktop => {
|
||||
for window_kind in self.windows.iter().map(|(_, window)| &window.kind) {
|
||||
if let WindowKind::Preview(entity_opt, _) = window_kind {
|
||||
selected_previews
|
||||
.push(Some(entity_opt.unwrap_or_else(|| self.tab_model.active())));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
subscriptions.extend(self.tab_model.iter().filter_map(|entity| {
|
||||
let tab = self.tab_model.data::<Tab>(entity)?;
|
||||
Some(
|
||||
tab.subscription(selected_preview == Some(entity))
|
||||
.with(entity)
|
||||
.map(|(entity, tab_msg)| Message::TabMessage(Some(entity), tab_msg)),
|
||||
tab.subscription(
|
||||
selected_previews
|
||||
.iter()
|
||||
.find(|preview| preview.as_ref() == Some(entity).as_ref())
|
||||
.is_some(),
|
||||
)
|
||||
.with(entity)
|
||||
.map(|(entity, tab_msg)| Message::TabMessage(Some(entity), tab_msg)),
|
||||
)
|
||||
}));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue