Add to sidebar in breadcrumb context menu, fixes #526, fixes #395

This commit is contained in:
Jeremy Soller 2024-10-14 10:09:57 -06:00
parent a6f7a70f3d
commit a9daddb1b0
No known key found for this signature in database
GPG key ID: D02FD439211AF56F
3 changed files with 41 additions and 13 deletions

View file

@ -772,7 +772,7 @@ impl App {
} else if let Some(file_name) = path.file_name().and_then(|x| x.to_str()) {
file_name.to_string()
} else {
continue;
fl!("filesystem")
};
nav_model = nav_model.insert(move |b| {
b.text(name.clone())
@ -2509,6 +2509,15 @@ impl Application for App {
self.set_show_context(true);
self.set_context_title(self.context_page.title());
}
tab::Command::AddToSidebar(path) => {
let mut favorites = self.config.favorites.clone();
let favorite = Favorite::from_path(path);
if !favorites.iter().any(|f| f == &favorite) {
favorites.push(favorite);
}
config_set!(favorites, favorites);
commands.push(self.update_config());
}
tab::Command::ChangeLocation(tab_title, tab_path, selection_path) => {
self.activate_nav_model_location(&tab_path);