factor out modules; modal -> dialog

This commit is contained in:
🪞👃🪞 2025-04-06 16:05:48 +03:00
parent c075871e50
commit b157a87647
7 changed files with 163 additions and 158 deletions

View file

@ -86,6 +86,28 @@ impl Entry {
pub fn set_track (&self, value: &impl AsRef<str>) -> Option<TagItem> {
self.info.write().unwrap().set_track(value)
}
pub const ICON_DIRECTORY: &'static str = "";
pub const ICON_IMAGE: &'static str = "󰋩";
pub const ICON_MUSIC: &'static str = "";
pub const ICON_MUSIC_NO_META: &'static str = "󰎇";
pub const ICON_UNKNOWN: &'static str = "";
pub fn name (&self) -> Option<Arc<str>> {
let indent = "".pad_to_width((self.depth - 1) * 2);
let icon = self.icon();
let name = self.path.iter().last().expect("empty path").display();
Some(format!("{indent}{icon} {name}").into())
}
fn icon (&self) -> &'static str {
if self.is_directory() {
Self::ICON_DIRECTORY
} else if self.is_image() {
Self::ICON_IMAGE
} else if self.is_music() {
Self::ICON_MUSIC
} else {
Self::ICON_UNKNOWN
}
}
}
impl Eq for Entry {}