=== modified file 'apps/bookmark.c' --- apps/bookmark.c 2008-08-15 08:27:39 +0000 +++ apps/bookmark.c 2008-12-29 21:50:38 +0000 @@ -93,7 +93,8 @@ size_t buffer_len); static char* select_bookmark(const char* bookmark_file_name, bool show_dont_resume); static bool system_check(void); -static bool write_bookmark(bool create_bookmark_file, const char *bookmark); +static bool write_bookmark(bool create_bookmark_file, const char *bookmark, + bool is_autocreate); static int get_bookmark_count(const char* bookmark_file_name); static char global_temp_buffer[MAX_PATH+1]; @@ -110,7 +111,7 @@ /* ----------------------------------------------------------------------- */ bool bookmark_create_menu(void) { - write_bookmark(true, create_bookmark()); + write_bookmark(true, create_bookmark(), false); return false; } @@ -176,13 +177,14 @@ switch (global_settings.autocreatebookmark) { case BOOKMARK_YES: - return write_bookmark(true, bookmark); + case BOOKMARK_IFEXISTS: + return write_bookmark(true, bookmark, true); case BOOKMARK_NO: return false; case BOOKMARK_RECENT_ONLY_YES: - return write_bookmark(false, bookmark); + return write_bookmark(false, bookmark, true); } #ifdef HAVE_LCD_BITMAP const char *lines[]={ID2P(LANG_AUTO_BOOKMARK_QUERY)}; @@ -202,9 +204,9 @@ if(gui_syncyesno_run(&message, NULL, NULL)==YESNO_YES) { if (global_settings.autocreatebookmark == BOOKMARK_RECENT_ONLY_ASK) - return write_bookmark(false, bookmark); + return write_bookmark(false, bookmark, true); else - return write_bookmark(true, bookmark); + return write_bookmark(true, bookmark, true); } return false; } @@ -216,15 +218,19 @@ /* resume_index*resume_offset*resume_seed*resume_first_index* */ /* resume_file*milliseconds*MP3 Title* */ /* ------------------------------------------------------------------------*/ -static bool write_bookmark(bool create_bookmark_file, const char *bookmark) +static bool write_bookmark(bool create_bookmark_file, const char *bookmark, + bool is_autocreate) { bool success=false; if (!bookmark) return false; /* something didn't happen correctly, do nothing */ if (global_settings.usemrb) + { success = add_bookmark(RECENT_BOOKMARK_FILE, bookmark, true); - + if (!success) + splash(HZ, ID2P(LANG_BOOKMARK_CREATE_FAILURE)); + } /* writing the bookmark */ if (create_bookmark_file) @@ -233,13 +239,21 @@ sizeof(global_temp_buffer)); if (generate_bookmark_file_name(name)) { + if (is_autocreate + && global_settings.autocreatebookmark == BOOKMARK_IFEXISTS) + { /* Check if bookmark file exists */ + int fd = open(global_bookmark_file_name, O_RDONLY); + if(fd < 0) + /* bookmark file does not exist, do not save. */ + return false; + close(fd); + } success = add_bookmark(global_bookmark_file_name, bookmark, false); } + splash(HZ, success ? ID2P(LANG_BOOKMARK_CREATE_SUCCESS) + : ID2P(LANG_BOOKMARK_CREATE_FAILURE)); } - splash(HZ, success ? ID2P(LANG_BOOKMARK_CREATE_SUCCESS) - : ID2P(LANG_BOOKMARK_CREATE_FAILURE)); - return true; } === modified file 'apps/lang/english.lang' --- apps/lang/english.lang 2008-12-25 11:48:28 +0000 +++ apps/lang/english.lang 2008-12-29 21:51:50 +0000 @@ -12344,4 +12344,18 @@ *: none quickscreen: "Set as Bottom Quickscreen Item" - \ No newline at end of file + + + id: LANG_BOOKMARK_SETTINGS_IFEXISTS + desc: Save if bookmark file already exists + user: + + *: "If bookmark file already exists" + + + *: "If bookmark file already exists" + + + *: "If bookmark file already exists" + + === modified file 'apps/settings.h' --- apps/settings.h 2008-12-25 01:46:16 +0000 +++ apps/settings.h 2008-12-29 21:57:05 +0000 @@ -97,8 +97,9 @@ #define BOOKMARK_YES 1 #define BOOKMARK_ASK 2 #define BOOKMARK_UNIQUE_ONLY 2 -#define BOOKMARK_RECENT_ONLY_YES 3 -#define BOOKMARK_RECENT_ONLY_ASK 4 +#define BOOKMARK_IFEXISTS 3 +#define BOOKMARK_RECENT_ONLY_YES 4 +#define BOOKMARK_RECENT_ONLY_ASK 5 enum { === modified file 'apps/settings_list.c' --- apps/settings_list.c 2008-12-25 01:46:16 +0000 +++ apps/settings_list.c 2008-12-29 21:53:21 +0000 @@ -803,9 +803,10 @@ /* bookmarks */ CHOICE_SETTING(0, autocreatebookmark, LANG_BOOKMARK_SETTINGS_AUTOCREATE, BOOKMARK_NO, "autocreate bookmarks", - "off,on,ask,recent only - on,recent only - ask", NULL, 5, + "off,on,ask,if bmark file exists,recent only - on,recent only - ask", NULL, 6, ID2P(LANG_SET_BOOL_NO), ID2P(LANG_SET_BOOL_YES), - ID2P(LANG_ASK), ID2P(LANG_BOOKMARK_SETTINGS_RECENT_ONLY_YES), + ID2P(LANG_ASK), ID2P(LANG_BOOKMARK_SETTINGS_IFEXISTS), + ID2P(LANG_BOOKMARK_SETTINGS_RECENT_ONLY_YES), ID2P(LANG_BOOKMARK_SETTINGS_RECENT_ONLY_ASK)), CHOICE_SETTING(0, autoloadbookmark, LANG_BOOKMARK_SETTINGS_AUTOLOAD, BOOKMARK_NO, "autoload bookmarks", off_on_ask, NULL, 3,