mirror of
https://codeberg.org/unspeaker/perch.git
synced 2025-12-06 09:36:42 +01:00
clear_changes -> revert_all; stub save_all
This commit is contained in:
parent
573bb8ae4c
commit
576725a949
3 changed files with 27 additions and 6 deletions
|
|
@ -11,9 +11,16 @@ impl Perch {
|
||||||
choice: (choice + 1) % 3
|
choice: (choice + 1) % 3
|
||||||
}) },
|
}) },
|
||||||
press!(Enter) => match choice {
|
press!(Enter) => match choice {
|
||||||
0 => { input.done() },
|
0 => {
|
||||||
1 => { self.mode = None },
|
input.done()
|
||||||
2 => todo!(),
|
},
|
||||||
|
1 => {
|
||||||
|
self.mode = None
|
||||||
|
},
|
||||||
|
2 => {
|
||||||
|
self.save_all();
|
||||||
|
input.done()
|
||||||
|
},
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
},
|
},
|
||||||
_ => {}
|
_ => {}
|
||||||
|
|
|
||||||
|
|
@ -12,13 +12,16 @@ impl Perch {
|
||||||
}) },
|
}) },
|
||||||
press!(Enter) => match choice {
|
press!(Enter) => match choice {
|
||||||
0 => {
|
0 => {
|
||||||
self.clear_changes();
|
self.revert_all();
|
||||||
self.mode = None;
|
self.mode = None;
|
||||||
},
|
},
|
||||||
1 => {
|
1 => {
|
||||||
|
self.mode = None;
|
||||||
|
},
|
||||||
|
2 => {
|
||||||
|
self.save_all();
|
||||||
self.mode = None
|
self.mode = None
|
||||||
},
|
},
|
||||||
2 => todo!(),
|
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
},
|
},
|
||||||
_ => {}
|
_ => {}
|
||||||
|
|
|
||||||
13
src/model.rs
13
src/model.rs
|
|
@ -76,7 +76,7 @@ impl Perch {
|
||||||
self.changes
|
self.changes
|
||||||
}
|
}
|
||||||
/// Clear all modified tags.
|
/// Clear all modified tags.
|
||||||
pub(crate) fn clear_changes (&mut self) {
|
pub(crate) fn revert_all (&mut self) {
|
||||||
for entry in self.entries.iter_mut() {
|
for entry in self.entries.iter_mut() {
|
||||||
if let Metadata::Music {
|
if let Metadata::Music {
|
||||||
modified_tag, ..
|
modified_tag, ..
|
||||||
|
|
@ -86,4 +86,15 @@ impl Perch {
|
||||||
}
|
}
|
||||||
self.changes = 0;
|
self.changes = 0;
|
||||||
}
|
}
|
||||||
|
/// Write all modified tags
|
||||||
|
pub(crate) fn save_all (&mut self) {
|
||||||
|
for entry in self.entries.iter_mut() {
|
||||||
|
if let Metadata::Music {
|
||||||
|
original_tag, modified_tag, ..
|
||||||
|
} = &mut *entry.info.write().unwrap() {
|
||||||
|
todo!("save {:?}", entry.path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self.changes = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue