@@ -38,6 +38,11 @@ const INFO_FIELDS: [*const c_char; 2] = [
38
38
"Developer\0 " . as_ptr ( ) as * const c_char ,
39
39
] ;
40
40
41
+ pub enum PageIndex {
42
+ Settings ( u8 ) ,
43
+ Home ,
44
+ }
45
+
41
46
/// Used to display the home screen of the application, with an optional glyph,
42
47
/// information fields, and settings switches.
43
48
pub struct NbglHomeAndSettings {
@@ -50,7 +55,7 @@ pub struct NbglHomeAndSettings {
50
55
generic_contents : nbgl_genericContents_t ,
51
56
info_list : nbgl_contentInfoList_t ,
52
57
icon : nbgl_icon_details_t ,
53
- start_page : u8 ,
58
+ start_page : PageIndex ,
54
59
}
55
60
56
61
impl SyncNBGL for NbglHomeAndSettings { }
@@ -77,7 +82,7 @@ impl<'a> NbglHomeAndSettings {
77
82
generic_contents : nbgl_genericContents_t:: default ( ) ,
78
83
info_list : nbgl_contentInfoList_t:: default ( ) ,
79
84
icon : nbgl_icon_details_t:: default ( ) ,
80
- start_page : INIT_HOME_PAGE as u8 ,
85
+ start_page : PageIndex :: Home ,
81
86
}
82
87
}
83
88
@@ -129,7 +134,7 @@ impl<'a> NbglHomeAndSettings {
129
134
}
130
135
}
131
136
132
- pub fn set_page ( self , page : u8 ) -> NbglHomeAndSettings {
137
+ pub fn set_page ( self , page : PageIndex ) -> NbglHomeAndSettings {
133
138
NbglHomeAndSettings {
134
139
start_page : page,
135
140
..self
@@ -195,7 +200,10 @@ impl<'a> NbglHomeAndSettings {
195
200
self . app_name . as_ptr ( ) as * const c_char ,
196
201
& self . icon as * const nbgl_icon_details_t ,
197
202
core:: ptr:: null ( ) ,
198
- self . start_page ,
203
+ match self . start_page {
204
+ PageIndex :: Home => INIT_HOME_PAGE as u8 ,
205
+ PageIndex :: Settings ( idx) => idx,
206
+ } ,
199
207
& self . generic_contents as * const nbgl_genericContents_t ,
200
208
& self . info_list as * const nbgl_contentInfoList_t ,
201
209
core:: ptr:: null ( ) ,
@@ -272,7 +280,10 @@ impl<'a> NbglHomeAndSettings {
272
280
self . app_name . as_ptr ( ) as * const c_char ,
273
281
& self . icon as * const nbgl_icon_details_t ,
274
282
core:: ptr:: null ( ) ,
275
- self . start_page ,
283
+ match self . start_page {
284
+ PageIndex :: Home => INIT_HOME_PAGE as u8 ,
285
+ PageIndex :: Settings ( idx) => idx,
286
+ } ,
276
287
& self . generic_contents as * const nbgl_genericContents_t ,
277
288
& self . info_list as * const nbgl_contentInfoList_t ,
278
289
core:: ptr:: null ( ) ,
0 commit comments