forked from len0rd/rockbox
Fixed delete of bookmark. Responsiveness of bookmark select dialouge
also improved. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4421 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
c2d1540bbb
commit
48ac52c7d1
1 changed files with 20 additions and 16 deletions
|
@ -635,25 +635,31 @@ static int get_bookmark_count(char* bookmark_file_name)
|
||||||
static char* select_bookmark(char* bookmark_file_name)
|
static char* select_bookmark(char* bookmark_file_name)
|
||||||
{
|
{
|
||||||
int bookmark_id = 0;
|
int bookmark_id = 0;
|
||||||
bool delete_this_bookmark = true;
|
int bookmark_id_prev = -1;
|
||||||
int key = 0;
|
int key = 0;
|
||||||
char* bookmark;
|
char* bookmark = NULL;
|
||||||
int bookmark_count = 0;
|
int bookmark_count = 0;
|
||||||
|
|
||||||
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
lcd_setmargins(0, 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
while (button_get(false)); /* clear button queue */
|
||||||
|
bookmark_count = get_bookmark_count(bookmark_file_name);
|
||||||
|
|
||||||
while(true)
|
while(true)
|
||||||
{
|
{
|
||||||
/* Handles the case where the user wants to go below the 0th bookmark */
|
|
||||||
if(bookmark_id < 0)
|
if(bookmark_id < 0)
|
||||||
|
bookmark_id = bookmark_count -1;
|
||||||
|
if(bookmark_id == bookmark_count)
|
||||||
bookmark_id = 0;
|
bookmark_id = 0;
|
||||||
|
|
||||||
if(delete_this_bookmark)
|
if (bookmark_id != bookmark_id_prev)
|
||||||
{
|
{
|
||||||
bookmark_count = get_bookmark_count(bookmark_file_name);
|
bookmark = get_bookmark(bookmark_file_name, bookmark_id);
|
||||||
delete_this_bookmark = false;
|
bookmark_id_prev = bookmark_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
bookmark = get_bookmark(bookmark_file_name, bookmark_id);
|
|
||||||
|
|
||||||
if (!bookmark)
|
if (!bookmark)
|
||||||
{
|
{
|
||||||
/* if there were no bookmarks in the file, delete the file and exit. */
|
/* if there were no bookmarks in the file, delete the file and exit. */
|
||||||
|
@ -666,6 +672,7 @@ static char* select_bookmark(char* bookmark_file_name)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
bookmark_id_prev = bookmark_id;
|
||||||
bookmark_id--;
|
bookmark_id--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -675,7 +682,6 @@ static char* select_bookmark(char* bookmark_file_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* waiting for the user to click a button */
|
/* waiting for the user to click a button */
|
||||||
while (button_get(false)); /* clear button queue */
|
|
||||||
key = button_get(true);
|
key = button_get(true);
|
||||||
switch(key)
|
switch(key)
|
||||||
{
|
{
|
||||||
|
@ -685,7 +691,11 @@ static char* select_bookmark(char* bookmark_file_name)
|
||||||
|
|
||||||
case BUTTON_ON | BUTTON_PLAY:
|
case BUTTON_ON | BUTTON_PLAY:
|
||||||
/* User wants to delete this bookmark */
|
/* User wants to delete this bookmark */
|
||||||
delete_this_bookmark = true;
|
delete_bookmark(bookmark_file_name, bookmark_id);
|
||||||
|
bookmark_id_prev=-1;
|
||||||
|
bookmark_id--;
|
||||||
|
bookmark_count--;
|
||||||
|
while (button_get(false)); /* clear button queue */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SYS_USB_CONNECTED:
|
case SYS_USB_CONNECTED:
|
||||||
|
@ -719,12 +729,6 @@ static char* select_bookmark(char* bookmark_file_name)
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (delete_this_bookmark)
|
|
||||||
{
|
|
||||||
delete_bookmark(bookmark_file_name, bookmark_id);
|
|
||||||
bookmark_id--;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue