summaryrefslogtreecommitdiff
path: root/apps/tree.c
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2004-07-26 16:06:59 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2004-07-26 16:06:59 +0000
commitade5d7b848bf9c0d46bb14c85528453f969c9429 (patch)
tree197aa919b9a3c2a89f77d12b01cc1c2c23f7e37f /apps/tree.c
parent3d91885718a1fb9d6d55f07f67a9a1942a352c5e (diff)
downloadrockbox-ade5d7b848bf9c0d46bb14c85528453f969c9429.tar.gz
rockbox-ade5d7b848bf9c0d46bb14c85528453f969c9429.zip
First step in revamping the USB event handling, paving the way for the upcoming SYS_POWER_OFF event
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4951 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/tree.c')
-rw-r--r--apps/tree.c30
1 files changed, 12 insertions, 18 deletions
diff --git a/apps/tree.c b/apps/tree.c
index 72a2261024..9ce5a9c5f0 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -56,6 +56,7 @@
56#include "action.h" 56#include "action.h"
57#include "talk.h" 57#include "talk.h"
58#include "filetypes.h" 58#include "filetypes.h"
59#include "misc.h"
59 60
60#ifdef HAVE_LCD_BITMAP 61#ifdef HAVE_LCD_BITMAP
61#include "widgets.h" 62#include "widgets.h"
@@ -599,7 +600,7 @@ static bool ask_resume(bool ask_once)
599#endif 600#endif
600 601
601 if (usb_detect()) { 602 if (usb_detect()) {
602 usb_screen(); 603 default_event_handler(SYS_USB_CONNECTED);
603 return false; 604 return false;
604 } 605 }
605 606
@@ -635,13 +636,8 @@ static bool ask_resume(bool ask_once)
635 case BUTTON_ON | BUTTON_REPEAT: 636 case BUTTON_ON | BUTTON_REPEAT:
636 break; 637 break;
637#endif 638#endif
638
639 case SYS_USB_CONNECTED:
640 usb_screen();
641 stop = true;
642 break;
643
644 default: 639 default:
640 default_event_handler(button);
645 stop = true; 641 stop = true;
646 break; 642 break;
647 } 643 }
@@ -940,6 +936,7 @@ static bool dirbrowse(char *root, int *dirfilter)
940#ifndef SIMULATOR 936#ifndef SIMULATOR
941 if (boot_changed) { 937 if (boot_changed) {
942 bool stop = false; 938 bool stop = false;
939 int button;
943 940
944 lcd_clear_display(); 941 lcd_clear_display();
945 lcd_puts(0,0,str(LANG_BOOT_CHANGED)); 942 lcd_puts(0,0,str(LANG_BOOT_CHANGED));
@@ -950,18 +947,15 @@ static bool dirbrowse(char *root, int *dirfilter)
950 lcd_update(); 947 lcd_update();
951#endif 948#endif
952 while (!stop) { 949 while (!stop) {
953 switch (button_get(true)) { 950 button = button_get(true);
951 switch (button) {
954 case BUTTON_PLAY: 952 case BUTTON_PLAY:
955 rolo_load("/" BOOTFILE); 953 rolo_load("/" BOOTFILE);
956 stop = true; 954 stop = true;
957 break; 955 break;
958 956
959 case SYS_USB_CONNECTED:
960 usb_screen();
961 stop = true;
962 break;
963
964 default: 957 default:
958 default_event_handler(button);
965 stop = true; 959 stop = true;
966 break; 960 break;
967 } 961 }
@@ -1372,11 +1366,6 @@ static bool dirbrowse(char *root, int *dirfilter)
1372#endif 1366#endif
1373 break; 1367 break;
1374 1368
1375 case SYS_USB_CONNECTED:
1376 usb_screen();
1377 reload_root = true;
1378 break;
1379
1380 case BUTTON_NONE: 1369 case BUTTON_NONE:
1381 if (thumbnail_time != -1 && 1370 if (thumbnail_time != -1 &&
1382 TIME_AFTER(current_tick, thumbnail_time)) 1371 TIME_AFTER(current_tick, thumbnail_time))
@@ -1393,6 +1382,11 @@ static bool dirbrowse(char *root, int *dirfilter)
1393 } 1382 }
1394 status_draw(false); 1383 status_draw(false);
1395 break; 1384 break;
1385
1386 default:
1387 if(default_event_handler(button) == SYS_USB_CONNECTED)
1388 reload_root = true;
1389 break;
1396 } 1390 }
1397 1391
1398 if ( button ) 1392 if ( button )