summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2014-04-15 09:34:22 +0200
committerThomas Martitz <kugel@rockbox.org>2014-04-15 23:54:28 +0200
commit35b4ba851344dec00d8af7bdac20ed337e100917 (patch)
tree3f618bd6a02730362af5ba00ab398df8a99b292d
parentbebf71a08bb8e8f6022852ce6545cf0de580229d (diff)
downloadrockbox-35b4ba851344dec00d8af7bdac20ed337e100917.tar.gz
rockbox-35b4ba851344dec00d8af7bdac20ed337e100917.zip
root_menu: Remove previous_music_is_wps() and change previous_music via event callback.
Change-Id: I0f3b85a8fe8010a2480ef44a72a90dc7904bc777
-rwxr-xr-xapps/playlist.c5
-rw-r--r--apps/root_menu.c38
-rw-r--r--apps/root_menu.h2
3 files changed, 23 insertions, 22 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index b0f7964178..43aa97790b 100755
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -2599,11 +2599,6 @@ void playlist_start(int start_index, unsigned long elapsed,
2599{ 2599{
2600 struct playlist_info* playlist = &current_playlist; 2600 struct playlist_info* playlist = &current_playlist;
2601 2601
2602 /* Cancel FM radio selection as previous music. For cases where we start
2603 playback without going to the WPS, such as playlist insert.. or
2604 playlist catalog. */
2605 previous_music_is_wps();
2606
2607 playlist->index = start_index; 2602 playlist->index = start_index;
2608 2603
2609 playlist->started = true; 2604 playlist->started = true;
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
89static 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)
94static 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
90static char current_track_path[MAX_PATH]; 104static char current_track_path[MAX_PATH];
91static void rootmenu_track_changed_callback(unsigned short id, void* param) 105static 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
733static int previous_music = GO_TO_WPS;
734
735void previous_music_is_wps(void)
736{
737 previous_music = GO_TO_WPS;
738}
739
740void root_menu(void) 747void 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() */
diff --git a/apps/root_menu.h b/apps/root_menu.h
index 6004a43f34..262b1d9a0c 100644
--- a/apps/root_menu.h
+++ b/apps/root_menu.h
@@ -69,8 +69,6 @@ enum {
69#ifndef PLUGIN 69#ifndef PLUGIN
70extern struct menu_item_ex root_menu_; 70extern struct menu_item_ex root_menu_;
71 71
72extern void previous_music_is_wps(void);
73
74void root_menu_load_from_cfg(void* setting, char *value); 72void root_menu_load_from_cfg(void* setting, char *value);
75char* root_menu_write_to_cfg(void* setting, char*buf, int buf_len); 73char* root_menu_write_to_cfg(void* setting, char*buf, int buf_len);
76void root_menu_set_default(void* setting, void* defaultval); 74void root_menu_set_default(void* setting, void* defaultval);