diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/root_menu.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/apps/root_menu.c b/apps/root_menu.c index 4f279c94a6..cb84033b6b 100644 --- a/apps/root_menu.c +++ b/apps/root_menu.c | |||
@@ -298,6 +298,19 @@ int item_callback(int action, const struct menu_item_ex *this_item) | |||
298 | } | 298 | } |
299 | return action; | 299 | return action; |
300 | } | 300 | } |
301 | static int get_selection(int last_screen) | ||
302 | { | ||
303 | unsigned int i; | ||
304 | for(i=0; i< sizeof(root_menu__)/sizeof(*root_menu__); i++) | ||
305 | { | ||
306 | if ((root_menu__[i]->flags&MT_RETURN_VALUE) && | ||
307 | (root_menu__[i]->value == last_screen)) | ||
308 | { | ||
309 | return i; | ||
310 | } | ||
311 | } | ||
312 | return 0; | ||
313 | } | ||
301 | 314 | ||
302 | void root_menu(void) | 315 | void root_menu(void) |
303 | { | 316 | { |
@@ -311,24 +324,12 @@ void root_menu(void) | |||
311 | ret_val = (int)global_status.last_screen; | 324 | ret_val = (int)global_status.last_screen; |
312 | else ret_val = global_settings.start_in_screen - 2; | 325 | else ret_val = global_settings.start_in_screen - 2; |
313 | 326 | ||
314 | /* try to select the start item if its not the menu */ | ||
315 | if (ret_val != GO_TO_ROOT) | ||
316 | { | ||
317 | unsigned int i; | ||
318 | for(i=0; i< sizeof(root_menu__)/sizeof(*root_menu__) - 1; i++) | ||
319 | { | ||
320 | if (root_menu__[i]->value == ret_val) | ||
321 | { | ||
322 | selected = i; | ||
323 | break; | ||
324 | } | ||
325 | } | ||
326 | } | ||
327 | while (true) | 327 | while (true) |
328 | { | 328 | { |
329 | switch (ret_val) | 329 | switch (ret_val) |
330 | { | 330 | { |
331 | case GO_TO_ROOT: | 331 | case GO_TO_ROOT: |
332 | selected = get_selection(last_screen); | ||
332 | ret_val = do_menu(&root_menu_, &selected); | 333 | ret_val = do_menu(&root_menu_, &selected); |
333 | /* As long as MENU_ATTACHED_USB == GO_TO_ROOT this works */ | 334 | /* As long as MENU_ATTACHED_USB == GO_TO_ROOT this works */ |
334 | if (ret_val == MENU_ATTACHED_USB) | 335 | if (ret_val == MENU_ATTACHED_USB) |