Commit 70c46f99 authored by Cédric Bellegarde's avatar Cédric Bellegarde

Make progress to pulse on scan

parent fa306184
Pipeline #49949 passed with stage
in 6 minutes and 56 seconds
......@@ -81,6 +81,10 @@ class CollectionScanner(GObject.GObject, TagReader):
uris = App().settings.get_music_uris()
if not uris:
return
App().window.container.progress.pulse(True)
# Register to progressbar
App().window.container.progress.add(self)
# Launch scan in a separate thread
self.__thread = Thread(target=self.__scan, args=(uris, saved))
self.__thread.daemon = True
......@@ -195,8 +199,6 @@ class CollectionScanner(GObject.GObject, TagReader):
self.__history = History()
(files, dirs) = self.__get_objects_for_uris(uris)
# Add a progress bar
App().window.container.progress.add(self)
self.__add_monitor(dirs)
new_tracks = self.__scan_files(files, saved)
......
......@@ -45,6 +45,9 @@ class ProgressBar(Gtk.ProgressBar):
"""
if not self.__callers:
return
if self.__pulse_timeout is not None:
GLib.source_remove(self.__pulse_timeout)
self.__pulse_timeout = None
if caller == self.__callers[0]:
self.show()
self.__fraction = fraction
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment