[gnome-music/wip/jfelder/async-duration: 24/26] gstplayer: Only update duration property on changes




commit dc89a02e5a1966a26d2a81c76732145f77341735
Author: Jean Felder <jfelder src gnome org>
Date:   Mon Apr 12 20:09:15 2021 +0200

    gstplayer: Only update duration property on changes

 gnomemusic/gstplayer.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/gnomemusic/gstplayer.py b/gnomemusic/gstplayer.py
index aaff3ed4c..a4b72cc1a 100644
--- a/gnomemusic/gstplayer.py
+++ b/gnomemusic/gstplayer.py
@@ -289,7 +289,9 @@ class GstPlayer(GObject.GObject):
 
         return position
 
-    @GObject.Property(type=float)
+    @GObject.Property(
+        type=float, flags=GObject.ParamFlags.READWRITE
+        | GObject.ParamFlags.EXPLICIT_NOTIFY)
     def duration(self):
         """Total duration of current media
 
@@ -310,7 +312,9 @@ class GstPlayer(GObject.GObject):
 
         For internal use only.
         """
-        self._duration = duration
+        if duration != self._duration:
+            self._duration = duration
+            self.notify("duration")
 
     def seek(self, seconds):
         """Seek to position


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