Skip to content

Commit

Permalink
Fix some keyboard related stuff while we're here
Browse files Browse the repository at this point in the history
Mark the primary menu as primary, so we get the F10 shortcut for free.
Also remove the Enter key shortcut from the BookCard's FlowBoxChild,
since it's no longer activatable, and instead the button inside it
responds to Return
  • Loading branch information
rdbende committed Aug 12, 2024
1 parent 9fd2229 commit d0f787f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
8 changes: 0 additions & 8 deletions cozy/ui/widgets/book_card.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,8 @@ def _install_event_controllers(self):
long_press_gesture = Gtk.GestureLongPress()
long_press_gesture.connect("pressed", self._on_long_tap)

key_event_controller = Gtk.EventControllerKey()
key_event_controller.connect("key-pressed", self._on_key_press_event)

self.add_controller(hover_controller)
self.add_controller(long_press_gesture)
self.add_controller(key_event_controller)

def set_playing(self, is_playing):
self.play_button.set_playing(is_playing)
Expand Down Expand Up @@ -160,7 +156,3 @@ def _on_long_tap(self, gesture: Gtk.Gesture, *_):
device = gesture.get_device()
if device and device.get_source() == Gdk.InputSource.TOUCHSCREEN:
self.menu_button.emit("activate")

def _on_key_press_event(self, controller, keyval, *_):
if keyval == Gdk.KEY_Return:
self.emit("open-book-overview", self.book)
1 change: 1 addition & 0 deletions data/ui/headerbar.blp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ template $Headerbar: Box {
tooltip-text: _("Options");
menu-model: primary_menu;
icon-name: 'open-menu-symbolic';
primary: true;

accessibility {
label: _("Open the options popover");
Expand Down

0 comments on commit d0f787f

Please sign in to comment.