diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2005-06-24 16:32:30 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2005-06-24 16:32:30 +0000 |
commit | 37d7c472ba35acada8e77db7fba24643ab5c0ceb (patch) | |
tree | 1ac7ae80be87df6d5d19a38f4b468f19a63eda18 | |
parent | 7600708a7a11a525e4c1212c5c081ff0bf4e7e37 (diff) |
Put back the playlist creation options in the main menu
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6854 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/onplay.c | 4 | ||||
-rw-r--r-- | apps/playlist.h | 2 | ||||
-rw-r--r-- | apps/playlist_menu.c | 23 | ||||
-rw-r--r-- | apps/playlist_viewer.c | 4 |
4 files changed, 28 insertions, 5 deletions
diff --git a/apps/onplay.c b/apps/onplay.c index e01dc60f5b..da6d9f3e2f 100644 --- a/apps/onplay.c +++ b/apps/onplay.c @@ -53,8 +53,6 @@ #endif #include "main_menu.h" -#define DEFAULT_PLAYLIST_NAME "/dynamic.m3u" - static int context; static char* selected_file = NULL; static int selected_file_attr = 0; @@ -146,7 +144,7 @@ static bool save_playlist(void) { char filename[MAX_PATH+1]; - strncpy(filename, DEFAULT_PLAYLIST_NAME, sizeof(filename)); + strncpy(filename, DEFAULT_DYNAMIC_PLAYLIST_NAME, sizeof(filename)); if (!kbd_input(filename, sizeof(filename))) { diff --git a/apps/playlist.h b/apps/playlist.h index 279c74f740..b5a6e17426 100644 --- a/apps/playlist.h +++ b/apps/playlist.h @@ -58,6 +58,8 @@ struct playlist_info #define PLAYLIST_ATTR_QUEUED 0x01 #define PLAYLIST_ATTR_INSERTED 0x02 +#define DEFAULT_DYNAMIC_PLAYLIST_NAME "/dynamic.m3u" + struct playlist_track_info { char filename[MAX_PATH]; /* path name of mp3 file */ diff --git a/apps/playlist_menu.c b/apps/playlist_menu.c index 444e0ae3d2..c6ccd5a45a 100644 --- a/apps/playlist_menu.c +++ b/apps/playlist_menu.c @@ -20,13 +20,33 @@ #include <string.h> #include "menu.h" +#include "file.h" #include "keyboard.h" #include "playlist.h" #include "tree.h" #include "settings.h" +#include "playlist_viewer.h" #include "talk.h" #include "lang.h" +/* FIXME: there is a very similar function in onplay.c */ +static bool save_playlist(void) +{ + char filename[MAX_PATH+1]; + + strncpy(filename, DEFAULT_DYNAMIC_PLAYLIST_NAME, sizeof(filename)); + + if (!kbd_input(filename, sizeof(filename))) + { + playlist_save(NULL, filename); + + /* reload in case playlist was saved to cwd */ + reload_directory(); + } + + return false; +} + static bool recurse_directory(void) { static const struct opt_items names[] = { @@ -46,6 +66,9 @@ bool playlist_menu(void) bool result; static const struct menu_item items[] = { + { ID2P(LANG_CREATE_PLAYLIST), create_playlist }, + { ID2P(LANG_VIEW_DYNAMIC_PLAYLIST), playlist_viewer }, + { ID2P(LANG_SAVE_DYNAMIC_PLAYLIST), save_playlist }, { ID2P(LANG_RECURSE_DIRECTORY), recurse_directory }, }; diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c index 2cdfa7f582..d851470392 100644 --- a/apps/playlist_viewer.c +++ b/apps/playlist_viewer.c @@ -78,7 +78,7 @@ #define MAX_PLAYLIST_ENTRIES 200 /* Default playlist name for saving */ -#define DEFAULT_PLAYLIST_NAME "/viewer.m3u" +#define DEFAULT_VIEWER_PLAYLIST_NAME "/viewer.m3u" /* Index of track on display line _pos */ #define INDEX(_pos) (viewer.first_display_index - viewer.first_index + (_pos)) @@ -797,7 +797,7 @@ static bool save_playlist(void) { char filename[MAX_PATH+1]; - strncpy(filename, DEFAULT_PLAYLIST_NAME, sizeof(filename)); + strncpy(filename, DEFAULT_VIEWER_PLAYLIST_NAME, sizeof(filename)); if (!kbd_input(filename, sizeof(filename))) { |