@@ -13,6 +13,7 @@ pub enum InstallationTypePageMsg {
1313 #[ doc( hidden) ]
1414 Navigate ( NavigationAction ) ,
1515 InstallationTypeSelected ( InstallationType ) ,
16+ Next ,
1617}
1718
1819#[ derive( Debug ) ]
@@ -115,6 +116,12 @@ impl SimpleComponent for InstallationTypePage {
115116 set_sensitive: model. can_encrypt,
116117 connect_toggled => |btn| INSTALLATION_STATE . write( ) . encrypt = btn. is_active( ) ,
117118 } ,
119+ gtk:: CheckButton {
120+ set_label: Some ( & gettext( "Enable TPM" ) ) ,
121+ #[ watch]
122+ set_sensitive: INSTALLATION_STATE . read( ) . encrypt && model. can_encrypt,
123+ connect_toggled => |btn| INSTALLATION_STATE . write( ) . tpm = btn. is_active( ) ,
124+ } ,
118125 } ,
119126
120127 gtk:: Box {
@@ -128,8 +135,14 @@ impl SimpleComponent for InstallationTypePage {
128135 connect_clicked => InstallationTypePageMsg :: Navigate ( NavigationAction :: GoTo ( crate :: Page :: Destination ) )
129136 } ,
130137
131- gtk:: Box {
132- set_hexpand: true ,
138+ libhelium:: Button {
139+ set_is_pill: true ,
140+ #[ watch]
141+ set_label: & gettext( "Next" ) ,
142+ add_css_class: "large-button" ,
143+ connect_clicked => InstallationTypePageMsg :: Next ,
144+ #[ watch]
145+ set_sensitive: crate :: INSTALLATION_STATE . read( ) . installation_type. is_some( ) ,
133146 }
134147 }
135148 }
@@ -154,46 +167,40 @@ impl SimpleComponent for InstallationTypePage {
154167 match message {
155168 InstallationTypePageMsg :: InstallationTypeSelected ( InstallationType :: WholeDisk ) => {
156169 INSTALLATION_STATE . write ( ) . installation_type = Some ( InstallationType :: WholeDisk ) ;
157- sender
158- . output ( InstallationTypePageOutput :: Navigate (
159- NavigationAction :: GoTo ( Page :: Confirmation ) ,
160- ) )
161- . unwrap ( ) ;
162170 self . can_encrypt = true ;
171+ INSTALLATION_STATE . write ( ) . encrypt = true ;
163172 }
164173 InstallationTypePageMsg :: InstallationTypeSelected ( InstallationType :: DualBoot ( _) ) => {
165- sender
166- . output ( InstallationTypePageOutput :: Navigate (
167- NavigationAction :: GoTo ( Page :: InstallDual ) ,
168- ) )
169- . unwrap ( ) ;
170174 self . can_encrypt = true ;
175+ INSTALLATION_STATE . write ( ) . encrypt = true ;
171176 }
172177 InstallationTypePageMsg :: InstallationTypeSelected ( InstallationType :: Custom ) => {
173178 INSTALLATION_STATE . write ( ) . installation_type = Some ( InstallationType :: Custom ) ;
174- sender
175- . output ( InstallationTypePageOutput :: Navigate (
176- NavigationAction :: GoTo ( Page :: InstallCustom ) ,
177- ) )
178- . unwrap ( ) ;
179179 self . can_encrypt = false ;
180+ INSTALLATION_STATE . write ( ) . encrypt = false ;
180181 }
181182 InstallationTypePageMsg :: InstallationTypeSelected (
182183 InstallationType :: ChromebookInstall ,
183184 ) => {
184185 INSTALLATION_STATE . write ( ) . installation_type =
185186 Some ( InstallationType :: ChromebookInstall ) ;
186- sender
187- . output ( InstallationTypePageOutput :: Navigate (
188- NavigationAction :: GoTo ( Page :: Confirmation ) ,
189- ) )
190- . unwrap ( ) ;
187+ INSTALLATION_STATE . write ( ) . encrypt = true ;
191188 self . can_encrypt = true ;
192189 }
193190 InstallationTypePageMsg :: Navigate ( action) => sender
194191 . output ( InstallationTypePageOutput :: Navigate ( action) )
195192 . unwrap ( ) ,
196- InstallationTypePageMsg :: Update => { }
193+ InstallationTypePageMsg :: Next => {
194+ sender. input ( InstallationTypePageMsg :: Navigate ( NavigationAction :: GoTo (
195+ match INSTALLATION_STATE . read ( ) . installation_type . unwrap ( ) {
196+ InstallationType :: WholeDisk => Page :: Confirmation ,
197+ InstallationType :: DualBoot ( _) => Page :: InstallDual ,
198+ InstallationType :: ChromebookInstall => Page :: Confirmation ,
199+ InstallationType :: Custom => Page :: InstallCustom ,
200+ } ,
201+ ) ) )
202+ }
203+ InstallationTypePageMsg :: Update => { } ,
197204 }
198205 }
199206}
0 commit comments