summaryrefslogtreecommitdiff
path: root/apps/bookmark.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/bookmark.c')
-rw-r--r--apps/bookmark.c65
1 files changed, 31 insertions, 34 deletions
diff --git a/apps/bookmark.c b/apps/bookmark.c
index d2911af39d..4afba78d14 100644
--- a/apps/bookmark.c
+++ b/apps/bookmark.c
@@ -53,7 +53,6 @@
53#define RECENT_BOOKMARK_FILE ROCKBOX_DIR "/most-recent.bmark" 53#define RECENT_BOOKMARK_FILE ROCKBOX_DIR "/most-recent.bmark"
54 54
55static bool add_bookmark(const char* bookmark_file_name, const char* bookmark); 55static bool add_bookmark(const char* bookmark_file_name, const char* bookmark);
56static bool bookmark_load_menu(void);
57static bool check_bookmark(const char* bookmark); 56static bool check_bookmark(const char* bookmark);
58static char* create_bookmark(void); 57static char* create_bookmark(void);
59static bool delete_bookmark(const char* bookmark_file_name, int bookmark_id); 58static bool delete_bookmark(const char* bookmark_file_name, int bookmark_id);
@@ -87,38 +86,6 @@ static char global_bookmark[MAX_BOOKMARK_SIZE];
87static char global_filename[MAX_PATH]; 86static char global_filename[MAX_PATH];
88 87
89/* ----------------------------------------------------------------------- */ 88/* ----------------------------------------------------------------------- */
90/* Displays the bookmark menu options for the user to decide. This is an */
91/* interface function. */
92/* ----------------------------------------------------------------------- */
93bool bookmark_menu(void)
94{
95 int m;
96 bool result;
97
98 static const struct menu_item items[] = {
99 { ID2P(LANG_BOOKMARK_MENU_CREATE), bookmark_create_menu},
100 { ID2P(LANG_BOOKMARK_MENU_LIST), bookmark_load_menu},
101 { ID2P(LANG_BOOKMARK_MENU_RECENT_BOOKMARKS), bookmark_mrb_load},
102 };
103
104 m=menu_init( items, sizeof items / sizeof(struct menu_item), NULL,
105 NULL, NULL, NULL);
106
107#ifdef HAVE_LCD_CHARCELLS
108 status_set_param(true);
109#endif
110 result = menu_run(m);
111#ifdef HAVE_LCD_CHARCELLS
112 status_set_param(false);
113#endif
114 menu_exit(m);
115
116 settings_save();
117
118 return result;
119}
120
121/* ----------------------------------------------------------------------- */
122/* This is the interface function from the main menu. */ 89/* This is the interface function from the main menu. */
123/* ----------------------------------------------------------------------- */ 90/* ----------------------------------------------------------------------- */
124bool bookmark_create_menu(void) 91bool bookmark_create_menu(void)
@@ -133,7 +100,7 @@ bool bookmark_create_menu(void)
133/* for the user. The user can then select a bookmark to load. */ 100/* for the user. The user can then select a bookmark to load. */
134/* If no file/directory is currently playing, the menu item does not work. */ 101/* If no file/directory is currently playing, the menu item does not work. */
135/* ----------------------------------------------------------------------- */ 102/* ----------------------------------------------------------------------- */
136static bool bookmark_load_menu(void) 103bool bookmark_load_menu(void)
137{ 104{
138 bool success = true; 105 bool success = true;
139 int offset; 106 int offset;
@@ -628,6 +595,8 @@ static char* select_bookmark(const char* bookmark_file_name)
628 int bookmark_count = 0; 595 int bookmark_count = 0;
629 596
630#ifdef HAVE_LCD_BITMAP 597#ifdef HAVE_LCD_BITMAP
598 int x = lcd_getxmargin();
599 int y = lcd_getymargin();
631 lcd_setmargins(0, 0); 600 lcd_setmargins(0, 0);
632#endif 601#endif
633 602
@@ -712,6 +681,9 @@ static char* select_bookmark(const char* bookmark_file_name)
712#ifdef SETTINGS_OK2 681#ifdef SETTINGS_OK2
713 case SETTINGS_OK2: 682 case SETTINGS_OK2:
714#endif 683#endif
684#ifdef HAVE_LCD_BITMAP
685 lcd_setmargins(x, y);
686#endif
715 return NULL; 687 return NULL;
716 688
717 default: 689 default:
@@ -1142,6 +1114,31 @@ static bool generate_bookmark_file_name(const char *in)
1142} 1114}
1143 1115
1144/* ----------------------------------------------------------------------- */ 1116/* ----------------------------------------------------------------------- */
1117/* Returns the bookmark name for the current playlist */
1118/* ----------------------------------------------------------------------- */
1119bool bookmark_exist(void)
1120{
1121 bool exist=false;
1122
1123 if(system_check())
1124 {
1125 char* name = playlist_get_name(NULL, global_temp_buffer,
1126 sizeof(global_temp_buffer));
1127 if (generate_bookmark_file_name(name))
1128 {
1129 int fd=open(global_bookmark_file_name, O_RDONLY);
1130 if (fd >=0)
1131 {
1132 close(fd);
1133 exist=true;
1134 }
1135 }
1136 }
1137
1138 return exist;
1139}
1140
1141/* ----------------------------------------------------------------------- */
1145/* Checks the current state of the system and returns if it is in a */ 1142/* Checks the current state of the system and returns if it is in a */
1146/* bookmarkable state. */ 1143/* bookmarkable state. */
1147/* ----------------------------------------------------------------------- */ 1144/* ----------------------------------------------------------------------- */