summaryrefslogtreecommitdiff
path: root/apps/tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/tree.c')
-rw-r--r--apps/tree.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/apps/tree.c b/apps/tree.c
index 1149c19104..fa745319a9 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -80,7 +80,7 @@
80static const struct filetype *filetypes; 80static const struct filetype *filetypes;
81static int filetypes_count; 81static int filetypes_count;
82 82
83struct gui_synclist tree_lists; 83static struct gui_synclist tree_lists;
84 84
85/* I put it here because other files doesn't use it yet, 85/* I put it here because other files doesn't use it yet,
86 * but should be elsewhere since it will be used mostly everywhere */ 86 * but should be elsewhere since it will be used mostly everywhere */
@@ -301,19 +301,10 @@ bool check_rockboxdir(void)
301} 301}
302 302
303/* do this really late in the init sequence */ 303/* do this really late in the init sequence */
304void tree_gui_init(void) 304void tree_init(void)
305{ 305{
306 check_rockboxdir(); 306 check_rockboxdir();
307
308 strcpy(tc.currdir, "/"); 307 strcpy(tc.currdir, "/");
309
310 gui_synclist_init(&tree_lists, &tree_get_filename, &tc, false, 1, NULL);
311 gui_synclist_set_voice_callback(&tree_lists, tree_voice_cb);
312 gui_synclist_set_icon_callback(&tree_lists,
313 global_settings.show_icons?&tree_get_fileicon:NULL);
314#ifdef HAVE_LCD_COLOR
315 gui_synclist_set_color_callback(&tree_lists, &tree_get_filecolor);
316#endif
317} 308}
318 309
319 310
@@ -419,6 +410,9 @@ static int update_dir(void)
419 splash(HZ, ID2P(LANG_SHOWDIR_BUFFER_FULL)); 410 splash(HZ, ID2P(LANG_SHOWDIR_BUFFER_FULL));
420 } 411 }
421 } 412 }
413
414 gui_synclist_init(&tree_lists, &tree_get_filename, &tc, false, 1, NULL);
415
422#ifdef HAVE_TAGCACHE 416#ifdef HAVE_TAGCACHE
423 if (id3db) 417 if (id3db)
424 { 418 {
@@ -472,6 +466,10 @@ static int update_dir(void)
472 gui_synclist_set_nb_items(&tree_lists, tc.filesindir); 466 gui_synclist_set_nb_items(&tree_lists, tc.filesindir);
473 gui_synclist_set_icon_callback(&tree_lists, 467 gui_synclist_set_icon_callback(&tree_lists,
474 global_settings.show_icons?tree_get_fileicon:NULL); 468 global_settings.show_icons?tree_get_fileicon:NULL);
469 gui_synclist_set_voice_callback(&tree_lists, tree_voice_cb);
470#ifdef HAVE_LCD_COLOR
471 gui_synclist_set_color_callback(&tree_lists, &tree_get_filecolor);
472#endif
475 if( tc.selected_item >= tc.filesindir) 473 if( tc.selected_item >= tc.filesindir)
476 tc.selected_item=tc.filesindir-1; 474 tc.selected_item=tc.filesindir-1;
477 475
@@ -657,8 +655,6 @@ static int dirbrowse(void)
657 return GO_TO_PREVIOUS; /* No files found for rockbox_browse() */ 655 return GO_TO_PREVIOUS; /* No files found for rockbox_browse() */
658 } 656 }
659 657
660 send_event(GUI_EVENT_ACTIONUPDATE, (void*)1); /* force a redraw */
661 gui_synclist_draw(&tree_lists);
662 while(1) { 658 while(1) {
663 bool restore = false; 659 bool restore = false;
664 if (tc.dirlevel < 0) 660 if (tc.dirlevel < 0)
@@ -706,9 +702,6 @@ static int dirbrowse(void)
706#endif 702#endif
707 case GO_TO_ROOT: exit_func = true; break; 703 case GO_TO_ROOT: exit_func = true; break;
708 default: 704 default:
709 if (*tc.dirfilter == SHOW_CFG) /* theme changed */
710 gui_synclist_init_display_settings(&tree_lists);
711
712 break; 705 break;
713 } 706 }
714 restore = true; 707 restore = true;
@@ -1000,8 +993,6 @@ int rockbox_browse(struct browse_context *browse)
1000 tc.dirfilter = &dirfilter; 993 tc.dirfilter = &dirfilter;
1001 tc.sort_dir = global_settings.sort_dir; 994 tc.sort_dir = global_settings.sort_dir;
1002 995
1003 gui_synclist_init_display_settings(&tree_lists); /* grab updated settings */
1004
1005 reload_dir = true; 996 reload_dir = true;
1006 if (*tc.dirfilter >= NUM_FILTER_MODES) 997 if (*tc.dirfilter >= NUM_FILTER_MODES)
1007 { 998 {