diff options
Diffstat (limited to 'apps/menus/settings_menu.c')
-rw-r--r-- | apps/menus/settings_menu.c | 86 |
1 files changed, 60 insertions, 26 deletions
diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c index ce03e1a646..363792870d 100644 --- a/apps/menus/settings_menu.c +++ b/apps/menus/settings_menu.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include "action.h" | 28 | #include "action.h" |
29 | #include "settings.h" | 29 | #include "settings.h" |
30 | #include "menu.h" | 30 | #include "menu.h" |
31 | #include "keyboard.h" | ||
31 | #include "sound_menu.h" | 32 | #include "sound_menu.h" |
32 | #include "exported_menus.h" | 33 | #include "exported_menus.h" |
33 | #include "tree.h" | 34 | #include "tree.h" |
@@ -368,6 +369,64 @@ MAKE_MENU(bookmark_settings_menu, ID2P(LANG_BOOKMARK_SETTINGS), 0, | |||
368 | /***********************************/ | 369 | /***********************************/ |
369 | 370 | ||
370 | /***********************************/ | 371 | /***********************************/ |
372 | /* AUTORESUME MENU */ | ||
373 | #ifdef HAVE_TAGCACHE | ||
374 | #if CONFIG_CODEC == SWCODEC | ||
375 | |||
376 | static int autoresume_callback(int action, const struct menu_item_ex *this_item) | ||
377 | { | ||
378 | (void)this_item; | ||
379 | |||
380 | if (action == ACTION_EXIT_MENUITEM /* on exit */ | ||
381 | && global_settings.autoresume_enable | ||
382 | && !tagcache_is_usable()) | ||
383 | { | ||
384 | static const char *lines[] = {ID2P(LANG_TAGCACHE_BUSY), | ||
385 | ID2P(LANG_TAGCACHE_FORCE_UPDATE)}; | ||
386 | static const struct text_message message = {lines, 2}; | ||
387 | |||
388 | if (gui_syncyesno_run(&message, NULL, NULL) == YESNO_YES) | ||
389 | tagcache_rebuild_with_splash(); | ||
390 | } | ||
391 | return action; | ||
392 | } | ||
393 | |||
394 | static int autoresume_nexttrack_callback(int action, | ||
395 | const struct menu_item_ex *this_item) | ||
396 | { | ||
397 | (void)this_item; | ||
398 | static int oldval = 0; | ||
399 | switch (action) | ||
400 | { | ||
401 | case ACTION_ENTER_MENUITEM: | ||
402 | oldval = global_settings.autoresume_automatic; | ||
403 | break; | ||
404 | case ACTION_EXIT_MENUITEM: | ||
405 | if (global_settings.autoresume_automatic == AUTORESUME_NEXTTRACK_CUSTOM | ||
406 | && kbd_input ((char*) &global_settings.autoresume_strpat, | ||
407 | MAX_PATHNAME+1) < 0) | ||
408 | { | ||
409 | global_settings.autoresume_automatic = oldval; | ||
410 | } | ||
411 | } | ||
412 | return action; | ||
413 | } | ||
414 | |||
415 | MENUITEM_SETTING(autoresume_enable, &global_settings.autoresume_enable, | ||
416 | autoresume_callback); | ||
417 | MENUITEM_SETTING(autoresume_automatic, &global_settings.autoresume_automatic, | ||
418 | autoresume_nexttrack_callback); | ||
419 | |||
420 | MAKE_MENU(autoresume_menu, ID2P(LANG_AUTORESUME), | ||
421 | 0, Icon_NOICON, | ||
422 | &autoresume_enable, &autoresume_automatic); | ||
423 | |||
424 | #endif /* CONFIG_CODEC == SWCODEC */ | ||
425 | #endif /* HAVE_TAGCACHE */ | ||
426 | /* AUTORESUME MENU */ | ||
427 | /***********************************/ | ||
428 | |||
429 | /***********************************/ | ||
371 | /* VOICE MENU */ | 430 | /* VOICE MENU */ |
372 | static int talk_callback(int action,const struct menu_item_ex *this_item); | 431 | static int talk_callback(int action,const struct menu_item_ex *this_item); |
373 | MENUITEM_SETTING(talk_menu_item, &global_settings.talk_menu, NULL); | 432 | MENUITEM_SETTING(talk_menu_item, &global_settings.talk_menu, NULL); |
@@ -425,31 +484,6 @@ MAKE_MENU(hotkey_menu, ID2P(LANG_HOTKEY), 0, Icon_NOICON, | |||
425 | /***********************************/ | 484 | /***********************************/ |
426 | /* SETTINGS MENU */ | 485 | /* SETTINGS MENU */ |
427 | 486 | ||
428 | #ifdef HAVE_TAGCACHE | ||
429 | #if CONFIG_CODEC == SWCODEC | ||
430 | static int autoresume_callback(int action, const struct menu_item_ex *this_item) | ||
431 | { | ||
432 | (void)this_item; | ||
433 | |||
434 | if (action == ACTION_EXIT_MENUITEM /* on exit */ | ||
435 | && global_settings.autoresume_enable | ||
436 | && !tagcache_is_usable()) | ||
437 | { | ||
438 | static const char *lines[] = {ID2P(LANG_TAGCACHE_BUSY), | ||
439 | ID2P(LANG_TAGCACHE_FORCE_UPDATE)}; | ||
440 | static const struct text_message message = {lines, 2}; | ||
441 | |||
442 | if (gui_syncyesno_run(&message, NULL, NULL) == YESNO_YES) | ||
443 | tagcache_rebuild_with_splash(); | ||
444 | } | ||
445 | return action; | ||
446 | } | ||
447 | |||
448 | MENUITEM_SETTING(autoresume_enable, &global_settings.autoresume_enable, | ||
449 | autoresume_callback); | ||
450 | #endif | ||
451 | #endif | ||
452 | |||
453 | static struct browse_folder_info langs = { LANG_DIR, SHOW_LNG }; | 487 | static struct browse_folder_info langs = { LANG_DIR, SHOW_LNG }; |
454 | 488 | ||
455 | MENUITEM_FUNCTION(browse_langs, MENU_FUNC_USEPARAM, ID2P(LANG_LANGUAGE), | 489 | MENUITEM_FUNCTION(browse_langs, MENU_FUNC_USEPARAM, ID2P(LANG_LANGUAGE), |
@@ -465,7 +499,7 @@ MAKE_MENU(settings_menu_item, ID2P(LANG_GENERAL_SETTINGS), 0, | |||
465 | &bookmark_settings_menu, | 499 | &bookmark_settings_menu, |
466 | #ifdef HAVE_TAGCACHE | 500 | #ifdef HAVE_TAGCACHE |
467 | #if CONFIG_CODEC == SWCODEC | 501 | #if CONFIG_CODEC == SWCODEC |
468 | &autoresume_enable, | 502 | &autoresume_menu, |
469 | #endif | 503 | #endif |
470 | #endif | 504 | #endif |
471 | &browse_langs, &voice_settings_menu, | 505 | &browse_langs, &voice_settings_menu, |