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




commit ecf373187682d0dca1455c463ce5533114b99471
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 9d5915218..870fbfd46 100644
--- a/gnomemusic/gstplayer.py
+++ b/gnomemusic/gstplayer.py
@@ -263,7 +263,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
 
@@ -284,7 +286,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]