fix: Update data on preview in desktop mode
This commit is contained in:
parent
cebb8f2c66
commit
0978a0a5f7
1 changed files with 32 additions and 8 deletions
40
src/app.rs
40
src/app.rs
|
|
@ -3669,7 +3669,10 @@ impl Application for App {
|
||||||
id,
|
id,
|
||||||
Window::new(WindowKind::Preview(entity_opt, preview_kind)),
|
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()),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -6243,18 +6246,39 @@ impl Application for App {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut selected_preview = None;
|
let mut selected_previews = Vec::new();
|
||||||
if self.core.window.show_context {
|
match self.mode {
|
||||||
if let ContextPage::Preview(entity_opt, PreviewKind::Selected) = self.context_page {
|
Mode::App => {
|
||||||
selected_preview = Some(entity_opt.unwrap_or_else(|| self.tab_model.active()));
|
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| {
|
subscriptions.extend(self.tab_model.iter().filter_map(|entity| {
|
||||||
let tab = self.tab_model.data::<Tab>(entity)?;
|
let tab = self.tab_model.data::<Tab>(entity)?;
|
||||||
Some(
|
Some(
|
||||||
tab.subscription(selected_preview == Some(entity))
|
tab.subscription(
|
||||||
.with(entity)
|
selected_previews
|
||||||
.map(|(entity, tab_msg)| Message::TabMessage(Some(entity), tab_msg)),
|
.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