diff options
author | Thomas Martitz <kugel@rockbox.org> | 2014-04-15 09:34:22 +0200 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2014-04-15 23:54:28 +0200 |
commit | 35b4ba851344dec00d8af7bdac20ed337e100917 (patch) | |
tree | 3f618bd6a02730362af5ba00ab398df8a99b292d /apps/root_menu.c | |
parent | bebf71a08bb8e8f6022852ce6545cf0de580229d (diff) | |
download | rockbox-35b4ba851344dec00d8af7bdac20ed337e100917.tar.gz rockbox-35b4ba851344dec00d8af7bdac20ed337e100917.zip |
root_menu: Remove previous_music_is_wps() and change previous_music via event callback.
Change-Id: I0f3b85a8fe8010a2480ef44a72a90dc7904bc777
Diffstat (limited to 'apps/root_menu.c')
-rw-r--r-- | apps/root_menu.c | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/apps/root_menu.c b/apps/root_menu.c index c94a4443e6..189b2ec35c 100644 --- a/apps/root_menu.c +++ b/apps/root_menu.c | |||
@@ -86,6 +86,20 @@ static int last_screen = GO_TO_ROOT; /* unfortunatly needed so we can resume | |||
86 | or goto current track based on previous | 86 | or goto current track based on previous |
87 | screen */ | 87 | screen */ |
88 | 88 | ||
89 | static int previous_music = GO_TO_WPS; /* Toggles behavior of the return-to | ||
90 | * playback-button depending | ||
91 | * on FM radio */ | ||
92 | |||
93 | #if (CONFIG_TUNER) | ||
94 | static void rootmenu_start_playback_callback(unsigned short id, void *param) | ||
95 | { | ||
96 | (void) id; (void) param; | ||
97 | /* Cancel FM radio selection as previous music. For cases where we start | ||
98 | playback without going to the WPS, such as playlist insert or | ||
99 | playlist catalog. */ | ||
100 | previous_music = GO_TO_WPS; | ||
101 | } | ||
102 | #endif | ||
89 | 103 | ||
90 | static char current_track_path[MAX_PATH]; | 104 | static char current_track_path[MAX_PATH]; |
91 | static void rootmenu_track_changed_callback(unsigned short id, void* param) | 105 | static void rootmenu_track_changed_callback(unsigned short id, void* param) |
@@ -730,13 +744,6 @@ static int load_plugin_screen(char *plug_path) | |||
730 | } | 744 | } |
731 | #endif | 745 | #endif |
732 | 746 | ||
733 | static int previous_music = GO_TO_WPS; | ||
734 | |||
735 | void previous_music_is_wps(void) | ||
736 | { | ||
737 | previous_music = GO_TO_WPS; | ||
738 | } | ||
739 | |||
740 | void root_menu(void) | 747 | void root_menu(void) |
741 | { | 748 | { |
742 | int previous_browser = GO_TO_FILEBROWSER; | 749 | int previous_browser = GO_TO_FILEBROWSER; |
@@ -747,6 +754,9 @@ void root_menu(void) | |||
747 | if (global_settings.start_in_screen == 0) | 754 | if (global_settings.start_in_screen == 0) |
748 | next_screen = (int)global_status.last_screen; | 755 | next_screen = (int)global_status.last_screen; |
749 | else next_screen = global_settings.start_in_screen - 2; | 756 | else next_screen = global_settings.start_in_screen - 2; |
757 | #if CONFIG_TUNER | ||
758 | add_event(PLAYBACK_EVENT_START_PLAYBACK, rootmenu_start_playback_callback); | ||
759 | #endif | ||
750 | add_event(PLAYBACK_EVENT_TRACK_CHANGE, rootmenu_track_changed_callback); | 760 | add_event(PLAYBACK_EVENT_TRACK_CHANGE, rootmenu_track_changed_callback); |
751 | #ifdef HAVE_RTC_ALARM | 761 | #ifdef HAVE_RTC_ALARM |
752 | if ( rtc_check_alarm_started(true) ) | 762 | if ( rtc_check_alarm_started(true) ) |
@@ -829,18 +839,16 @@ void root_menu(void) | |||
829 | break; | 839 | break; |
830 | #endif | 840 | #endif |
831 | default: | 841 | default: |
832 | if (next_screen == GO_TO_FILEBROWSER | ||
833 | #ifdef HAVE_TAGCACHE | 842 | #ifdef HAVE_TAGCACHE |
834 | || next_screen == GO_TO_DBBROWSER | 843 | /* With !HAVE_TAGCACHE previous_browser is always GO_TO_FILEBROWSER */ |
835 | #endif | 844 | if (next_screen == GO_TO_FILEBROWSER || next_screen == GO_TO_DBBROWSER) |
836 | ) | ||
837 | previous_browser = next_screen; | 845 | previous_browser = next_screen; |
838 | if (next_screen == GO_TO_WPS | ||
839 | #if CONFIG_TUNER | ||
840 | || next_screen == GO_TO_FM | ||
841 | #endif | 846 | #endif |
842 | ) | 847 | #if CONFIG_TUNER |
848 | /* With !CONFIG_TUNER previous_music is always GO_TO_WPS */ | ||
849 | if (next_screen == GO_TO_WPS || next_screen == GO_TO_FM) | ||
843 | previous_music = next_screen; | 850 | previous_music = next_screen; |
851 | #endif | ||
844 | next_screen = load_screen(next_screen); | 852 | next_screen = load_screen(next_screen); |
845 | break; | 853 | break; |
846 | } /* switch() */ | 854 | } /* switch() */ |