Make items_opt private

This commit is contained in:
Jeremy Soller 2024-02-29 13:42:13 -07:00
parent bcd5da57ab
commit b9f959a298
No known key found for this signature in database
GPG key ID: D02FD439211AF56F
4 changed files with 61 additions and 47 deletions

View file

@ -451,7 +451,7 @@ impl Application for App {
}
// Select based on filename
if let Some(items) = &mut self.tab.items_opt {
if let Some(items) = self.tab.items_opt_mut() {
for item in items.iter_mut() {
item.selected = item.name == new_filename;
}
@ -488,8 +488,8 @@ impl Application for App {
},
Message::Open => {
let mut paths = Vec::new();
if let Some(ref mut items) = self.tab.items_opt {
for item in items.iter_mut() {
if let Some(items) = self.tab.items_opt() {
for item in items.iter() {
if item.selected {
paths.push(item.path.clone());
}
@ -563,7 +563,7 @@ impl Application for App {
// Update filename box when anything is selected
if let DialogKind::SaveFile { filename } = &mut self.flags.kind {
if let Some(click_i) = click_i_opt {
if let Some(items) = &self.tab.items_opt {
if let Some(items) = self.tab.items_opt() {
if let Some(item) = items.get(click_i) {
if item.selected && !item.path.is_dir() {
*filename = item.name.clone();
@ -605,7 +605,7 @@ impl Application for App {
}
}
self.tab.items_opt = Some(items);
self.tab.set_items(items);
// Reset focus on location change
return widget::text_input::focus(self.filename_id.clone());