summaryrefslogtreecommitdiff
path: root/apps/playlist_menu.c
diff options
context:
space:
mode:
authorHardeep Sidhu <dyp@pobox.com>2003-07-01 21:05:43 +0000
committerHardeep Sidhu <dyp@pobox.com>2003-07-01 21:05:43 +0000
commit9e4262081b4ab5bad2e2708ea064643cf828685c (patch)
treebd809cc4616a2ed61bdbff217d26a13fd78b6609 /apps/playlist_menu.c
parent928a09e3f464dc62e2863f8d77e766578788ba13 (diff)
Added dynamic playlists. ON+PLAY->Playlist on a track, directory, or playlist from file browser to see available options.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3796 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/playlist_menu.c')
-rw-r--r--apps/playlist_menu.c71
1 files changed, 71 insertions, 0 deletions
diff --git a/apps/playlist_menu.c b/apps/playlist_menu.c
new file mode 100644
index 0000000000..3508240efe
--- /dev/null
+++ b/apps/playlist_menu.c
@@ -0,0 +1,71 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2002 Björn Stenberg
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#include <string.h>
+
+#include "menu.h"
+#include "file.h"
+#include "keyboard.h"
+#include "playlist.h"
+#include "tree.h"
+#include "settings.h"
+
+#include "lang.h"
+
+#define DEFAULT_PLAYLIST_NAME "/dynamic.m3u"
+
+static bool save_playlist(void)
+{
+ char filename[MAX_PATH+1];
+
+ strncpy(filename, DEFAULT_PLAYLIST_NAME, sizeof(filename));
+
+ if (!kbd_input(filename, sizeof(filename)))
+ {
+ playlist_save(filename);
+
+ /* reload in case playlist was saved to cwd */
+ reload_directory();
+ }
+
+ return false;
+}
+
+static bool recurse_directory(void)
+{
+ return (set_bool( str(LANG_RECURSE_DIRECTORY),
+ &global_settings.recursive_dir_insert));
+}
+
+bool playlist_menu(void)
+{
+ int m;
+ bool result;
+
+ struct menu_items items[] = {
+ { str(LANG_CREATE_PLAYLIST), create_playlist },
+ { str(LANG_SAVE_DYNAMIC_PLAYLIST), save_playlist },
+ { str(LANG_RECURSE_DIRECTORY), recurse_directory },
+ };
+
+ m = menu_init( items, sizeof items / sizeof(struct menu_items) );
+ result = menu_run(m);
+ menu_exit(m);
+ return result;
+}