Index: apps/menus/playback_menu.c =================================================================== --- apps/menus/playback_menu.c (revision 29859) +++ apps/menus/playback_menu.c (working copy) @@ -37,9 +37,14 @@ #include "cuesheet.h" #if CONFIG_CODEC == SWCODEC #include "playback.h" +#ifdef HAVE_TAGCACHE +#include "yesno.h" +#include "tagtree.h" +#include "talk.h" +#include "keyboard.h" #endif +#endif - #if (CONFIG_CODEC == SWCODEC) && defined(HAVE_CROSSFADE) static int setcrossfadeonexit_callback(int action,const struct menu_item_ex *this_item) { @@ -56,6 +61,67 @@ #endif /* CONFIG_CODEC == SWCODEC */ /***********************************/ +/* AUTORESUME MENU */ +#ifdef HAVE_TAGCACHE +#if CONFIG_CODEC == SWCODEC + +static int autoresume_callback(int action, const struct menu_item_ex *this_item) +{ + (void)this_item; + + if (action == ACTION_EXIT_MENUITEM /* on exit */ + && global_settings.autoresume_enable + && !tagcache_is_usable()) + { + static const char *lines[] = {ID2P(LANG_TAGCACHE_BUSY), + ID2P(LANG_TAGCACHE_FORCE_UPDATE)}; + static const struct text_message message = {lines, 2}; + + if (gui_syncyesno_run(&message, NULL, NULL) == YESNO_YES) + { + tagcache_rebuild(); + splash(HZ*2, ID2P(LANG_TAGCACHE_FORCE_UPDATE_SPLASH)); + } + } + return action; +} + +static int autoresume_nexttrack_callback(int action, + const struct menu_item_ex *this_item) +{ + (void)this_item; + static int oldval = 0; + switch (action) + { + case ACTION_ENTER_MENUITEM: + oldval = global_settings.autoresume_automatic; + break; + case ACTION_EXIT_MENUITEM: + if (global_settings.autoresume_automatic == AUTORESUME_NEXTTRACK_CUSTOM + && kbd_input ((char*) &global_settings.autoresume_paths, + MAX_PATHNAME+1) < 0) + { + global_settings.autoresume_automatic = oldval; + } + } + return action; +} + +MENUITEM_SETTING(autoresume_enable, &global_settings.autoresume_enable, + autoresume_callback); +MENUITEM_SETTING(autoresume_automatic, &global_settings.autoresume_automatic, + autoresume_nexttrack_callback); + +MAKE_MENU(autoresume_menu, ID2P(LANG_AUTORESUME), + 0, Icon_NOICON, + &autoresume_enable, &autoresume_automatic); + +#endif /* CONFIG_CODEC == SWCODEC */ +#endif /* HAVE_TAGCACHE */ +/* AUTORESUME MENU */ +/***********************************/ + +/***********************************/ /* PLAYBACK MENU */ static int playback_callback(int action,const struct menu_item_ex *this_item); @@ -213,7 +279,10 @@ #if CONFIG_CODEC == SWCODEC &resume_rewind, +#ifdef HAVE_TAGCACHE + &autoresume_menu, #endif +#endif ); static int playback_callback(int action,const struct menu_item_ex *this_item) Index: apps/menus/settings_menu.c =================================================================== --- apps/menus/settings_menu.c (revision 29859) +++ apps/menus/settings_menu.c (working copy) @@ -369,64 +369,6 @@ /***********************************/ /***********************************/ -/* AUTORESUME MENU */ -#ifdef HAVE_TAGCACHE -#if CONFIG_CODEC == SWCODEC - -static int autoresume_callback(int action, const struct menu_item_ex *this_item) -{ - (void)this_item; - - if (action == ACTION_EXIT_MENUITEM /* on exit */ - && global_settings.autoresume_enable - && !tagcache_is_usable()) - { - static const char *lines[] = {ID2P(LANG_TAGCACHE_BUSY), - ID2P(LANG_TAGCACHE_FORCE_UPDATE)}; - static const struct text_message message = {lines, 2}; - - if (gui_syncyesno_run(&message, NULL, NULL) == YESNO_YES) - tagcache_rebuild_with_splash(); - } - return action; -} - -static int autoresume_nexttrack_callback(int action, - const struct menu_item_ex *this_item) -{ - (void)this_item; - static int oldval = 0; - switch (action) - { - case ACTION_ENTER_MENUITEM: - oldval = global_settings.autoresume_automatic; - break; - case ACTION_EXIT_MENUITEM: - if (global_settings.autoresume_automatic == AUTORESUME_NEXTTRACK_CUSTOM - && kbd_input ((char*) &global_settings.autoresume_paths, - MAX_PATHNAME+1) < 0) - { - global_settings.autoresume_automatic = oldval; - } - } - return action; -} - -MENUITEM_SETTING(autoresume_enable, &global_settings.autoresume_enable, - autoresume_callback); -MENUITEM_SETTING(autoresume_automatic, &global_settings.autoresume_automatic, - autoresume_nexttrack_callback); - -MAKE_MENU(autoresume_menu, ID2P(LANG_AUTORESUME), - 0, Icon_NOICON, - &autoresume_enable, &autoresume_automatic); - -#endif /* CONFIG_CODEC == SWCODEC */ -#endif /* HAVE_TAGCACHE */ -/* AUTORESUME MENU */ -/***********************************/ - -/***********************************/ /* VOICE MENU */ static int talk_callback(int action,const struct menu_item_ex *this_item); MENUITEM_SETTING(talk_menu_item, &global_settings.talk_menu, NULL); @@ -497,11 +439,6 @@ #endif &display_menu, &system_menu, &bookmark_settings_menu, -#ifdef HAVE_TAGCACHE -#if CONFIG_CODEC == SWCODEC - &autoresume_menu, -#endif -#endif &browse_langs, &voice_settings_menu, #ifdef HAVE_HOTKEY &hotkey_menu,