summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/bookmark.c34
1 files changed, 29 insertions, 5 deletions
diff --git a/apps/bookmark.c b/apps/bookmark.c
index 9e093c0d1f..5ecd10e6ce 100644
--- a/apps/bookmark.c
+++ b/apps/bookmark.c
@@ -45,6 +45,7 @@
45#include "kernel.h" 45#include "kernel.h"
46#include "sprintf.h" 46#include "sprintf.h"
47 47
48#define MAX_BOOKMARKS 10
48#define MAX_BOOKMARK_SIZE 350 49#define MAX_BOOKMARK_SIZE 350
49#define RECENT_BOOKMARK_FILE ROCKBOX_DIR "/most-recent.bmark" 50#define RECENT_BOOKMARK_FILE ROCKBOX_DIR "/most-recent.bmark"
50 51
@@ -255,6 +256,17 @@ bool bookmark_autobookmark(void)
255 key = button_get(true); 256 key = button_get(true);
256 switch (key) 257 switch (key)
257 { 258 {
259 case BUTTON_DOWN | BUTTON_REL:
260 case BUTTON_ON | BUTTON_REL:
261#ifdef HAVE_RECORDER_KEYPAD
262 case BUTTON_OFF | BUTTON_REL:
263 case BUTTON_RIGHT | BUTTON_REL:
264 case BUTTON_UP | BUTTON_REL:
265#endif
266 case BUTTON_LEFT | BUTTON_REL:
267 done = true;
268 break;
269
258 case BUTTON_PLAY | BUTTON_REL: 270 case BUTTON_PLAY | BUTTON_REL:
259 if (global_settings.autocreatebookmark == 271 if (global_settings.autocreatebookmark ==
260 BOOKMARK_RECENT_ONLY_ASK) 272 BOOKMARK_RECENT_ONLY_ASK)
@@ -270,11 +282,6 @@ bool bookmark_autobookmark(void)
270 status_set_param(true); 282 status_set_param(true);
271#endif 283#endif
272 return false; 284 return false;
273
274 default:
275 if (key & BUTTON_REL)
276 done = true;
277 break;
278 } 285 }
279 } 286 }
280 return true; 287 return true;
@@ -357,6 +364,7 @@ static bool add_bookmark(char* bookmark_file_name, char* bookmark)
357 /* Writing the new bookmark to the begining of the temp file */ 364 /* Writing the new bookmark to the begining of the temp file */
358 write(temp_bookmark_file, bookmark, strlen(bookmark)); 365 write(temp_bookmark_file, bookmark, strlen(bookmark));
359 write(temp_bookmark_file, "\n", 1); 366 write(temp_bookmark_file, "\n", 1);
367 bookmark_count++;
360 368
361 /* Reading in the previous bookmarks and writing them to the temp file */ 369 /* Reading in the previous bookmarks and writing them to the temp file */
362 bookmark_file = open(bookmark_file_name, O_RDONLY); 370 bookmark_file = open(bookmark_file_name, O_RDONLY);
@@ -365,6 +373,14 @@ static bool add_bookmark(char* bookmark_file_name, char* bookmark)
365 while (read_line(bookmark_file, global_read_buffer, 373 while (read_line(bookmark_file, global_read_buffer,
366 sizeof(global_read_buffer))) 374 sizeof(global_read_buffer)))
367 { 375 {
376 /* The MRB has a max of MAX_BOOKMARKS in it */
377 /* This keeps it from getting too large */
378 if ((strcmp(bookmark_file_name,RECENT_BOOKMARK_FILE)==0))
379 {
380 if(bookmark_count >= MAX_BOOKMARKS)
381 break;
382 }
383
368 if (unique) 384 if (unique)
369 { 385 {
370 cp=strchr(global_read_buffer,'/'); 386 cp=strchr(global_read_buffer,'/');
@@ -737,6 +753,14 @@ static bool delete_bookmark(char* bookmark_file_name, int bookmark_id)
737 while (read_line(bookmark_file, global_read_buffer, 753 while (read_line(bookmark_file, global_read_buffer,
738 sizeof(global_read_buffer))) 754 sizeof(global_read_buffer)))
739 { 755 {
756 /* The MRB has a max of MAX_BOOKMARKS in it */
757 /* This keeps it from getting too large */
758 if ((strcmp(bookmark_file_name,RECENT_BOOKMARK_FILE)==0))
759 {
760 if(bookmark_count >= MAX_BOOKMARKS)
761 break;
762 }
763
740 if (check_bookmark(global_read_buffer)) 764 if (check_bookmark(global_read_buffer))
741 { 765 {
742 if (bookmark_id != bookmark_count) 766 if (bookmark_id != bookmark_count)