[connections/onboarding-adjustments: 2/6] onboarding-dialog: Replace close button with "No Thanks" button




commit d9969d157b5f337326dfbb13abb6b31e7e44cbb4
Author: Felipe Borges <felipeborges gnome org>
Date:   Tue Aug 10 14:53:03 2021 +0200

    onboarding-dialog: Replace close button with "No Thanks" button
    
    See
    https://gitlab.gnome.org/Teams/Design/app-mockups/-/raw/79fd9dd/connections/connections-onboarding-2.png
    
    Related #59

 src/onboarding-dialog.vala       | 13 +++++++++++--
 src/ui/onboarding-dialog-page.ui |  1 +
 src/ui/onboarding-dialog.ui      | 28 ++++++++++------------------
 3 files changed, 22 insertions(+), 20 deletions(-)
---
diff --git a/src/onboarding-dialog.vala b/src/onboarding-dialog.vala
index b757f0e..bd11ff4 100644
--- a/src/onboarding-dialog.vala
+++ b/src/onboarding-dialog.vala
@@ -33,6 +33,8 @@ namespace Connections {
         private unowned Button go_back_button;
         [GtkChild]
         private unowned Button go_next_button;
+        [GtkChild]
+        private unowned Button close_button;
 
         private GLib.List<unowned OnboardingDialogPage> pages;
 
@@ -82,8 +84,15 @@ namespace Connections {
         [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));
+
+            bool is_first_page = (position == 0);
+            bool is_last_page = (position == (pages.length () - 1));
+
+            go_back_button.visible = !is_first_page;
+            go_next_button.visible = !is_last_page;
+
+            close_button.visible = is_first_page || is_last_page;
+            close_button.label = is_first_page ? _("No Thanks") : _("Close");
         }
     }
 }
diff --git a/src/ui/onboarding-dialog-page.ui b/src/ui/onboarding-dialog-page.ui
index c200e4e..20cbabc 100644
--- a/src/ui/onboarding-dialog-page.ui
+++ b/src/ui/onboarding-dialog-page.ui
@@ -5,6 +5,7 @@
     <property name="orientation">vertical</property>
     <property name="spacing">10</property>
     <property name="expand">True</property>
+    <property name="valign">start</property>
     <signal name="map" handler="load_css"/>
     <style>
       <class name="onboarding-dialog-page"/>
diff --git a/src/ui/onboarding-dialog.ui b/src/ui/onboarding-dialog.ui
index ef73418..24e417b 100644
--- a/src/ui/onboarding-dialog.ui
+++ b/src/ui/onboarding-dialog.ui
@@ -17,24 +17,6 @@
         <property name="border-width">0</property>
         <property name="orientation">vertical</property>
 
-        <child>
-          <object class="GtkButton">
-            <property name="visible">True</property>
-            <property name="halign">end</property>
-            <property name="margin">10</property>
-            <signal name="clicked" handler="gtk_widget_destroy" object="ConnectionsOnboardingDialog"/>
-            <style>
-              <class name="flat"/>
-            </style>
-            <child>
-              <object class="GtkImage">
-                <property name="visible">True</property>
-                <property name="icon-name">window-close-symbolic</property>
-              </object>
-            </child>
-          </object>
-        </child>
-
         <child>
           <object class="GtkBox" id="indicator-spacer">
             <property name="visible">True</property>
@@ -141,6 +123,16 @@
           </object>
         </child>
 
+        <child>
+          <object class="GtkButton" id="close_button">
+            <property name="visible">True</property>
+            <property name="halign">center</property>
+            <property name="label" translatable="yes">No Thanks</property>
+            <property name="margin-bottom">20</property>
+            <signal name="clicked" handler="gtk_widget_destroy" object="ConnectionsOnboardingDialog"/>
+          </object>
+        </child>
+
         <child>
           <object class="HdyCarouselIndicatorDots" id="indicator">
             <property name="visible">True</property>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]