From ade5d7b848bf9c0d46bb14c85528453f969c9429 Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Mon, 26 Jul 2004 16:06:59 +0000 Subject: 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 --- apps/tree.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) (limited to 'apps/tree.c') 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 @@ #include "action.h" #include "talk.h" #include "filetypes.h" +#include "misc.h" #ifdef HAVE_LCD_BITMAP #include "widgets.h" @@ -599,7 +600,7 @@ static bool ask_resume(bool ask_once) #endif if (usb_detect()) { - usb_screen(); + default_event_handler(SYS_USB_CONNECTED); return false; } @@ -635,13 +636,8 @@ static bool ask_resume(bool ask_once) case BUTTON_ON | BUTTON_REPEAT: break; #endif - - case SYS_USB_CONNECTED: - usb_screen(); - stop = true; - break; - default: + default_event_handler(button); stop = true; break; } @@ -940,6 +936,7 @@ static bool dirbrowse(char *root, int *dirfilter) #ifndef SIMULATOR if (boot_changed) { bool stop = false; + int button; lcd_clear_display(); lcd_puts(0,0,str(LANG_BOOT_CHANGED)); @@ -950,18 +947,15 @@ static bool dirbrowse(char *root, int *dirfilter) lcd_update(); #endif while (!stop) { - switch (button_get(true)) { + button = button_get(true); + switch (button) { case BUTTON_PLAY: rolo_load("/" BOOTFILE); stop = true; break; - case SYS_USB_CONNECTED: - usb_screen(); - stop = true; - break; - default: + default_event_handler(button); stop = true; break; } @@ -1372,11 +1366,6 @@ static bool dirbrowse(char *root, int *dirfilter) #endif break; - case SYS_USB_CONNECTED: - usb_screen(); - reload_root = true; - break; - case BUTTON_NONE: if (thumbnail_time != -1 && TIME_AFTER(current_tick, thumbnail_time)) @@ -1393,6 +1382,11 @@ static bool dirbrowse(char *root, int *dirfilter) } status_draw(false); break; + + default: + if(default_event_handler(button) == SYS_USB_CONNECTED) + reload_root = true; + break; } if ( button ) -- cgit v1.2.3