Format
This commit is contained in:
parent
c19e256665
commit
a61e587b1c
1 changed files with 14 additions and 15 deletions
29
src/app.rs
29
src/app.rs
|
|
@ -425,23 +425,21 @@ impl App {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Sort by name lexically
|
// Sort by name lexically
|
||||||
nav_items
|
nav_items.sort_by(|a, b| lexical_sort::natural_lexical_cmp(&a.1.name(), &b.1.name()));
|
||||||
.sort_by(|a, b| lexical_sort::natural_lexical_cmp(&a.1.name(), &b.1.name()));
|
|
||||||
// Add items to nav model
|
// Add items to nav model
|
||||||
for (key, item) in nav_items {
|
for (key, item) in nav_items {
|
||||||
nav_model = nav_model.insert(|mut b| {
|
nav_model = nav_model.insert(|mut b| {
|
||||||
b = b.text(item.name())
|
b = b.text(item.name()).data(MounterData(key, item.clone()));
|
||||||
.data(MounterData(key, item.clone()));
|
if let Some(path) = item.path() {
|
||||||
if let Some(path) = item.path() {
|
b = b.data(Location::Path(path.clone()));
|
||||||
b = b.data(Location::Path(path.clone()));
|
}
|
||||||
}
|
if let Some(icon) = item.icon() {
|
||||||
if let Some(icon) = item.icon() {
|
b = b.icon(widget::icon::icon(icon).size(16));
|
||||||
b = b.icon(widget::icon::icon(icon).size(16));
|
}
|
||||||
}
|
if item.is_mounted() {
|
||||||
if item.is_mounted() {
|
b = b.closable();
|
||||||
b = b.closable();
|
}
|
||||||
}
|
b
|
||||||
b
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1701,7 +1699,8 @@ impl Application for App {
|
||||||
}
|
}
|
||||||
|
|
||||||
NavMenuAction::RemoveFromSidebar(entity) => {
|
NavMenuAction::RemoveFromSidebar(entity) => {
|
||||||
if let Some(FavoriteIndex(favorite_i)) = self.nav_model.data::<FavoriteIndex>(entity)
|
if let Some(FavoriteIndex(favorite_i)) =
|
||||||
|
self.nav_model.data::<FavoriteIndex>(entity)
|
||||||
{
|
{
|
||||||
let mut favorites = self.config.favorites.clone();
|
let mut favorites = self.config.favorites.clone();
|
||||||
favorites.remove(*favorite_i);
|
favorites.remove(*favorite_i);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue