summaryrefslogtreecommitdiffstats
path: root/apps/menus/playlist_menu.c
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2007-02-11 07:32:58 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2007-02-11 07:32:58 +0000
commite84ff179cb315b4e9da0b4af1f6536a0886f3614 (patch)
tree359390486b2171a8834abbec73defa7776e278ad /apps/menus/playlist_menu.c
parent26d8dce20a619275844d92fbcee04cda9b5dea3a (diff)
downloadrockbox-e84ff179cb315b4e9da0b4af1f6536a0886f3614.tar.gz
rockbox-e84ff179cb315b4e9da0b4af1f6536a0886f3614.zip
Move the playlist menu to the new system
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12268 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/menus/playlist_menu.c')
-rw-r--r--apps/menus/playlist_menu.c53
1 files changed, 52 insertions, 1 deletions
diff --git a/apps/menus/playlist_menu.c b/apps/menus/playlist_menu.c
index b38870e540..78c926fad2 100644
--- a/apps/menus/playlist_menu.c
+++ b/apps/menus/playlist_menu.c
@@ -21,6 +21,7 @@
#include <stdbool.h>
#include <stddef.h>
#include <limits.h>
+#include <string.h>
#include "config.h"
#include "lang.h"
#include "action.h"
@@ -28,5 +29,55 @@
#include "menu.h"
#include "playlist_menu.h"
-MENUITEM_FUNCTION(playlist_menu_item, ID2P(LANG_PLAYLIST_MENU), (menu_function)playlist_menu, NULL);
+#include "menu.h"
+#include "file.h"
+#include "keyboard.h"
+#include "playlist.h"
+#include "tree.h"
+#include "playlist_viewer.h"
+#include "talk.h"
+#include "playlist_catalog.h"
+
+int save_playlist_screen(struct playlist_info* playlist)
+{
+ char temp[MAX_PATH+1];
+ int len;
+
+ playlist_get_name(playlist, temp, sizeof(temp));
+ len = strlen(temp);
+
+ if (len > 4 && !strcasecmp(&temp[len-4], ".m3u"))
+ strcat(temp, "8");
+
+ if (len <= 5 || strcasecmp(&temp[len-5], ".m3u8"))
+ strcpy(temp, DEFAULT_DYNAMIC_PLAYLIST_NAME);
+
+ if (!kbd_input(temp, sizeof(temp)))
+ {
+ playlist_save(playlist, temp);
+
+ /* reload in case playlist was saved to cwd */
+ reload_directory();
+ }
+
+ return 0;
+}
+MENUITEM_FUNCTION(create_playlist_item, ID2P(LANG_CREATE_PLAYLIST),
+ (int(*)(void))create_playlist, NULL);
+MENUITEM_FUNCTION(view_playlist, ID2P(LANG_VIEW_DYNAMIC_PLAYLIST),
+ (int(*)(void))playlist_viewer, NULL);
+MENUITEM_FUNCTION_WPARAM(save_playlist, ID2P(LANG_SAVE_DYNAMIC_PLAYLIST),
+ (int(*)(void*))save_playlist_screen, NULL, NULL);
+MENUITEM_FUNCTION(catalog, ID2P(LANG_CATALOG),
+ (int(*)(void))catalog_view_playlists, NULL);
+MENUITEM_SETTING(recursive_dir_insert, &global_settings.recursive_dir_insert, NULL);
+MENUITEM_SETTING(warn_on_erase, &global_settings.warnon_erase_dynplaylist, NULL);
+
+MAKE_MENU(playlist_menu_item, ID2P(LANG_PLAYLIST_MENU), NULL,
+ &create_playlist_item, &view_playlist, &save_playlist, &catalog,
+ &recursive_dir_insert, &warn_on_erase);
+bool playlist_menu(void)
+{
+ return do_menu(&playlist_menu_item);
+}