mirror of
https://codeberg.org/unspeaker/perch.git
synced 2025-12-06 17:46:42 +01:00
factor out modules; modal -> dialog
This commit is contained in:
parent
c075871e50
commit
b157a87647
7 changed files with 163 additions and 158 deletions
|
|
@ -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 {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue