diff options
author | Kevin Ferrare <kevin@rockbox.org> | 2005-11-22 22:19:08 +0000 |
---|---|---|
committer | Kevin Ferrare <kevin@rockbox.org> | 2005-11-22 22:19:08 +0000 |
commit | 40cc43a7b686b6225db5c55c496b80c9763d2d5d (patch) | |
tree | 11c4e1345dc9c0d2d8ff33f8803b5f99bc472bc4 /apps/onplay.c | |
parent | f57d0220dd216937a210a18f8ab8394091bb6a08 (diff) |
Commited George Styles's patch which added multi-screen support to the delete menu (gui_yesno)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8045 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/onplay.c')
-rw-r--r-- | apps/onplay.c | 69 |
1 files changed, 25 insertions, 44 deletions
diff --git a/apps/onplay.c b/apps/onplay.c index df4ff15db9..8c22a58b3e 100644 --- a/apps/onplay.c +++ b/apps/onplay.c @@ -48,6 +48,8 @@ #include "bookmark.h" #include "action.h" #include "splash.h" +#include "yesno.h" + #ifdef HAVE_LCD_BITMAP #include "icons.h" #endif @@ -392,52 +394,31 @@ static int remove_dir(char* dirname, int len) /* share code for file and directory deletion, saves space */ static bool delete_handler(bool is_dir) { - bool exit = false; + char *lines[]={ + str(LANG_REALLY_DELETE), + selected_file + }; + char *yes_lines[]={ + str(LANG_DELETED), + selected_file + }; + + struct text_message message={lines, 2}; + struct text_message yes_message={yes_lines, 2}; + if(gui_syncyesno_run(&message, &yes_message, NULL)!=YESNO_YES) + return false; int res; + if (is_dir) + { + char pathname[MAX_PATH]; /* space to go deep */ + strncpy(pathname, selected_file, sizeof pathname); + res = remove_dir(pathname, sizeof(pathname)); + } + else + res = remove(selected_file); - lcd_clear_display(); - lcd_puts(0,0,str(LANG_REALLY_DELETE)); - lcd_puts_scroll(0,1,selected_file); - -#ifdef HAVE_LCD_BITMAP - lcd_puts(0,3,str(LANG_CONFIRM_WITH_PLAY_RECORDER)); - lcd_puts(0,4,str(LANG_CANCEL_WITH_ANY_RECORDER)); -#endif - - lcd_update(); - - while (!exit) { - int btn = button_get(true); - switch (btn) { - case SETTINGS_OK: - if (is_dir) - { - char pathname[MAX_PATH]; /* space to go deep */ - strncpy(pathname, selected_file, sizeof pathname); - res = remove_dir(pathname, sizeof(pathname)); - } - else - { - res = remove(selected_file); - } - - if (!res) { - onplay_result = ONPLAY_RELOAD_DIR; - lcd_clear_display(); - lcd_puts(0,0,str(LANG_DELETED)); - lcd_puts_scroll(0,1,selected_file); - lcd_update(); - sleep(HZ); - exit = true; - } - break; - - default: - /* ignore button releases */ - if (!(btn & BUTTON_REL)) - exit = true; - break; - } + if (!res) { + onplay_result = ONPLAY_RELOAD_DIR; } return false; } |