seekbar also works again
This commit is contained in:
parent
bf8b02de12
commit
f8015fbe10
3 changed files with 21 additions and 15 deletions
|
@ -82,7 +82,7 @@ template $AudreyUiPlaybar: Adw.Bin {
|
|||
upper: bind template.playbin as <$AudreyPlaybin>.duration;
|
||||
};
|
||||
|
||||
change-value => $on_play_position_seek ();
|
||||
change-value => $on_play_position_seek (template);
|
||||
}
|
||||
|
||||
[end]
|
||||
|
@ -105,7 +105,7 @@ template $AudreyUiPlaybar: Adw.Bin {
|
|||
valign: center;
|
||||
sensitive: bind $playbin_active (template.playbin as <$AudreyPlaybin>.state as <$AudreyPlaybinState>) as <bool>;
|
||||
|
||||
clicked => $on_skip_backward_clicked ();
|
||||
clicked => $on_skip_backward_clicked (template);
|
||||
}
|
||||
|
||||
Button {
|
||||
|
@ -113,7 +113,7 @@ template $AudreyUiPlaybar: Adw.Bin {
|
|||
valign: center;
|
||||
sensitive: bind $playbin_active (template.playbin as <$AudreyPlaybin>.state as <$AudreyPlaybinState>) as <bool>;
|
||||
|
||||
clicked => $seek_backward ();
|
||||
clicked => $seek_backward (template);
|
||||
}
|
||||
|
||||
Button {
|
||||
|
@ -129,7 +129,7 @@ template $AudreyUiPlaybar: Adw.Bin {
|
|||
valign: center;
|
||||
sensitive: bind $playbin_active (template.playbin as <$AudreyPlaybin>.state as <$AudreyPlaybinState>) as <bool>;
|
||||
|
||||
clicked => $seek_forward ();
|
||||
clicked => $seek_forward (template);
|
||||
}
|
||||
|
||||
Button {
|
||||
|
@ -137,7 +137,7 @@ template $AudreyUiPlaybar: Adw.Bin {
|
|||
valign: center;
|
||||
sensitive: bind $playbin_active (template.playbin as <$AudreyPlaybin>.state as <$AudreyPlaybinState>) as <bool>;
|
||||
|
||||
clicked => $on_skip_forward_clicked ();
|
||||
clicked => $on_skip_forward_clicked (template);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ template $AudreyUiPlaybar: Adw.Bin {
|
|||
icon-name: bind $mute_button_icon_name (template.playbin as <$AudreyPlaybin>.mute) as <string>;
|
||||
valign: center;
|
||||
|
||||
clicked => $on_mute_toggle ();
|
||||
clicked => $on_mute_toggle (template);
|
||||
}
|
||||
|
||||
Scale {
|
||||
|
|
|
@ -24,6 +24,7 @@ mod ffi {
|
|||
pub fn audrey_playbin_play(self_: *mut AudreyPlaybin);
|
||||
pub fn audrey_playbin_get_volume(self_: *mut AudreyPlaybin) -> std::ffi::c_int;
|
||||
pub fn audrey_playbin_set_volume(self_: *mut AudreyPlaybin, volume: std::ffi::c_int);
|
||||
pub fn audrey_playbin_seek(self_: *mut AudreyPlaybin, position: f64);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,4 +68,10 @@ impl Playbin {
|
|||
|
||||
unsafe { ffi::audrey_playbin_set_volume(self.to_glib_none().0, value) }
|
||||
}
|
||||
|
||||
pub fn seek(&self, position: f64) {
|
||||
use glib::translate::ToGlibPtr;
|
||||
|
||||
unsafe { ffi::audrey_playbin_seek(self.to_glib_none().0, position) }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ mod imp {
|
|||
show_cover_art: Cell<bool>,
|
||||
|
||||
#[property(get = Self::get_volume, set = Self::set_volume)]
|
||||
volume: i32,
|
||||
_volume: i32,
|
||||
}
|
||||
|
||||
#[glib::object_subclass]
|
||||
|
@ -106,17 +106,16 @@ mod imp {
|
|||
#[template_callback]
|
||||
fn on_play_position_seek(
|
||||
&self,
|
||||
_range: >k::Range,
|
||||
_scroll_type: gtk::ScrollType,
|
||||
_value: f64,
|
||||
value: f64,
|
||||
range: >k::Range,
|
||||
) -> bool {
|
||||
/*
|
||||
if (range.adjustment.lower < range.adjustment.upper) {
|
||||
this.playbin.seek ((int64) value);
|
||||
let playbin = self.playbin.borrow();
|
||||
let playbin = playbin.as_ref().unwrap();
|
||||
if range.adjustment().lower() < range.adjustment().upper() {
|
||||
playbin.seek(value);
|
||||
}
|
||||
return false;
|
||||
*/
|
||||
todo!()
|
||||
false
|
||||
}
|
||||
|
||||
#[template_callback]
|
||||
|
|
Loading…
Reference in a new issue