Index: apps/main_menu.c
===================================================================
--- apps/main_menu.c	(revision 12225)
+++ apps/main_menu.c	(working copy)
@@ -281,11 +281,6 @@
     return false;
 }
 
-static bool plugin_browse(void)
-{
-    return rockbox_browse(PLUGIN_DIR, SHOW_PLUGINS);
-}
-
 static bool custom_theme_browse(void)
 {
     return rockbox_browse(THEME_DIR, SHOW_CFG);
@@ -390,9 +385,6 @@
     if(inside_menu) return false;
     inside_menu = true;
 
-    items[i].desc = ID2P(LANG_BOOKMARK_MENU_RECENT_BOOKMARKS);
-    items[i++].function = bookmark_mrb_load;
-
     items[i].desc = ID2P(LANG_SOUND_SETTINGS);
     items[i++].function = sound_menu;
 
@@ -405,24 +397,9 @@
     items[i].desc = ID2P(LANG_CUSTOM_THEME);
     items[i++].function = custom_theme_browse;
 
-#ifdef CONFIG_TUNER
-    if(radio_hardware_present()) {
-        items[i].desc = ID2P(LANG_FM_RADIO);
-        items[i++].function = radio_screen;
-    }
-#endif
-
-#ifdef HAVE_RECORDING
-    items[i].desc = ID2P(LANG_RECORDING);
-    items[i++].function = rec_menu;
-#endif
-
     items[i].desc = ID2P(LANG_PLAYLIST_MENU);
     items[i++].function = playlist_menu;
 
-    items[i].desc = ID2P(LANG_PLUGINS);
-    items[i++].function = plugin_browse;
-
     items[i].desc = ID2P(LANG_INFO);
     items[i++].function = info_menu;
 
Index: apps/recorder/radio.c
===================================================================
--- apps/recorder/radio.c	(revision 12225)
+++ apps/recorder/radio.c	(working copy)
@@ -60,6 +60,7 @@
 #include "tree.h"
 #include "dir.h"
 #include "action.h"
+#include "root_menu.h"
 
 #ifdef CONFIG_TUNER
 
@@ -357,11 +358,12 @@
 }
 
 
