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




commit 4b1e2398264a4a4d1b94e10adbf87c6958b74c39
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 681e5998..4d30a522 100644
--- a/gnomemusic/grilowrappers/grltrackerwrapper.py
+++ b/gnomemusic/grilowrappers/grltrackerwrapper.py
@@ -107,7 +107,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._notificationmanager = application.props.notificationmanager
@@ -162,7 +162,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)
 
@@ -189,7 +189,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]