add menu items to trigger podcast/episode search

This commit is contained in:
Eric Le Lay 2020-04-05 11:47:20 +02:00
parent a672ce7ba4
commit ff8582d6dd
3 changed files with 27 additions and 3 deletions

View File

@ -207,6 +207,7 @@
<property name="orientation">horizontal</property>
<child>
<object class="GtkEntry" id="entry_search_podcasts">
<property name="hexpand">True</property>
<property name="visible">True</property>
<property name="secondary-icon-stock">gtk-close</property>
<signal name="icon-press" handler="hide_podcast_search"/>
@ -321,6 +322,7 @@
</child>
<child>
<object class="GtkEntry" id="entry_search_episodes">
<property name="hexpand">True</property>
<property name="visible">True</property>
<property name="secondary-icon-stock">gtk-close</property>
<signal name="icon-press" handler="hide_episode_search"/>

View File

@ -37,6 +37,13 @@
<menu id="menubar">
<submenu id="menuPodcasts">
<attribute name="label" translatable="yes">_Podcasts</attribute>
<section>
<item>
<attribute name="action">win.findPodcast</attribute>
<attribute name="label" translatable="yes">Find Podcast</attribute>
<attribute name="accel">&lt;Primary&gt;&lt;Shift&gt;f</attribute>
</item>
</section>
<section>
<item>
<attribute name="action">win.update</attribute>
@ -61,7 +68,7 @@
<item>
<attribute name="action">win.discover</attribute>
<attribute name="label" translatable="yes">Discover new podcasts</attribute>
<attribute name="accel">&lt;Primary&gt;f</attribute>
<attribute name="accel">&lt;Primary&gt;d</attribute>
</item>
<item>
<attribute name="action">win.addChannel</attribute>
@ -131,6 +138,11 @@
</item>
</section>
<section>
<item>
<attribute name="action">win.findEpisode</attribute>
<attribute name="label" translatable="yes">Find Episode</attribute>
<attribute name="accel">&lt;Primary&gt;f</attribute>
</item>
<item>
<attribute name="action">win.toggleShownotes</attribute>
<attribute name="label" translatable="yes">Episode details</attribute>

View File

@ -272,6 +272,8 @@ class gPodder(BuilderWidget, dbus.service.Object):
('toggleEpisodeLock', self.on_item_toggle_lock_activate),
('toggleShownotes', self.on_shownotes_selected_episodes),
('sync', self.on_sync_to_device_activate),
('findPodcast', self.on_find_podcast_activate),
('findEpisode', self.on_find_episode_activate),
]
for name, callback in action_defs:
@ -667,10 +669,14 @@ class gPodder(BuilderWidget, dbus.service.Object):
def show_podcast_search(self, input_char):
self.hbox_search_podcasts.show()
self.entry_search_podcasts.insert_text(input_char, -1)
if input_char:
self.entry_search_podcasts.insert_text(input_char, -1)
self.entry_search_podcasts.grab_focus()
self.entry_search_podcasts.set_position(-1)
def on_find_podcast_activate(self, *args):
self.show_podcast_search(None)
def init_podcast_list_treeview(self):
size = cake_size_from_widget(self.treeChannels) * 2
self.podcast_list_model.set_max_image_size(size)
@ -794,10 +800,14 @@ class gPodder(BuilderWidget, dbus.service.Object):
def show_episode_search(self, input_char):
self.hbox_search_episodes.show()
self.entry_search_episodes.insert_text(input_char, -1)
if input_char:
self.entry_search_episodes.insert_text(input_char, -1)
self.entry_search_episodes.grab_focus()
self.entry_search_episodes.set_position(-1)
def on_find_episode_activate(self, *args):
self.show_episode_search(None)
def set_episode_list_column(self, index, new_value):
mask = (1 << index)
if new_value: