Merge pull request #897 from tpikonen/fix-view-downloaded

Option to not show new episodes on view->Downloaded
This commit is contained in:
Eric Le Lay 2020-11-24 17:27:53 +01:00 committed by GitHub
commit 3eac29f4fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 3 deletions

View File

@ -205,6 +205,10 @@
<attribute name="action">win.viewHideBoringPodcasts</attribute>
<attribute name="label" translatable="yes">Hide podcasts without episodes</attribute>
</item>
<item>
<attribute name="action">win.viewAlwaysShowNewEpisodes</attribute>
<attribute name="label" translatable="yes">Always show New Episodes</attribute>
</item>
</section>
<submenu id="menuViewColumns">
<attribute name="label" translatable="yes">Visible columns</attribute>
@ -212,4 +216,4 @@
</submenu>
</menu>
</interface>
<!-- :noTabs=true:tabSize=2:indentSize=2: -->
<!-- :noTabs=true:tabSize=2:indentSize=2: -->

View File

@ -162,6 +162,7 @@ defaults = {
'descriptions': True,
'view_mode': 1,
'columns': int('110', 2), # bitfield of visible columns
'always_show_new': True,
},
'download_list': {

View File

@ -263,6 +263,11 @@ class gPodder(BuilderWidget, dbus.service.Object):
action.connect('activate', self.on_item_view_hide_boring_podcasts_toggled)
g.add_action(action)
action = Gio.SimpleAction.new_stateful(
'viewAlwaysShowNewEpisodes', None, GLib.Variant.new_boolean(self.config.ui.gtk.episode_list.always_show_new))
action.connect('activate', self.on_item_view_always_show_new_episodes_toggled)
g.add_action(action)
action = Gio.SimpleAction.new_stateful(
'searchAlwaysVisible', None, GLib.Variant.new_boolean(self.config.ui.gtk.search_always_visible))
action.connect('activate', self.on_item_view_search_always_visible_toggled)
@ -1241,7 +1246,8 @@ class gPodder(BuilderWidget, dbus.service.Object):
def _on_config_changed(self, name, old_value, new_value):
if name == 'ui.gtk.toolbar':
self.toolbar.set_property('visible', new_value)
elif name == 'ui.gtk.episode_list.descriptions':
elif name in ('ui.gtk.episode_list.descriptions',
'ui.gtk.episode_list.always_show_new'):
self.update_episode_list_model()
elif name in ('auto.update.enabled', 'auto.update.frequency'):
self.restart_auto_update_timer()
@ -3129,6 +3135,11 @@ class gPodder(BuilderWidget, dbus.service.Object):
action.set_state(GLib.Variant.new_boolean(not state))
self.apply_podcast_list_hide_boring()
def on_item_view_always_show_new_episodes_toggled(self, action, param):
state = action.get_state()
self.config.ui.gtk.episode_list.always_show_new = not state
action.set_state(GLib.Variant.new_boolean(not state))
def on_item_view_search_always_visible_toggled(self, action, param):
state = action.get_state()
self.config.ui.gtk.search_always_visible = not state

View File

@ -390,7 +390,7 @@ class EpisodeListModel(Gtk.ListStore):
elif episode.state == gpodder.STATE_NORMAL and \
episode.is_new:
tooltip.append(_('New episode'))
view_show_downloaded = True
view_show_downloaded = self._config.ui.gtk.episode_list.always_show_new
view_show_unplayed = True
elif episode.state == gpodder.STATE_DOWNLOADED:
tooltip = []