-bool radio_screen(void)
+int radio_screen(void)
 {
     char buf[MAX_PATH];
     bool done = false;
     int button, lastbutton = BUTTON_NONE;
+    int ret_val = GO_TO_ROOT;
 #ifdef FM_RECORD_DBLPRE
     unsigned long rec_lastclick = 0;
 #endif
@@ -574,7 +576,7 @@
 #endif
                 keep_playing = true;
                 done = true;
-                
+                ret_val = GO_TO_ROOT;
                 if(presets_changed)
                 {
                     if(yesno_pop(str(LANG_FM_SAVE_CHANGES)))
@@ -588,7 +590,7 @@
                 
                 /* Clear the preset list on exit. */
                 clear_preset_list();
-                    
+                
                 break;
 
             case ACTION_STD_PREV:
Index: apps/recorder/radio.h
===================================================================
--- apps/recorder/radio.h	(revision 12225)
+++ apps/recorder/radio.h	(working copy)
@@ -26,7 +26,7 @@
 #ifdef CONFIG_TUNER
 void radio_load_presets(char *filename);
 void radio_init(void);
-bool radio_screen(void);
+int radio_screen(void);
 void radio_start(void);
 void radio_pause(void);
 void radio_stop(void);
Index: apps/tree.c
===================================================================
--- apps/tree.c	(revision 12225)
+++ apps/tree.c	(working copy)
@@ -79,6 +79,7 @@
 #include "textarea.h"
 #include "action.h"
 
+#include "root_menu.h"
 
 #if LCD_DEPTH > 1
 #include "backdrop.h"
@@ -157,7 +158,7 @@
 static bool reload_dir = false;
 
 static bool start_wps = false;
-static bool dirbrowse(void);
+static int dirbrowse(void);
 static int curr_context = false;/* id3db or tree*/
 
 /*
@@ -269,6 +270,8 @@
     gui_synclist_init(&tree_lists, &tree_get_filename, &tc, false, 1);
     gui_synclist_set_icon_callback(&tree_lists,
                   global_settings.show_icons?&tree_get_fileicon:NULL);
+    root_menu();
+    /*
 #ifndef SIMULATOR
     dirbrowse();
 #else
@@ -276,6 +279,7 @@
         DEBUGF("No filesystem found. Have you forgotten to create it?\n");
     }
 #endif
+*/
 }
 
 void tree_get_filetypes(const struct filetype** types, int* count)
@@ -602,7 +606,7 @@
 #endif
 
 /* main loop, handles key events */
-static bool dirbrowse(void)
+static int dirbrowse(void)
 {
     int numentries=0;
     char buf[MAX_PATH];
@@ -633,27 +637,6 @@
     lastfirstpos = 0;
 #endif
 
-    if (*tc.dirfilter < NUM_FILTER_MODES) {
-#ifdef HAVE_RECORDING
-#ifndef SIMULATOR
-        if (global_settings.rec_startup) {
-            /* We fake being in the menu structure by calling
-               the appropriate parent when we drop out of each screen */
-#if CONFIG_CODEC == SWCODEC
-            /* Put in a 1 sec pause to slow bootup or the recording codecs
-               won't initialize */
-            sleep(HZ);
-#endif
-            recording_screen(false);
-            rec_menu();
-            main_menu();
-        }
-        else
-#endif
-#endif
-        start_resume(true);
-
-    }
     /* If we don't need to show the wps, draw the dir */
     if (!start_wps) {
         numentries = update_dir();
@@ -714,7 +697,7 @@
                 }
                 /* if we are in /, nothing to do */
                 if (tc.dirlevel == 0 && !strcmp(currdir,"/"))
-                    break;
+                    return GO_TO_ROOT;
 
 #ifdef HAVE_TAGCACHE
                 if (id3db)
@@ -769,22 +752,10 @@
                 /* don't enter menu from plugin browser */
                 if (*tc.dirfilter < NUM_FILTER_MODES)
                 {
-                    int i;
-                    FOR_NB_SCREENS(i)
-                        screens[i].stop_scroll();
-                    action_signalscreenchange();
-                    if (main_menu())
-                        reload_dir = true;
-                    restore = true;
-
-#ifdef HAVE_TAGCACHE
-                    id3db = check_changed_id3mode(id3db);
-                    if(id3db)
-                        reload_dir = true;
-#endif
+                    return GO_TO_MAINMENU;
                 }
                 else /* use it as a quick exit instead */
-                    exit_func = true;
+                    return GO_TO_PREVIOUS;
                 break;
 
             case ACTION_TREE_WPS:
@@ -793,7 +764,7 @@
                 {
                     if (audio_status() & AUDIO_STATUS_PLAY)
                     {
-                        start_wps=true;
+                        return GO_TO_WPS;
                     }
                     else
                     {
@@ -875,7 +846,7 @@
                         break;
 
                     case ONPLAY_START_PLAY:
-                        start_wps = true;
+                        return GO_TO_WPS;
                         break;
                 }
                 break;
@@ -949,38 +920,14 @@
                 }
                 break;
         }
-
+        if (start_wps)
+            return GO_TO_WPS;
         if ( button )
         {
             ata_spin();
         }
 
-        if (start_wps && audio_status() )
-        {
-            int i;
 
-            FOR_NB_SCREENS(i)
-                screens[i].stop_scroll();
-
-            if (gui_wps_show() == SYS_USB_CONNECTED)
-                reload_dir = true;
-#ifdef HAVE_HOTSWAP
-            else
-#ifdef HAVE_TAGCACHE
-                if (!id3db) /* Try reload to catch 'no longer valid' case. */
-#endif
-                    reload_dir = true;
-#endif
-#if LCD_DEPTH > 1
-            show_main_backdrop();
-#endif
-#ifdef HAVE_TAGCACHE
-            id3db = check_changed_id3mode(id3db);
-#endif
-            restore = true;
-            start_wps=false;
-        }
-
     check_rescan:
         /* do we need to rescan dir? */
         if (reload_dir || reload_root ||
@@ -1013,7 +960,7 @@
         }
 
         if (exit_func)
-            break;
+            return GO_TO_PREVIOUS;
 
         if (restore || reload_dir) {
             /* restore display */
@@ -1249,24 +1196,35 @@
     return true;
 }
 
-bool rockbox_browse(const char *root, int dirfilter)
+int rockbox_browse(const char *root, int dirfilter)
 {
-    static struct tree_context backup;
-    int last_context;
-    
-    backup = tc;
+    int ret_val = 0;
     reload_dir = true;
-    memcpy(tc.currdir, root, sizeof(tc.currdir));
-    start_wps = false;
-    tc.dirfilter = &dirfilter;
-    last_context = curr_context;
+    if (dirfilter >= NUM_FILTER_MODES)
+    {
+        static struct tree_context backup;
+        int last_context;
+        
+        backup = tc;
+        memcpy(tc.currdir, root, sizeof(tc.currdir));
+        start_wps = false;
+        tc.dirfilter = &dirfilter;
+        last_context = curr_context;
+        
+        ret_val = dirbrowse();
     
-    dirbrowse();
-
-    tc = backup;
-    curr_context = last_context;
-    
-    return false;
+        tc = backup;
+        curr_context = last_context;
+    }
+    else
+    {   
+        static char buf[MAX_PATH];
+        strcpy(buf,root);
+        *tc.dirfilter = dirfilter;
+        set_current_file(buf);
+        ret_val = dirbrowse();
+    }
+    return ret_val;
 }
 
 void tree_init(void)
Index: apps/lang/english.lang
===================================================================
--- apps/lang/english.lang	(revision 12225)
+++ apps/lang/english.lang	(working copy)
@@ -10487,3 +10487,87 @@
     *: "Charge During U S B Connection"
   </voice>
 </phrase>
+<phrase>
+  id: LANG_DIR_BROWSER
+  desc: in Battery menu
+  user:
+  <source>
+    *: "Browse File Systemr"
+  </source>
+  <dest>
+    *: "Browse File System"
+  </dest>
+  <voice>
+    *: "Browse File System"
+  </voice>
+</phrase>
+<phrase>
+  id: LANG_DB_BROWSER
+  desc: in root menu
+  user:
+  <source>
+    *: "Browse Database"
+  </source>
+  <dest>
+    *: "Browse Database"
+  </dest>
+  <voice>
+    *: "Browse Database"
+  </voice>
+</phrase>
+<phrase>
+  id: LANG_SETTINGS_MENU
+  desc: in root menu
+  user:
+  <source>
+    *: "Settings Menu"
+  </source>
+  <dest>
+    *: "Settings Menu"
+  </dest>
+  <voice>
+    *: "Settings Menu"
+  </voice>
+</phrase>
+<phrase>
+  id: LANG_NOW_PLAYING
+  desc: in root menu
+  user:
+  <source>
+    *: "Now Playing"
+  </source>
+  <dest>
+    *: "Now Playing"
+  </dest>
+  <voice>
+    *: "Now Playing"
+  </voice>
+</phrase>
+<phrase>
+  id: LANG_START_SCREEN
+  desc: in root menu setting
+  user:
+  <source>
+    *: "Start Screen"
+  </source>
+  <dest>
+    *: "Start Screen"
+  </dest>
+  <voice>
+    *: "Start Screen"
+  </voice>
+</phrase>
+<phrase>
+  id: LANG_ROCKBOX_TITLE
+  desc: in root menu
+  user:
+  <source>
+    *: "ROCKbox"
+  </source>
+  <dest>
+    *: "ROCKbox"
+  </dest>
+  <voice>
+    *: "ROCKbox"
+  </voice>
+</phrase>
Index: apps/tree.h
===================================================================
--- apps/tree.h	(revision 12225)
+++ apps/tree.h	(working copy)
@@ -100,7 +100,7 @@
 void tree_init(void);
 void browse_root(void);
 void set_current_file(char *path);
-bool rockbox_browse(const char *root, int dirfilter);
+int rockbox_browse(const char *root, int dirfilter);
 bool create_playlist(void);
 void resume_directory(const char *dir);
 char *getcwd(char *buf, int size);
Index: apps/settings.h
===================================================================
--- apps/settings.h	(revision 12225)
+++ apps/settings.h	(working copy)
@@ -268,6 +268,7 @@
     int  radio_status;    /* Current radio status (off, playing, paused)
                              Set by radio control functions. */
 #endif
+    char last_screen;
 #ifdef HAVE_RECORDING
     bool in_recording_screen; /* Currently in recording screen?
                                  Set by recording_screen. */
@@ -678,6 +679,7 @@
 #endif
     /* Encoder Settings End */
 #endif /* CONFIG_CODEC == SWCODEC */
+    int start_in_screen;
 };
 
 /** global variables **/
