logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

cvs: apps bookmark.c,1.10,1.11: msg#00082

Subject: cvs: apps bookmark.c,1.10,1.11
Update of /cvsroot/rockbox/apps
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29454/apps

Modified Files:
        bookmark.c 
Log Message:
Fixed delete of bookmark. Responsiveness of bookmark select dialouge
also improved.



Index: bookmark.c
===================================================================
RCS file: /cvsroot/rockbox/apps/bookmark.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- bookmark.c  19 Mar 2004 22:15:52 -0000      1.10
+++ bookmark.c  21 Mar 2004 13:35:54 -0000      1.11
@@ -635,24 +635,30 @@
 static char* select_bookmark(char* bookmark_file_name)
 {
     int bookmark_id = 0;
-    bool delete_this_bookmark = true;
+    int bookmark_id_prev = -1;
     int  key = 0;
-    char* bookmark;
+    char* bookmark = NULL;
     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)
     {
-        /* Handles the case where the user wants to go below the 0th bookmark 
*/
         if(bookmark_id < 0)
+            bookmark_id = bookmark_count -1;
+        if(bookmark_id == bookmark_count)
             bookmark_id = 0;
 
-        if(delete_this_bookmark)
+        if (bookmark_id != bookmark_id_prev)
         {
-            bookmark_count = get_bookmark_count(bookmark_file_name);
-            delete_this_bookmark = false;
-        }
-        
         bookmark = get_bookmark(bookmark_file_name, bookmark_id);
+            bookmark_id_prev = bookmark_id;
+        }
 
         if (!bookmark)
         {
@@ -666,6 +672,7 @@
             }
             else
             {
+               bookmark_id_prev = bookmark_id;
                bookmark_id--;
             }
         }
@@ -675,7 +682,6 @@
         }
 
         /* waiting for the user to click a button */
-        while (button_get(false)); /* clear button queue */
         key = button_get(true);
         switch(key)
         {
@@ -685,7 +691,11 @@
 
             case BUTTON_ON | BUTTON_PLAY:
                 /* 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;
 
             case SYS_USB_CONNECTED:
@@ -719,12 +729,6 @@
                 return NULL;
 #endif
         }
-
-        if (delete_this_bookmark)
-        {
-           delete_bookmark(bookmark_file_name, bookmark_id);
-           bookmark_id--;
-        }
     }
 
     return NULL;

_______________________________________________
Rockbox-cvs mailing list
Rockbox-cvs@xxxxxxxxxxxx
http://cool.haxx.se/mailman/listinfo/rockbox-cvs



<Prev in Thread] Current Thread [Next in Thread>