More robust lock counting (bug 874)

Thanks to Ville-Pekka Vainio for forwarding this.
This commit is contained in:
Thomas Perl 2010-02-23 15:44:17 +01:00
parent a0abd458c5
commit 04680ba8ac
2 changed files with 12 additions and 1 deletions

View File

@ -2640,7 +2640,7 @@ class gPodder(BuilderWidget, dbus.service.Object):
title = N_('Remove %d episode?', 'Remove %d episodes?', count) % count
message = _('If you remove these episodes, they will be deleted from your computer. If you want to listen to any of these episodes again, you will have to re-download the episodes in question.')
locked_count = sum(int(e.is_locked) for e in episodes if e.is_locked is not None)
locked_count = sum(e.is_locked for e in episodes)
if count == locked_count:
title = _('Episodes are locked')

View File

@ -780,8 +780,19 @@ class PodcastEpisode(PodcastModelObject):
self.state = gpodder.STATE_NORMAL
self.is_played = False
# Initialize the "is_locked" property
self._is_locked = False
self.is_locked = channel.channel_is_locked
def get_is_locked(self):
return self._is_locked
def set_is_locked(self, is_locked):
self._is_locked = bool(is_locked)
is_locked = property(fget=get_is_locked, fset=set_is_locked)
def save(self):
if self.state != gpodder.STATE_DOWNLOADED and self.file_exists():
self.state = gpodder.STATE_DOWNLOADED