[gnome-music/wip/mschraal/type-checking: 6/7] grltrackerwrapper: Cleanup timeout handling



commit fb2abad4a175d0c08024be0ae4ad7e2c92888310
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 bc78c212..f4e97bfe 100644
--- a/gnomemusic/grilowrappers/grltrackerwrapper.py
+++ b/gnomemusic/grilowrappers/grltrackerwrapper.py
@@ -87,7 +87,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
@@ -139,7 +139,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)
 
@@ -166,7 +166,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]