Commits

Damián Nohales committed be3836b

Cancel all downloads on close.

Comments (0)

Files changed (1)

         
         if response == gtk.RESPONSE_YES:
             self.save_playlist("%s/.gsharkdown/playlist.pkl" % os.environ.get("HOME"))
+            self.cancel_all_downloads()
             gtk.main_quit()
 
     def copy_song(self, widget, data=None):
         while(thread.is_alive()):
             pass
     
+    def cancel_all_downloads(self):
+        """
+        Cancel all downloads
+        """
+        iter = self.downloads.get_iter_first()
+        while iter != None:
+            path = self.downloads.get_path(iter)
+            iter = self.downloads.iter_next(iter)
+            self.cancel_download(path)
+
     def on_cancel_download(self, menu, data=None):
         """
         Cancel the download. Have to check how to cancel the thread.