[gnome-music/wip/jfelder/volume-slider: 2/5] player: Mute property




commit bc831e599b86f1387ca7445cb8093077f1d1b2d4
Author: Jean Felder <jfelder src gnome org>
Date:   Fri Oct 1 15:32:35 2021 +0200

    player: Mute property

 gnomemusic/gstplayer.py | 5 +++++
 gnomemusic/player.py    | 5 +++++
 2 files changed, 10 insertions(+)
---
diff --git a/gnomemusic/gstplayer.py b/gnomemusic/gstplayer.py
index 74d026932..fd384c409 100644
--- a/gnomemusic/gstplayer.py
+++ b/gnomemusic/gstplayer.py
@@ -59,6 +59,8 @@ class GstPlayer(GObject.GObject):
         "stream-start": (GObject.SignalFlags.RUN_FIRST, None, ())
     }
 
+    mute = GObject.Property(
+        type=bool, flags=GObject.ParamFlags.READWRITE, default=False)
     volume = GObject.Property(type=float, flags=GObject.ParamFlags.READWRITE)
 
     def __init__(self, application: Application) -> None:
@@ -104,6 +106,9 @@ class GstPlayer(GObject.GObject):
         self._player.bind_property(
             "volume", self, "volume", GObject.BindingFlags.BIDIRECTIONAL
             | GObject.BindingFlags.SYNC_CREATE)
+        self._player.bind_property(
+            "mute", self, "mute", GObject.BindingFlags.BIDIRECTIONAL
+            | GObject.BindingFlags.SYNC_CREATE)
 
         self._state = Playback.STOPPED
 
diff --git a/gnomemusic/player.py b/gnomemusic/player.py
index a0cf58d22..277aafa2a 100644
--- a/gnomemusic/player.py
+++ b/gnomemusic/player.py
@@ -364,6 +364,7 @@ class Player(GObject.GObject):
 
     state = GObject.Property(type=int, default=Playback.STOPPED)
     duration = GObject.Property(type=float, default=-1.)
+    mute = GObject.Property(type=bool, default=False)
     volume = GObject.Property(type=float, default=1.)
 
     def __init__(self, application):
@@ -414,6 +415,10 @@ class Player(GObject.GObject):
             "volume", self, "volume",
             GObject.BindingFlags.BIDIRECTIONAL
             | GObject.BindingFlags.SYNC_CREATE)
+        self._gst_player.bind_property(
+            "mute", self, "mute",
+            GObject.BindingFlags.BIDIRECTIONAL
+            | GObject.BindingFlags.SYNC_CREATE)
 
     @GObject.Property(
         type=bool, default=False, flags=GObject.ParamFlags.READABLE)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]