Show parent folder in details, part of #541
This commit is contained in:
parent
a5dfffcd72
commit
2b4a14dfe2
3 changed files with 120 additions and 69 deletions
20
src/tab.rs
20
src/tab.rs
|
|
@ -909,8 +909,8 @@ impl Location {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn scan(&self, sizes: IconSizes) -> Vec<Item> {
|
||||
match self {
|
||||
pub fn scan(&self, sizes: IconSizes) -> (Option<Item>, Vec<Item>) {
|
||||
let items = match self {
|
||||
Self::Desktop(path, display, desktop_config) => {
|
||||
scan_desktop(path, display, *desktop_config, sizes)
|
||||
}
|
||||
|
|
@ -922,7 +922,19 @@ impl Location {
|
|||
Self::Trash => scan_trash(sizes),
|
||||
Self::Recents => scan_recents(sizes),
|
||||
Self::Network(uri, _) => scan_network(uri, sizes),
|
||||
}
|
||||
};
|
||||
let parent_item_opt = match self.path_opt() {
|
||||
Some(path) => match item_from_path(path, sizes) {
|
||||
Ok(item) => Some(item),
|
||||
Err(err) => {
|
||||
log::warn!("failed to get item for {:?}: {}", path, err);
|
||||
None
|
||||
}
|
||||
},
|
||||
//TODO: support other locations?
|
||||
None => None,
|
||||
};
|
||||
(parent_item_opt, items)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1535,6 +1547,7 @@ pub struct Tab {
|
|||
pub sort_name: HeadingOptions,
|
||||
pub sort_direction: bool,
|
||||
pub gallery: bool,
|
||||
pub(crate) parent_item_opt: Option<Item>,
|
||||
pub(crate) items_opt: Option<Vec<Item>>,
|
||||
pub dnd_hovered: Option<(Location, Instant)>,
|
||||
scrollable_id: widget::Id,
|
||||
|
|
@ -1607,6 +1620,7 @@ impl Tab {
|
|||
sort_name: HeadingOptions::Name,
|
||||
sort_direction: true,
|
||||
gallery: false,
|
||||
parent_item_opt: None,
|
||||
items_opt: None,
|
||||
scrollable_id: widget::Id::unique(),
|
||||
select_focus: None,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue