set title for "similar tracks" view
This commit is contained in:
@@ -263,6 +263,11 @@ impl ListItem for Track {
|
||||
queue.clone(),
|
||||
library.clone(),
|
||||
)
|
||||
.set_title(format!(
|
||||
"Similar to \"{} - {}\"",
|
||||
self.artists.join(", "),
|
||||
self.title
|
||||
))
|
||||
.as_boxed_view_ext()
|
||||
})
|
||||
}
|
||||
|
||||
@@ -106,6 +106,7 @@ pub struct ListView<I: ListItem> {
|
||||
queue: Arc<Queue>,
|
||||
library: Arc<Library>,
|
||||
pagination: Pagination<I>,
|
||||
title: String,
|
||||
}
|
||||
|
||||
impl<I: ListItem> ListView<I> {
|
||||
@@ -122,9 +123,15 @@ impl<I: ListItem> ListView<I> {
|
||||
queue,
|
||||
library,
|
||||
pagination: Pagination::default(),
|
||||
title: "".to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_title(mut self, title: String) -> Self {
|
||||
self.title = title;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn get_pagination(&self) -> &Pagination<I> {
|
||||
&self.pagination
|
||||
}
|
||||
@@ -433,6 +440,10 @@ impl<I: ListItem> View for ListView<I> {
|
||||
}
|
||||
|
||||
impl<I: ListItem + Clone> ViewExt for ListView<I> {
|
||||
fn title(&self) -> String {
|
||||
self.title.clone()
|
||||
}
|
||||
|
||||
fn on_command(&mut self, _s: &mut Cursive, cmd: &Command) -> Result<CommandResult, String> {
|
||||
match cmd {
|
||||
Command::Play => {
|
||||
|
||||
Reference in New Issue
Block a user