Index: apps/settings_menu.c
===================================================================
--- apps/settings_menu.c	(revision 12225)
+++ apps/settings_menu.c	(working copy)
@@ -2205,8 +2205,30 @@
     menu_exit(m);
     return result;
 }
+static bool start_screen(void)
+{
+    static const struct opt_items names[] = {
+        { STR(LANG_RESUME) },
+        { STR(LANG_START_SCREEN) },
+        { STR(LANG_DIR_BROWSER) },
+        { STR(LANG_DB_BROWSER) },
+        { STR(LANG_FILTER_MUSIC) },
+        { STR(LANG_SETTINGS_MENU) },
+#ifdef HAVE_RECORDING
+        { STR(LANG_RECORDING_MENU) },
+#endif
+#ifdef CONFIG_TUNER
+        { STR(LANG_FM_RADIO) },
+#endif
+        { STR(LANG_BOOKMARK_MENU_RECENT_BOOKMARKS) }, 
+        { STR(LANG_PLUGINS) },
+    };
+    bool ret;
+    ret=set_option( str(LANG_START_SCREEN), &global_settings.start_in_screen,
+                    INT, names, sizeof(names)/sizeof(*names), NULL);
+    return ret;
+}
 
-
 static bool system_settings_menu(void)
 {
     int m;
@@ -2232,6 +2254,7 @@
 #ifdef CONFIG_CHARGING
         { ID2P(LANG_CAR_ADAPTER_MODE), car_adapter_mode       },
 #endif
+        { ID2P(LANG_START_SCREEN), start_screen       },
     };
 
     m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
