Add separators to navbar, part of #335

This commit is contained in:
Jeremy Soller 2024-09-11 12:53:25 -06:00
parent 5d596239be
commit 24a44c3b52
No known key found for this signature in database
GPG key ID: D02FD439211AF56F
3 changed files with 26 additions and 19 deletions

View file

@ -635,6 +635,7 @@ impl App {
b.text(fl!("trash"))
.icon(widget::icon::icon(tab::trash_icon_symbolic(16)))
.data(Location::Trash)
.divider_above()
});
// Collect all mounter items
@ -647,7 +648,7 @@ impl App {
// Sort by name lexically
nav_items.sort_by(|a, b| LANGUAGE_SORTER.compare(&a.1.name(), &b.1.name()));
// Add items to nav model
for (key, item) in nav_items {
for (i, (key, item)) in nav_items.into_iter().enumerate() {
nav_model = nav_model.insert(|mut b| {
b = b.text(item.name()).data(MounterData(key, item.clone()));
if let Some(path) = item.path() {
@ -659,6 +660,9 @@ impl App {
if item.is_mounted() {
b = b.closable();
}
if i == 0 {
b = b.divider_above();
}
b
});
}

View file

@ -439,7 +439,7 @@ impl App {
// Sort by name lexically
nav_items.sort_by(|a, b| LANGUAGE_SORTER.compare(&a.1.name(), &b.1.name()));
// Add items to nav model
for (key, item) in nav_items {
for (i, (key, item)) in nav_items.into_iter().enumerate() {
nav_model = nav_model.insert(|mut b| {
b = b.text(item.name()).data(MounterData(key, item.clone()));
if let Some(path) = item.path() {
@ -451,6 +451,9 @@ impl App {
if item.is_mounted() {
b = b.closable();
}
if i == 0 {
b = b.divider_above();
}
b
});
}