PlayerWidget: Group the button connect_clicked methods.

This commit is contained in:
Jordan Petridis
2018-06-23 22:45:16 +00:00
parent 0080399db2
commit a6a34d8246
+17 -11
View File
@@ -198,17 +198,7 @@ impl PlayerWidget {
#[cfg_attr(rustfmt, rustfmt_skip)]
fn init(s: &Rc<Self>, sender: &Sender<Action>) {
// Connect the play button to the gst Player.
s.controls.play.connect_clicked(clone!(s => move |_| s.play()));
// Connect the pause button to the gst Player.
s.controls.pause.connect_clicked(clone!(s => move |_| s.pause()));
// Connect the rewind button to the gst Player.
s.controls.rewind.connect_clicked(clone!(s => move |_| s.rewind()));
// Connect the fast-forward button to the gst Player.
s.controls.forward.connect_clicked(clone!(s => move |_| s.fast_forward()));
Self::connect_buttons(s);
// Log gst warnings.
s.player.connect_warning(move |_, warn| warn!("gst warning: {}", warn));
@@ -235,6 +225,22 @@ impl PlayerWidget {
}));
}
#[cfg_attr(rustfmt, rustfmt_skip)]
/// Connect the `PlayerControls` buttons to the `PlayerExt` methods.
fn connect_buttons(s: &Rc<Self>) {
// Connect the play button to the gst Player.
s.controls.play.connect_clicked(clone!(s => move |_| s.play()));
// Connect the pause button to the gst Player.
s.controls.pause.connect_clicked(clone!(s => move |_| s.pause()));
// Connect the rewind button to the gst Player.
s.controls.rewind.connect_clicked(clone!(s => move |_| s.rewind()));
// Connect the fast-forward button to the gst Player.
s.controls.forward.connect_clicked(clone!(s => move |_| s.fast_forward()));
}
fn reveal(&self) {
self.action_bar.show();
}