Compare commits
3 commits
ea31535bfb
...
f2f6c67383
Author | SHA1 | Date | |
---|---|---|---|
f2f6c67383 | |||
40612729a1 | |||
e262d31261 |
4 changed files with 14 additions and 9 deletions
|
@ -103,6 +103,7 @@ impl Handle {
|
|||
.map(CString::new)
|
||||
.map(Result::unwrap)
|
||||
.collect();
|
||||
event!(Level::DEBUG, "sending command to mpv: {:?}", args);
|
||||
let mut args: Vec<*const c_char> = args
|
||||
.iter()
|
||||
.map(CString::as_c_str)
|
||||
|
|
|
@ -89,7 +89,7 @@ mod imp {
|
|||
|
||||
#[template_callback]
|
||||
fn on_row_activated(&self, position: u32) {
|
||||
self.obj().window().play_index(position as i64);
|
||||
self.obj().window().playlist_play_index(position as i64);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@ mod imp {
|
|||
#[template(resource = "/eu/callcc/audrey/play_queue_song.ui")]
|
||||
#[properties(wrapper_type = super::Song)]
|
||||
pub struct Song {
|
||||
#[property(get, set = Self::set_playlist_pos)]
|
||||
playlist_pos: Cell<i64>,
|
||||
#[property(type = i64, set = Self::set_playlist_pos)]
|
||||
_playlist_pos: (),
|
||||
|
||||
#[property(set, get)]
|
||||
draggable: Cell<bool>,
|
||||
|
@ -60,13 +60,10 @@ mod imp {
|
|||
#[weak(rename_to = self_)]
|
||||
self,
|
||||
move |_, _, _| {
|
||||
/*
|
||||
self_
|
||||
.obj()
|
||||
.window()
|
||||
.playbin()
|
||||
.remove_entry(self_.obj().displayed_position() as usize - 1)*/
|
||||
todo!()
|
||||
.playlist_remove(self_.obj().position() as i64)
|
||||
}
|
||||
))
|
||||
.build();
|
||||
|
@ -167,7 +164,6 @@ mod imp {
|
|||
}
|
||||
|
||||
fn set_playlist_pos(&self, playlist_pos: i64) {
|
||||
self.playlist_pos.set(playlist_pos);
|
||||
self.obj()
|
||||
.set_current(playlist_pos == self.position.get() as i64);
|
||||
}
|
||||
|
|
|
@ -390,10 +390,18 @@ impl Window {
|
|||
todo!()
|
||||
}
|
||||
|
||||
pub fn play_index(&self, index: i64) {
|
||||
pub fn playlist_play_index(&self, index: i64) {
|
||||
self.imp()
|
||||
.mpv
|
||||
.command(["playlist-play-index", &index.to_string()])
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
pub fn playlist_remove(&self, index: i64) {
|
||||
self.imp()
|
||||
.mpv
|
||||
.command(["playlist-remove", &index.to_string()])
|
||||
.unwrap();
|
||||
self.playlist_model().remove(index as u32);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue