[gnome-tour/gnome-40] Fix keyboard navigation
- From: Bilal Elmoussaoui <bilelmoussaoui src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-tour/gnome-40] Fix keyboard navigation
- Date: Wed, 23 Feb 2022 09:27:03 +0000 (UTC)
commit 3a72c4b750fa4d5265f08ce0640b281251e04737
Author: Bilal Elmoussaoui <belmouss redhat com>
Date: Wed Feb 23 10:16:14 2022 +0100
Fix keyboard navigation
.gitignore | 3 ++-
build-aux/cargo.sh | 3 ++-
build-aux/org.gnome.TourDevel.json | 1 -
src/widgets/paginator.rs | 9 ++++++++-
src/widgets/window.rs | 1 +
5 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 5f30514..4521a7a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,4 +7,5 @@ src/config.rs
src/static_resources.rs
*.ui.in~
*.ui~
-
+.flatpak
+.vscode
diff --git a/build-aux/cargo.sh b/build-aux/cargo.sh
index ede82cd..870eba6 100644
--- a/build-aux/cargo.sh
+++ b/build-aux/cargo.sh
@@ -3,7 +3,8 @@
export MESON_BUILD_ROOT="$1"
export MESON_SOURCE_ROOT="$2"
export CARGO_TARGET_DIR="$MESON_BUILD_ROOT"/target
-export CARGO_HOME="$CARGO_TARGET_DIR"/cargo-home
+export CARGO_HOME="$MESON_BUILD_ROOT"/cargo-home
+
FEATURES="$6"
if [ $4 = "Devel" ]
diff --git a/build-aux/org.gnome.TourDevel.json b/build-aux/org.gnome.TourDevel.json
index 7ae3d0d..bce5cc4 100644
--- a/build-aux/org.gnome.TourDevel.json
+++ b/build-aux/org.gnome.TourDevel.json
@@ -22,7 +22,6 @@
"--share=network"
],
"env" : {
- "CARGO_HOME" : "/run/build/gnome-tour/cargo",
"RUST_BACKTRACE" : "1",
"GTK_DEBUG" : "interactive"
}
diff --git a/src/widgets/paginator.rs b/src/widgets/paginator.rs
index d489c82..4766e74 100644
--- a/src/widgets/paginator.rs
+++ b/src/widgets/paginator.rs
@@ -14,7 +14,7 @@ pub struct PaginatorWidget {
pages: RefCell<Vec<gtk::Widget>>,
current_page: RefCell<u32>,
next_btn: gtk::Button,
- start_btn: gtk::Button,
+ pub start_btn: gtk::Button,
finish_btn: gtk::Button,
close_btn: gtk::Button,
previous_btn: gtk::Button,
@@ -177,6 +177,13 @@ impl PaginatorWidget {
let pages = &self.pages.borrow();
let page = pages.get(page_nr as usize).unwrap();
self.carousel.scroll_to(page);
+ if page_nr == self.carousel.get_n_pages() - 1 {
+ self.finish_btn.grab_focus();
+ } else if page_nr >= 1 {
+ self.next_btn.grab_focus();
+ } else {
+ self.start_btn.grab_focus();
+ }
}
}
}
diff --git a/src/widgets/window.rs b/src/widgets/window.rs
index ded2017..3dcfb2f 100644
--- a/src/widgets/window.rs
+++ b/src/widgets/window.rs
@@ -112,5 +112,6 @@ impl Window {
.add_page(last_page.widget.upcast::<gtk::Widget>());
self.widget.add(&self.paginator.borrow().widget);
+ self.paginator.borrow().start_btn.grab_focus();
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]