summaryrefslogtreecommitdiffstats
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-35b4ba8.tar.gz
rockbox-35b4ba8.tar.bz2
rockbox-35b4ba8.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,
{
struct playlist_info* playlist = &current_playlist;
- /* Cancel FM radio selection as previous music. For cases where we start
- playback without going to the WPS, such as playlist insert.. or
- playlist catalog. */
- previous_music_is_wps();
-
playlist->index = start_index;
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
or goto current track based on previous
screen */
+static int previous_music = GO_TO_WPS; /* Toggles behavior of the return-to
+ * playback-button depending
+ * on FM radio */
+
+#if (CONFIG_TUNER)
+static void rootmenu_start_playback_callback(unsigned short id, void *param)
+{
+ (void) id; (void) param;
+ /* Cancel FM radio selection as previous music. For cases where we start
+ playback without going to the WPS, such as playlist insert or
+ playlist catalog. */
+ previous_music = GO_TO_WPS;
+}
+#endif
static char current_track_path[MAX_PATH];
static void rootmenu_track_changed_callback(unsigned short id, void* param)
@@ -730,13 +744,6 @@ static int load_plugin_screen(char *plug_path)
}
#endif
-static int previous_music = GO_TO_WPS;
-
-void previous_music_is_wps(void)
-{
- previous_music = GO_TO_WPS;
-}
-
void root_menu(void)
{
int previous_browser = GO_TO_FILEBROWSER;
@@ -747,6 +754,9 @@ void root_menu(void)
if (global_settings.start_in_screen == 0)
next_screen = (int)global_status.last_screen;
else next_screen = global_settings.start_in_screen - 2;
+#if CONFIG_TUNER
+ add_event(PLAYBACK_EVENT_START_PLAYBACK, rootmenu_start_playback_callback);
+#endif
add_event(PLAYBACK_EVENT_TRACK_CHANGE, rootmenu_track_changed_callback);
#ifdef HAVE_RTC_ALARM
if ( rtc_check_alarm_started(true) )
@@ -829,18 +839,16 @@ void root_menu(void)
break;
#endif
default:
- if (next_screen == GO_TO_FILEBROWSER
#ifdef HAVE_TAGCACHE
- || next_screen == GO_TO_DBBROWSER
-#endif
- )
+/* With !HAVE_TAGCACHE previous_browser is always GO_TO_FILEBROWSER */
+ if (next_screen == GO_TO_FILEBROWSER || next_screen == GO_TO_DBBROWSER)
previous_browser = next_screen;
- if (next_screen == GO_TO_WPS
-#if CONFIG_TUNER
- || next_screen == GO_TO_FM
#endif
- )
+#if CONFIG_TUNER
+/* With !CONFIG_TUNER previous_music is always GO_TO_WPS */
+ if (next_screen == GO_TO_WPS || next_screen == GO_TO_FM)
previous_music = next_screen;
+#endif
next_screen = load_screen(next_screen);
break;
} /* 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 {
#ifndef PLUGIN
extern struct menu_item_ex root_menu_;
-extern void previous_music_is_wps(void);
-
void root_menu_load_from_cfg(void* setting, char *value);
char* root_menu_write_to_cfg(void* setting, char*buf, int buf_len);
void root_menu_set_default(void* setting, void* defaultval);