1
0
Fork 0
forked from len0rd/rockbox

Honor only the first root_menu setting to make it possible to override

the default tagbrowser root menu without modifying the default config.
Increased max items in menu to 64 and improved statusbar title.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11050 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Miika Pekkarinen 2006-09-25 19:52:38 +00:00
parent 979c23a715
commit 6e8ab3d035
2 changed files with 16 additions and 4 deletions

View file

@ -115,6 +115,9 @@ struct root_menu {
struct menu_entry *items[TAGMENU_MAX_ITEMS]; struct menu_entry *items[TAGMENU_MAX_ITEMS];
}; };
/* Statusbar text of the current view. */
static char current_title[MAX_TAGS][128];
static struct root_menu menus[TAGMENU_MAX_MENUS]; static struct root_menu menus[TAGMENU_MAX_MENUS];
static struct root_menu *menu; static struct root_menu *menu;
static struct search_instruction *csi; static struct search_instruction *csi;
@ -680,6 +683,10 @@ static bool parse_menu(const char *filename)
break; break;
case var_rootmenu: case var_rootmenu:
/* Only set root menu once. */
if (root_menu)
break;
if (get_token_str(data, sizeof(data)) < 0) if (get_token_str(data, sizeof(data)) < 0)
{ {
logf("%root_menu empty"); logf("%root_menu empty");
@ -1146,6 +1153,9 @@ int tagtree_enter(struct tree_context* c)
csi = menu->items[seek]->si; csi = menu->items[seek]->si;
c->currextra = 0; c->currextra = 0;
strncpy(current_title[c->currextra], dptr->name,
sizeof(current_title[0]) - 1);
/* Read input as necessary. */ /* Read input as necessary. */
for (i = 0; i < csi->tagorder_count; i++) for (i = 0; i < csi->tagorder_count; i++)
{ {
@ -1202,6 +1212,10 @@ int tagtree_enter(struct tree_context* c)
c->currextra++; c->currextra++;
else else
c->dirlevel--; c->dirlevel--;
/* Update the statusbar title */
strncpy(current_title[c->currextra], dptr->name,
sizeof(current_title[0]) - 1);
break; break;
default: default:
@ -1421,10 +1435,8 @@ char *tagtree_get_title(struct tree_context* c)
return menu->title; return menu->title;
case navibrowse: case navibrowse:
return (char *)tagcache_tag_to_str(csi->tagorder[c->currextra]);
case allsubentries: case allsubentries:
return "Tracks"; return current_title[c->currextra];
} }
return "?"; return "?";

View file

@ -23,7 +23,7 @@
#include "tree.h" #include "tree.h"
#define TAGNAVI_VERSION "#! rockbox/tagbrowser/2.0" #define TAGNAVI_VERSION "#! rockbox/tagbrowser/2.0"
#define TAGMENU_MAX_ITEMS 32 #define TAGMENU_MAX_ITEMS 64
#define TAGMENU_MAX_MENUS 16 #define TAGMENU_MAX_MENUS 16
enum table { root = 1, navibrowse, allsubentries, playtrack }; enum table { root = 1, navibrowse, allsubentries, playtrack };