summaryrefslogtreecommitdiff
path: root/apps/tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/tree.c')
-rw-r--r--apps/tree.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/apps/tree.c b/apps/tree.c
index 84224efa85..d1d0ec3b27 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -904,6 +904,7 @@ int rockbox_browse(const char *root, int dirfilter)
904 if (dirfilter >= NUM_FILTER_MODES) 904 if (dirfilter >= NUM_FILTER_MODES)
905 { 905 {
906 static struct tree_context backup; 906 static struct tree_context backup;
907 char current[MAX_PATH];
907 int last_context; 908 int last_context;
908 909
909 backup = tc; 910 backup = tc;
@@ -913,6 +914,58 @@ int rockbox_browse(const char *root, int dirfilter)
913 start_wps = false; 914 start_wps = false;
914 last_context = curr_context; 915 last_context = curr_context;
915 916
917 /* Center on the currently loaded language when browsing languages. */
918 if (dirfilter == SHOW_LNG)
919 {
920 if (global_settings.lang_file[0])
921 {
922 snprintf(current, sizeof(current), LANG_DIR "/%s.lng",
923 global_settings.lang_file);
924 }
925 else
926 {
927 strncpy(current, LANG_DIR "/english.lng", sizeof(current));
928 }
929 }
930 /* Center on currently loaded WPS */
931 else if (dirfilter == SHOW_WPS)
932 {
933 snprintf(current, sizeof(current), WPS_DIR "/%s.wps",
934 global_settings.wps_file);
935 }
936#ifdef HAVE_REMOTE_LCD
937 /* Center on currently loaded RWPS */
938 else if (dirfilter == SHOW_RWPS)
939 {
940 snprintf(current, sizeof(current), WPS_DIR "/%s.rwps",
941 global_settings.rwps_file);
942 }
943#endif
944#ifdef HAVE_LCD_BITMAP
945 /* Center on the currently loaded font when browsing fonts */
946 else if (dirfilter == SHOW_FONT)
947 {
948 snprintf(current, sizeof(current), FONT_DIR "/%s.fnt",
949 global_settings.font_file);
950 }
951#endif
952#if CONFIG_TUNER
953 /* Center on the currently loaded FM preset when browsing those */
954 else if (dirfilter == SHOW_FMR)
955 {
956 snprintf(current, sizeof(current), FMPRESET_PATH "/%s.fmr",
957 global_settings.fmr_file);
958 }
959#endif
960
961 /* If we've found a file to center on, do it */
962 if (current[0] == '/')
963 {
964 set_current_file(current);
965 /* set_current_file changes dirlevel, change it back */
966 tc.dirlevel = 0;
967 }
968
916 ret_val = dirbrowse(); 969 ret_val = dirbrowse();
917 tc = backup; 970 tc = backup;
918 curr_context = last_context; 971 curr_context = last_context;