Remove cancelled and failed downloads on exit
Cancelled and failed downloads should have their partial download files removed when gPodder is closed, while all other (non-finished) files should be paused to be resumed in the next session.
This commit is contained in:
parent
a8e53f6076
commit
48ddd44166
|
@ -2176,8 +2176,11 @@ class gPodder(GladeWidget, dbus.service.Object):
|
|||
else:
|
||||
self.show_message(_('Please check your permissions and free disk space.'), _('Error saving podcast list'))
|
||||
|
||||
self.download_status_manager.pause_all_downloads()
|
||||
self.gPodder.hide()
|
||||
|
||||
# Notify all tasks to to carry out any clean-up actions
|
||||
self.download_status_manager.tell_all_tasks_to_quit()
|
||||
|
||||
while gtk.events_pending():
|
||||
gtk.main_iteration(False)
|
||||
|
||||
|
|
|
@ -346,11 +346,17 @@ class DownloadStatusManager(object):
|
|||
def register_task(self, task):
|
||||
util.idle_add(self.__add_new_task, task)
|
||||
|
||||
def pause_all_downloads(self):
|
||||
def tell_all_tasks_to_quit(self):
|
||||
for row in self.__model:
|
||||
task = row[DownloadStatusManager.C_TASK]
|
||||
if task is not None:
|
||||
task.status = task.PAUSED
|
||||
# Pause currently-running (and queued) downloads
|
||||
if task.status in (task.QUEUED, task.DOWNLOADING):
|
||||
task.status = task.PAUSED
|
||||
|
||||
# Delete cancelled and failed downloads
|
||||
if task.status in (task.CANCELLED, task.FAILED):
|
||||
task.removed_from_list()
|
||||
|
||||
def are_downloads_in_progress(self):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue