[fractal/clippy-ci: 9/25] Fix mute button of video player in media viewer
- From: Alexandre Franke <afranke src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [fractal/clippy-ci: 9/25] Fix mute button of video player in media viewer
- Date: Fri, 21 Feb 2020 20:11:43 +0000 (UTC)
commit 5702b3912371e9a9c1f9e2ca1b32bb742c23353a
Author: Sonja Heinze <sonjaleaheinze gmail com>
Date: Wed Feb 12 15:37:59 2020 +0100
Fix mute button of video player in media viewer
When switching between videos in the media viewer and the first
video is muted, the next video is also muted. But, before this commit,
the mute button of the next video was in the state of unmute.
This commit fixes that bug.
fractal-gtk/src/widgets/media_viewer.rs | 13 +++++++++++++
1 file changed, 13 insertions(+)
---
diff --git a/fractal-gtk/src/widgets/media_viewer.rs b/fractal-gtk/src/widgets/media_viewer.rs
index 61850e1c..f191ca50 100644
--- a/fractal-gtk/src/widgets/media_viewer.rs
+++ b/fractal-gtk/src/widgets/media_viewer.rs
@@ -2,6 +2,7 @@ use fractal_api::clone;
use fractal_api::r0::AccessToken;
use gdk;
+use fragile::Fragile;
use std::cell::RefCell;
use std::rc::Rc;
@@ -428,6 +429,18 @@ impl Data {
Some("audio-volume-high-symbolic"),
gtk::IconSize::Button.into(),
);
+ /* The followign callback requires `Send` but is handled by the gtk main loop */
+ let button = Fragile::new(mute_button.clone());
+ PlayerExt::get_player(&player).connect_state_changed(move |player, state| match state {
+ gst_player::PlayerState::Playing if player.get_mute() => {
+ let image = gtk::Image::new_from_icon_name(
+ Some("audio-volume-muted-symbolic"),
+ gtk::IconSize::Button.into(),
+ );
+ button.get().set_image(Some(&image));
+ }
+ _ => {}
+ });
let player_weak = Rc::downgrade(&player);
mute_button.connect_clicked(move |button| {
player_weak.upgrade().map(|player| {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]