Add back shortcut to search the library

This commit is contained in:
coderkun 2020-10-24 14:37:38 +02:00
parent 32d02f2d9b
commit 83082c3265
3 changed files with 18 additions and 0 deletions

View file

@ -22,6 +22,11 @@
<attribute name="label" translatable="yes">Toggle Fullscreen</attribute>
<attribute name="accel">F11</attribute>
</item>
<item>
<attribute name="action">win.search-library</attribute>
<attribute name="label" translatable="yes">Search Library</attribute>
<attribute name="accel">&lt;Primary&gt;f</attribute>
</item>
</section>
<section>
<item>

View file

@ -370,6 +370,10 @@ class LibraryPanel(Gtk.Stack):
self._close_standalone()
def show_search(self):
self.filter_bar.set_search_mode(True)
def set_item_size(self, item_size):
if self._item_size != item_size:
self._item_size = item_size

View file

@ -201,6 +201,10 @@ class Window(Gtk.ApplicationWindow):
self._toggle_fullscreen_action.set_enabled(True)
self._toggle_fullscreen_action.connect('activate', self.on_menu_toggle_fullscreen)
self.add_action(self._toggle_fullscreen_action)
self._search_library_action = Gio.SimpleAction.new("search-library", None)
self._search_library_action.set_enabled(True)
self._search_library_action.connect('activate', self.on_menu_search_library)
self.add_action(self._search_library_action)
# Menu callbacks
@ -230,6 +234,11 @@ class Window(Gtk.ApplicationWindow):
self.unfullscreen()
def on_menu_search_library(self, action, value):
self.panel_stack.set_visible_child(self._library_panel)
self._library_panel.show_search()
# Window callbacks
@Gtk.Template.Callback()