[gnome-music/wip/mschraal/type-checking: 3/4] grltrackerwrapper: Cleanup timeout handling



commit 97f8db72316994016a7c05bce33ff70232b358aa
Author: Marinus Schraal <mschraal gnome org>
Date:   Thu May 28 20:45:24 2020 +0200

    grltrackerwrapper: Cleanup timeout handling
    
    Use int exclusively: 0 is equal to no timeout.
    Explicitly return GLib.SOURCE_REMOVE.

 gnomemusic/grilowrappers/grltrackerwrapper.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/gnomemusic/grilowrappers/grltrackerwrapper.py b/gnomemusic/grilowrappers/grltrackerwrapper.py
index 2e704b00..70c69a30 100644
--- a/gnomemusic/grilowrappers/grltrackerwrapper.py
+++ b/gnomemusic/grilowrappers/grltrackerwrapper.py
@@ -88,7 +88,7 @@ class GrlTrackerWrapper(GObject.GObject):
         self._album_search_model = coremodel.props.albums_search
         self._artist_search_model = coremodel.props.artists_search
         self._batch_changed_media_ids = {}
-        self._content_changed_timeout = None
+        self._content_changed_timeout = 0
         self._tracker_playlists = None
         self._tracker_wrapper = tracker_wrapper
         self._window = application.props.window
@@ -140,7 +140,7 @@ class GrlTrackerWrapper(GObject.GObject):
         [self._batch_changed_media_ids[change_type].append(media.get_id())
          for media in medias if media.is_audio() or media.is_container()]
 
-        if self._content_changed_timeout is None:
+        if self._content_changed_timeout == 0:
             self._content_changed_timeout = GLib.timeout_add(
                 250, self._on_content_changed)
 
@@ -167,7 +167,9 @@ class GrlTrackerWrapper(GObject.GObject):
             self._tracker_playlists.check_smart_playlist_change()
 
         self._batch_changed_media_ids = {}
-        self._content_changed_timeout = None
+        self._content_changed_timeout = 0
+
+        return GLib.SOURCE_REMOVE
 
     def _check_album_change(self):
         album_ids = {}


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