[fractal] Fix mute button of video player in media viewer
- From: Daniel Garcia Moreno <danigm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [fractal] Fix mute button of video player in media viewer
- Date: Thu, 13 Feb 2020 07:30:37 +0000 (UTC)
commit 32ba9e1211e958bc810af161aad4c61b33b9b42f
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]