[connections/onboarding-dialog-button-visibility] onboarding-dialog: Toggle back/next button visibility
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [connections/onboarding-dialog-button-visibility] onboarding-dialog: Toggle back/next button visibility
- Date: Wed, 23 Jun 2021 11:25:48 +0000 (UTC)
commit 89373c9897e404e6898f380b3bae574af4a4870c
Author: Felipe Borges <felipeborges gnome org>
Date: Wed Jun 23 13:24:06 2021 +0200
onboarding-dialog: Toggle back/next button visibility
We shouldn't show a "back" button on the first page of the carousel,
neither show a "next" button on the last page.
See https://gitlab.gnome.org/GNOME/connections/-/issues/39#note_1183302
src/onboarding-dialog.vala | 13 +++++++++++++
src/ui/onboarding-dialog.ui | 1 +
2 files changed, 14 insertions(+)
---
diff --git a/src/onboarding-dialog.vala b/src/onboarding-dialog.vala
index f47997d..b757f0e 100644
--- a/src/onboarding-dialog.vala
+++ b/src/onboarding-dialog.vala
@@ -29,6 +29,10 @@ namespace Connections {
private unowned Carousel paginator;
[GtkChild]
private unowned OnboardingDialogPage homepage;
+ [GtkChild]
+ private unowned Button go_back_button;
+ [GtkChild]
+ private unowned Button go_next_button;
private GLib.List<unowned OnboardingDialogPage> pages;
@@ -49,6 +53,8 @@ namespace Connections {
onboarding_page.description += " <a href=\'help:gnome-connections/connect\'>%s</a>".printf
(learn_more_label);;
}
+
+ on_position_changed ();
}
public OnboardingDialog (Window window) {
@@ -72,5 +78,12 @@ namespace Connections {
paginator.scroll_to (pages.nth_data (index));
}
+
+ [GtkCallback]
+ private void on_position_changed () {
+ var position = (int)paginator.position;
+ go_back_button.visible = (position > 0);
+ go_next_button.visible = (position < (pages.length () - 1));
+ }
}
}
diff --git a/src/ui/onboarding-dialog.ui b/src/ui/onboarding-dialog.ui
index e7da3a5..ef73418 100644
--- a/src/ui/onboarding-dialog.ui
+++ b/src/ui/onboarding-dialog.ui
@@ -51,6 +51,7 @@
<property name="visible">True</property>
<property name="animation-duration">400</property>
<property name="margin-bottom">12</property>
+ <signal name="notify::position" handler="on_position_changed"/>
<child>
<object class="ConnectionsOnboardingDialogPage" id="homepage">
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]