[gnome-tour/bilelmoussaoui/fixes] a18y: add handy keyboard shortcuts
- From: Bilal Elmoussaoui <bilelmoussaoui src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-tour/bilelmoussaoui/fixes] a18y: add handy keyboard shortcuts
- Date: Wed, 26 Jan 2022 19:10:40 +0000 (UTC)
commit a71053e447a1428b0f67688152e8588de7b5baff
Author: Bilal Elmoussaoui <belmouss redhat com>
Date: Wed Jan 26 20:04:36 2022 +0100
a18y: add handy keyboard shortcuts
src/application.rs | 1 +
src/widgets/paginator.rs | 14 ++++++++++++++
2 files changed, 15 insertions(+)
---
diff --git a/src/application.rs b/src/application.rs
index 90f2ba1..931d865 100644
--- a/src/application.rs
+++ b/src/application.rs
@@ -86,6 +86,7 @@ mod imp {
}),
);
application.set_accels_for_action("app.quit", &["<Control>q"]);
+ application.set_accels_for_action("app.skip-tour", &["Escape"]);
self.parent_startup(application);
}
}
diff --git a/src/widgets/paginator.rs b/src/widgets/paginator.rs
index 7946658..5b86bc2 100644
--- a/src/widgets/paginator.rs
+++ b/src/widgets/paginator.rs
@@ -1,5 +1,6 @@
use gtk::prelude::*;
use gtk::{
+ gdk,
glib::{self, clone},
subclass::prelude::*,
};
@@ -68,6 +69,19 @@ mod imp {
.connect_position_notify(clone!(@weak obj => move |_| {
obj.update_position();
}));
+
+ let controller = gtk::EventControllerKey::new();
+ controller.connect_key_pressed(clone!(@weak obj => @default-return gtk::Inhibit(true), move
|_controller, keyval, _keycode, _state| {
+ if keyval == gdk::Key::Right {
+ obj.try_next();
+ } else if keyval == gdk::Key::Left {
+ obj.try_previous();
+ }
+ gtk::Inhibit(false)
+ }));
+
+ obj.add_controller(&controller);
+
self.parent_constructed(obj);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]