Index: apps/settings_list.c
===================================================================
--- apps/settings_list.c	(revision 12225)
+++ apps/settings_list.c	(working copy)
@@ -699,6 +699,16 @@
     OFFON_SETTING(0,usb_charging,LANG_USB_CHARGING,false,"usb charging",NULL),
 #endif
 #endif
+    {F_T_INT,GS(start_in_screen),LANG_RECORD_TRIGGER_TYPE,
+        INT(1),"start in screen","previous,root,files,db,wps,menu,"
+#ifdef HAVE_RECORDING
+        ",recording"
+#endif
+#ifdef CONFIG_TUNER
+        ",radio"
+#endif
+        ,UNUSED},
+    SYSTEM_SETTING(NVRAM(1),last_screen,-1),
 };
 
 const int nb_settings = sizeof(settings)/sizeof(*settings);
Index: apps/tagcache.c
===================================================================
--- apps/tagcache.c	(revision 12225)
+++ apps/tagcache.c	(working copy)
@@ -3875,7 +3875,10 @@
 {
     return tc_stat.initialized;
 }
-    
+bool tagcache_is_usable(void)
+{
+    return tc_stat.initialized && tc_stat.ready;
+}
 int tagcache_get_commit_step(void)
 {
     return tc_stat.commit_step;
Index: apps/tagcache.h
===================================================================
--- apps/tagcache.h	(revision 12225)
+++ apps/tagcache.h	(working copy)
@@ -181,6 +181,7 @@
 #endif
 void tagcache_init(void);
 bool tagcache_is_initialized(void);
+bool tagcache_is_usable(void);
 void tagcache_start_scan(void);
 void tagcache_stop_scan(void);
 bool tagcache_update(void);
Index: apps/SOURCES
===================================================================
--- apps/SOURCES	(revision 12225)
+++ apps/SOURCES	(working copy)
@@ -18,6 +18,7 @@
 playlist_menu.c
 playlist_viewer.c
 plugin.c
+root_menu.c
 screens.c
 settings.c
 settings_list.c
Index: apps/root_menu.c
===================================================================
--- apps/root_menu.c	(revision 0)
+++ apps/root_menu.c	(revision 0)
@@ -0,0 +1,267 @@
+/***************************************************************************
+ *             __________               __   ___.
+ *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
+ *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
+ *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
+ *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
+ *                     \/            \/     \/    \/            \/
+ * $Id: main.c 12101 2007-01-24 02:19:22Z jdgordon $
+ *
+ * Copyright (C) 2007 Jonathan Gordon
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include "config.h"
+#include "menu.h"
+#include "root_menu.h"
+#include "lang.h"
+#include "settings.h"
+#include "kernel.h"
+#include "debug.h"
+#include "misc.h"
+#include "rolo.h"
+#include "backdrop.h"
+#include "talk.h"
+
+/* gui api */
+#include "list.h"
+#include "statusbar.h"
+#include "splash.h"
+#include "buttonbar.h"
+#include "textarea.h"
+#include "action.h"
+#include "yesno.h"
+
+#include "main_menu.h"
+#include "tree.h"
+#include "radio.h"
+#include "recording.h"
+#include "gwps-common.h"
+#include "bookmark.h"
+
+struct root_items {
+    unsigned char *desc;
+    int (*function)(void);
+};
+
+static int tree_browser(void)
+{
+    static char folder[MAX_PATH] = "/";
+    struct tree_context* tc = tree_get_context();
+    int ret_val;
+    strcat(folder,"/");
+    ret_val = rockbox_browse(folder, global_settings.dirfilter);
+    strcpy(folder,tc->currdir);
+    if (*tc->dirfilter == SHOW_ID3DB)
+        *tc->dirfilter = SHOW_SUPPORTED;
+    return ret_val;
+}  
+
+static int db_browser(void)
+{
+    static char folder[MAX_PATH] = "/";
+    static int  dir_filter = SHOW_ID3DB;
+    struct tree_context* tc = tree_get_context();
+    int last_dirfilter = *tc->dirfilter;
+    int ret_val;
+    if (!tagcache_is_usable())
+    {
+        gui_syncsplash(HZ, true, str(LANG_TAGCACHE_BUSY));
+        return GO_TO_PREVIOUS;
+    }
+    dir_filter = SHOW_ID3DB;
+    strcat(folder,"/");
+    ret_val = rockbox_browse(folder, dir_filter);
+    strcpy(folder,tc->currdir);
+    *tc->dirfilter = last_dirfilter;
+    return ret_val;
+}
+
+static int menu(void)
+{
+    main_menu();
+    return GO_TO_PREVIOUS;
+}
+#ifdef HAVE_RECORDING
+static int recscrn(void)
+{
+    recording_screen(false);
+    return GO_TO_ROOT;
+}
+#endif
+static int wps(void)
+{
+    if (audio_status())
+    {
+        gui_wps_show();
+    }
+    else if ( global_status.resume_index != -1 )
+    {
+        DEBUGF("Resume index %X offset %X\n",
+               global_status.resume_index,
+               global_status.resume_offset);
+
+#ifdef HAVE_ALARM_MOD
+        if ( rtc_check_alarm_started(true) ) {
+           rtc_enable_alarm(false);
+           do_resume = true;
+        }
+#endif
+
+        if (playlist_resume() != -1)
+        {
+            playlist_start(global_status.resume_index,
+                global_status.resume_offset);
+            gui_wps_show();
+        }
+    }
+    else 
+    {
+        gui_syncsplash(HZ*2, true, str(LANG_NOTHING_TO_RESUME));
+    }
+#if LCD_DEPTH > 1
+    show_main_backdrop();
+#endif
+    return GO_TO_PREVIOUS;
+}
+#ifdef CONFIG_TUNER
+static int radio(void)
+{
+    return radio_screen();
+}
+#endif
+
+static int plugin_browse(void)
+{
+    return rockbox_browse(PLUGIN_DIR, SHOW_PLUGINS);
+}
+static int load_bmarks(void)
+{
+    bookmark_mrb_load();
+    return GO_TO_PREVIOUS;
+}
+
+static const struct root_items items[] = {
+    [GO_TO_FILEBROWSER] =   { ID2P(LANG_DIR_BROWSER), tree_browser },
+    [GO_TO_DBBROWSER] =     { ID2P(LANG_DB_BROWSER), db_browser },
+    [GO_TO_WPS] =           { ID2P(LANG_FILTER_MUSIC), wps },
+    [GO_TO_MAINMENU] =      { ID2P(LANG_SETTINGS_MENU), menu },
+#ifdef HAVE_RECORDING
+    [GO_TO_RECSCREEN] =     { ID2P(LANG_RECORDING_MENU), recscrn },
+#endif
+#ifdef CONFIG_TUNER
+    [GO_TO_FM] =            { ID2P(LANG_FM_RADIO), radio},
+#endif
+    [GO_TO_RECENTBMARKS] =  { ID2P(LANG_BOOKMARK_MENU_RECENT_BOOKMARKS),
+                                load_bmarks }, 
+    [GO_TO_BROWSEPLUGINS] = { ID2P(LANG_PLUGINS), plugin_browse}, 
+    
+};
+static const int nb_items = sizeof(items)/sizeof(*items);
+static char * menu_get_itemname(int selected_item, void * data, char *buffer)
+{
+    (void)data;
+    (void)buffer;
+    return (P2STR(items[selected_item].desc));
+}
+#ifdef BOOTFILE
+extern bool boot_changed; /* from tree.c */
+static void check_boot(void)
+{
+    if (boot_changed) {
+        char *lines[]={str(LANG_BOOT_CHANGED), str(LANG_REBOOT_NOW)};
+        struct text_message message={lines, 2};
+        if(gui_syncyesno_run(&message, NULL, NULL)==YESNO_YES)
+            rolo_load("/" BOOTFILE);
+        boot_changed = false;
+    }
+}
+#else
+# define check_boot()
+#endif
+
+void root_menu(void)
+{
+    struct gui_synclist synclist;
+    int ret_val = GO_TO_ROOT, last_screen = GO_TO_ROOT;
+    int key, this_screen = GO_TO_ROOT;
+
+    gui_synclist_init(&synclist, menu_get_itemname, NULL, false, 1);
+    gui_synclist_set_icon_callback(&synclist, NULL);
+    gui_synclist_set_nb_items(&synclist, nb_items);
+    FOR_NB_SCREENS(key)
+    {
+        if (synclist.gui_list[key].display->nb_lines > 3)
+            gui_list_set_title(&synclist.gui_list[key],
+                                str(LANG_ROCKBOX_TITLE), 0);
+    }
+    if (global_settings.start_in_screen == 0)
+        ret_val = (int)global_status.last_screen;
+    else ret_val = global_settings.start_in_screen - 2;
+    
+    last_screen = GO_TO_ROOT;
+    while (true)
+    {
+        check_boot();
+        if (ret_val != GO_TO_ROOT)
+            key = LAST_ACTION_PLACEHOLDER; /* will never be returned by get_action() */
+                                           /* so used if we need to skip user input */
+        else 
+        {
+            gui_synclist_draw(&synclist);
+            gui_syncstatusbar_draw(&statusbars, true);
+            key = get_action(CONTEXT_MAINMENU, HZ);
+            last_screen = GO_TO_ROOT;
+            if(gui_synclist_do_button(&synclist, key, LIST_WRAP_UNLESS_HELD))
+            {
+                int id = P2ID(items[gui_synclist_get_sel_pos(&synclist)].desc);
+                if (global_settings.talk_menu && (id > -1 ))
+                    talk_id(id,true);
+            }
+        }
+        
+        switch( key ) {
+            case ACTION_STD_OK:
+                action_signalscreenchange();
+                ret_val = gui_synclist_get_sel_pos(&synclist);
+                /* fall through */
+            case LAST_ACTION_PLACEHOLDER:
+                if (ret_val == GO_TO_PREVIOUS)
+                {
+                    ret_val = last_screen;
+                }
+                if ((ret_val <0) || (ret_val >= nb_items))
+                {
+                    ret_val = GO_TO_ROOT;
+                    break;
+                }
+                action_signalscreenchange();
+                this_screen = ret_val;
+                /* set the global_status.last_screen before entering,
+                   if we dont we will always return to the wrong screen on boot */
+                global_status.last_screen = (char)this_screen;
+                status_save();
+                
+                ret_val = items[this_screen].function();
+                if (ret_val != GO_TO_PREVIOUS)
+                    last_screen = this_screen;
+                break;
+                
+            default:
+                if(default_event_handler(key) == SYS_USB_CONNECTED)
+                    return;
+                break;
+        }
+    }
+    action_signalscreenchange();
+    return;
+}
Index: apps/root_menu.h
===================================================================
--- apps/root_menu.h	(revision 0)
+++ apps/root_menu.h	(revision 0)
@@ -0,0 +1,37 @@
+/***************************************************************************
+ *             __________               __   ___.
+ *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
+ *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
+ *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
+ *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
+ *                     \/            \/     \/    \/            \/
+ * $Id: main.c 12101 2007-01-24 02:19:22Z jdgordon $
+ *
+ * Copyright (C) 2007 Jonathan Gordon
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+ #include "config.h"
+ void root_menu(void);
+ 
+ enum {
+     GO_TO_PREVIOUS = -2,
+     GO_TO_ROOT = -1,
+     GO_TO_FILEBROWSER = 0,
+     GO_TO_DBBROWSER,
+     GO_TO_WPS,
+     GO_TO_MAINMENU,
+#ifdef HAVE_RECORDING
+     GO_TO_RECSCREEN,
+#endif
+#ifdef CONFIG_TUNER
+     GO_TO_FM,
+#endif
+     GO_TO_RECENTBMARKS,
+     GO_TO_BROWSEPLUGINS,
+ };
