make sure closing the application aborts the remaining HttpGet objects. Should fix...
[Rockbox.git] / apps / menus / playlist_menu.c
blobd66a71cabacc842ae30b565b1668137589d6b33c
2 /***************************************************************************
3 * __________ __ ___.
4 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
5 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
6 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
7 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
8 * \/ \/ \/ \/ \/
9 * $Id$
11 * Copyright (C) 2007 Jonathan Gordon
13 * All files in this archive are subject to the GNU General Public License.
14 * See the file COPYING in the source tree root for full license agreement.
16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17 * KIND, either express or implied.
19 ****************************************************************************/
21 #include <stdbool.h>
22 #include <stddef.h>
23 #include <limits.h>
24 #include <string.h>
25 #include "config.h"
26 #include "lang.h"
27 #include "action.h"
28 #include "settings.h"
29 #include "menu.h"
30 #include "playlist_menu.h"
32 #include "menu.h"
33 #include "file.h"
34 #include "keyboard.h"
35 #include "playlist.h"
36 #include "tree.h"
37 #include "playlist_viewer.h"
38 #include "talk.h"
39 #include "playlist_catalog.h"
41 int save_playlist_screen(struct playlist_info* playlist)
43 char temp[MAX_PATH+1];
44 int len;
46 playlist_get_name(playlist, temp, sizeof(temp));
47 len = strlen(temp);
49 if (len > 4 && !strcasecmp(&temp[len-4], ".m3u"))
50 strcat(temp, "8");
52 if (len <= 5 || strcasecmp(&temp[len-5], ".m3u8"))
53 strcpy(temp, DEFAULT_DYNAMIC_PLAYLIST_NAME);
55 if (!kbd_input(temp, sizeof(temp)))
57 playlist_save(playlist, temp);
59 /* reload in case playlist was saved to cwd */
60 reload_directory();
63 return 0;
65 MENUITEM_FUNCTION(create_playlist_item, 0, ID2P(LANG_CREATE_PLAYLIST),
66 (int(*)(void))create_playlist, NULL, NULL, Icon_NOICON);
67 MENUITEM_FUNCTION(view_playlist, 0, ID2P(LANG_VIEW_DYNAMIC_PLAYLIST),
68 (int(*)(void))playlist_viewer, NULL, NULL, Icon_NOICON);
69 MENUITEM_FUNCTION(save_playlist, MENU_FUNC_USEPARAM, ID2P(LANG_SAVE_DYNAMIC_PLAYLIST),
70 (int(*)(void*))save_playlist_screen,
71 NULL, NULL, Icon_NOICON);
72 MENUITEM_FUNCTION(catalog, 0, ID2P(LANG_CATALOG),
73 (int(*)(void))catalog_view_playlists,
74 NULL, NULL, Icon_NOICON);
75 MENUITEM_SETTING(recursive_dir_insert, &global_settings.recursive_dir_insert, NULL);
76 MENUITEM_SETTING(warn_on_erase, &global_settings.warnon_erase_dynplaylist, NULL);
78 MAKE_MENU(playlist_settings, ID2P(LANG_PLAYLISTS), NULL,
79 Icon_Playlist,
80 &recursive_dir_insert, &warn_on_erase);
81 MAKE_MENU(playlist_options, ID2P(LANG_PLAYLISTS), NULL,
82 Icon_Playlist,
83 &create_playlist_item, &view_playlist, &save_playlist, &catalog);