summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2007-03-06 08:21:18 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2007-03-06 08:21:18 +0000
commit1b07ed05a41b891bebe105e18c8c344b17108e9b (patch)
tree1e6ac245183b1377a598caceafeb8fe57afdf232 /apps
parent38be0e65d3304bd649c18a71d2c4551b0afd5a0a (diff)
downloadrockbox-1b07ed05a41b891bebe105e18c8c344b17108e9b.tar.gz
rockbox-1b07ed05a41b891bebe105e18c8c344b17108e9b.zip
Fix FS#6716 - make it easier to follow the selected file going in and
out of the trees git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12638 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/root_menu.c6
-rw-r--r--apps/tree.c18
-rw-r--r--apps/tree.h1
3 files changed, 20 insertions, 5 deletions
diff --git a/apps/root_menu.c b/apps/root_menu.c
index 279b5f8bf4..f30e10c249 100644
--- a/apps/root_menu.c
+++ b/apps/root_menu.c
@@ -88,10 +88,10 @@ static int browser(void* param)
last_screen == GO_TO_WPS && audio_status() &&
wps_state.current_track_path[0] != '\0')
{
- snprintf(folder, MAX_PATH, "%s", wps_state.current_track_path);
+ strcpy(folder, wps_state.current_track_path);
}
else
- snprintf(folder, MAX_PATH, "%s/", last_folder);
+ strcpy(folder, last_folder);
break;
case GO_TO_DBBROWSER:
if ((last_screen != GO_TO_ROOT) && !tagcache_is_usable())
@@ -111,7 +111,7 @@ static int browser(void* param)
switch ((intptr_t)param)
{
case GO_TO_FILEBROWSER:
- strcpy(last_folder, tc->currdir);
+ get_current_file(last_folder, MAX_PATH);
break;
case GO_TO_DBBROWSER:
last_db_dirlevel = tc->dirlevel;
diff --git a/apps/tree.c b/apps/tree.c
index 06b42b7c86..e4237dc598 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -474,6 +474,21 @@ void reload_directory(void)
reload_dir = true;
}
+void get_current_file(char* buffer, int buffer_len)
+{
+#ifdef HAVE_TAGCACHE
+ /* in ID3DB mode it is a bad idea to call this function */
+ /* (only happens with `follow playlist') */
+ if( *tc.dirfilter == SHOW_ID3DB )
+ return;
+#endif
+
+ struct entry* dc = tc.dircache;
+ struct entry* e = &dc[tc.selected_item];
+ snprintf(buffer, buffer_len, "%s/%s", getcwd(NULL,0),
+ e->name);
+}
+
/* Selects a file and update tree context properly */
void set_current_file(char *path)
{
@@ -505,8 +520,6 @@ void set_current_file(char *path)
strcpy(lastfile, name);
- /* undefined item selected */
- tc.selected_item = -1;
/* If we changed dir we must recalculate the dirlevel
and adjust the selected history properly */
@@ -1153,6 +1166,7 @@ int rockbox_browse(const char *root, int dirfilter)
int last_context;
backup = tc;
+ tc.selected_item = 0;
tc.dirlevel = 0;
memcpy(tc.currdir, root, sizeof(tc.currdir));
start_wps = false;
diff --git a/apps/tree.h b/apps/tree.h
index 7b202e0fbc..9fb8c233a0 100644
--- a/apps/tree.h
+++ b/apps/tree.h
@@ -100,6 +100,7 @@ struct tree_context {
void tree_get_filetypes(const struct filetype**, int*);
void tree_init(void);
void browse_root(void);
+void get_current_file(char* buffer, int buffer_len);
void set_current_file(char *path);
int rockbox_browse(const char *root, int dirfilter);
bool create_playlist(void);