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