From 373a55761bec6194cbeb3a0e13846d54372e14a4 Mon Sep 17 00:00:00 2001
From: Nico Alt <nicoalt@posteo.org>
Date: Thu, 28 Feb 2019 22:18:09 +0100
Subject: [PATCH] Make GTK logic for onboarding screen work

---
 src/window.py |  15 +++++++
 src/window.ui | 112 ++++++++++++++++++++++++++++++++++++++------------
 2 files changed, 100 insertions(+), 27 deletions(-)

diff --git a/src/window.py b/src/window.py
index 0df4300..5a47da7 100644
--- a/src/window.py
+++ b/src/window.py
@@ -23,6 +23,21 @@ from .gi_composites import GtkTemplate
 class BriarGtkWindow(Gtk.ApplicationWindow):
     __gtype_name__ = 'BriarGtkWindow'
 
+    username_grid = GtkTemplate.Child()
+    username_entry = GtkTemplate.Child()
+
+    password_grid = GtkTemplate.Child()
+    password_entry = GtkTemplate.Child()
+    password_confirm_entry = GtkTemplate.Child()
+
     def __init__(self, **kwargs):
         super().__init__(**kwargs)
         self.init_template()
+
+    def on_username_button_clicked(self, button):
+        self.username_grid.set_visible(False)
+        self.password_grid.set_visible(True)
+        self.username = self.username_entry.get_text()
+
+    def on_password_button_clicked(self, button):
+        self.password = self.password_entry.get_text()
diff --git a/src/window.ui b/src/window.ui
index 61d21f4..f57dfac 100644
--- a/src/window.ui
+++ b/src/window.ui
@@ -21,39 +21,97 @@
         <property name="margin_right">18</property>
         <property name="margin_top">18</property>
         <property name="margin_bottom">18</property>
-        <property name="row_spacing">6</property>
-        <property name="column_spacing">12</property>
         <child>
-          <object class="GtkLabel" id="username-label">
+          <object class="GtkGrid" id="username_grid">
             <property name="visible">True</property>
-            <property name="halign">center</property>
-            <property name="label" translatable="yes">Nickname</property>
+            <property name="can_focus">False</property>
+            <property name="row_spacing">6</property>
+            <property name="column_spacing">12</property>
+            <child>
+              <object class="GtkLabel" id="username-label">
+                <property name="visible">True</property>
+                <property name="halign">center</property>
+                <property name="label" translatable="yes">Nickname</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="username">
+                <property name="visible">True</property>
+                <property name="placeholder_text" translatable="yes">Choose your nickname</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="username-next">
+                <property name="visible">True</property>
+                <property name="halign">center</property>
+                <property name="label" translatable="yes">Next</property>
+                <signal name="clicked" handler="on_username_button_clicked"/>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">2</property>
+              </packing>
+            </child>
           </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">0</property>
-          </packing>
         </child>
         <child>
-          <object class="GtkEntry" id="username">
-            <property name="visible">True</property>
-            <property name="placeholder_text" translatable="yes">Choose your nickname</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkButton" id="username-next">
-            <property name="visible">True</property>
-            <property name="halign">center</property>
-            <property name="label" translatable="yes">Next</property>
+          <object class="GtkGrid" id="password_grid">
+            <property name="visible">False</property>
+            <property name="can_focus">False</property>
+            <property name="row_spacing">6</property>
+            <property name="column_spacing">12</property>
+            <child>
+              <object class="GtkLabel" id="password-label">
+                <property name="visible">True</property>
+                <property name="halign">center</property>
+                <property name="label" translatable="yes">Password</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="password">
+                <property name="visible">True</property>
+                <property name="placeholder_text" translatable="yes">Choose your password</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="password_confirm">
+                <property name="visible">True</property>
+                <property name="placeholder_text" translatable="yes">Confirm your password</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="password-next">
+                <property name="visible">True</property>
+                <property name="halign">center</property>
+                <property name="label" translatable="yes">Next</property>
+                <signal name="clicked" handler="on_password_button_clicked"/>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">3</property>
+              </packing>
+            </child>
           </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">2</property>
-          </packing>
         </child>
       </object>
     </child>
-- 
GitLab