From 043c966ebfea3fb04434665d7c8f1eda5937b020 Mon Sep 17 00:00:00 2001 From: Peter D'Hoye Date: Mon, 13 Aug 2007 23:11:30 +0000 Subject: [PATCH] Add another file extension viewing option that mimics the old behaviour and make this default. Also update Dutch lang file and manual for this. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14324 a1c6a512-1295-4272-9138-f99709370657 --- apps/lang/english.lang | 14 +++++++++++ apps/lang/nederlands.lang | 14 +++++++++++ apps/settings_list.c | 7 +++--- apps/tree.c | 34 ++++++++++++++++++++++---- manual/configure_rockbox/file_view.tex | 3 ++- 5 files changed, 63 insertions(+), 9 deletions(-) diff --git a/apps/lang/english.lang b/apps/lang/english.lang index e04bed9772..d72c865692 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -11025,3 +11025,17 @@ *: "Only unknown types" + + id: LANG_EXT_ONLY_VIEW_ALL + desc: in settings_menu + user: + + *: "Only when viewing all types" + + + *: "Only when viewing all types" + + + *: "Only when viewing all types" + + diff --git a/apps/lang/nederlands.lang b/apps/lang/nederlands.lang index 4acebdc777..23d0463a23 100644 --- a/apps/lang/nederlands.lang +++ b/apps/lang/nederlands.lang @@ -10950,3 +10950,17 @@ *: "Enkel onbekende types" + + id: LANG_EXT_ONLY_VIEW_ALL + desc: in settings_menu + user: + + *: "Only when viewing all types" + + + *: "Enkel bij tonen alle bestanden" + + + *: "Enkel bij tonen alle bestanden" + + diff --git a/apps/settings_list.c b/apps/settings_list.c index 2b791279a3..cb07225092 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c @@ -653,9 +653,10 @@ const struct settings_list settings[] = { "all,supported,music,playlists", NULL, 4, ID2P(LANG_ALL), ID2P(LANG_FILTER_SUPPORTED), ID2P(LANG_FILTER_MUSIC), ID2P(LANG_PLAYLISTS)), OFFON_SETTING(0,sort_case,LANG_SORT_CASE,false,"sort case",NULL), - CHOICE_SETTING(0, show_filename_ext, LANG_SHOW_FILENAME_EXT, 2, - "show filename exts", "off,on,unknown", NULL , 3 , - ID2P(LANG_OFF), ID2P(LANG_ON), ID2P(LANG_UNKNOWN_TYPES)), + CHOICE_SETTING(0, show_filename_ext, LANG_SHOW_FILENAME_EXT, 3, + "show filename exts", "off,on,unknown,view_all", NULL , 4 , + ID2P(LANG_OFF), ID2P(LANG_ON), ID2P(LANG_UNKNOWN_TYPES), + ID2P(LANG_EXT_ONLY_VIEW_ALL)), OFFON_SETTING(0,browse_current,LANG_FOLLOW,false,"follow playlist",NULL), OFFON_SETTING(0,playlist_viewer_icons,LANG_SHOW_ICONS,true, "playlist viewer icons",NULL), diff --git a/apps/tree.c b/apps/tree.c index 00f29c5eb9..b7e196f482 100644 --- a/apps/tree.c +++ b/apps/tree.c @@ -139,6 +139,7 @@ static char * tree_get_filename(int selected_item, void * data, char *buffer) struct tree_context * local_tc=(struct tree_context *)data; char *name; int attr=0; + bool stripit = false; #ifdef HAVE_TAGCACHE bool id3db = *(local_tc->dirfilter) == SHOW_ID3DB; @@ -154,11 +155,34 @@ static char * tree_get_filename(int selected_item, void * data, char *buffer) name = e->name; attr = e->attr; } - /* if it's not a directory, strip the extension if necessary */ - if((global_settings.show_filename_ext == 0) || - ((global_settings.show_filename_ext == 2) && - (filetype_supported(attr)) && - !(attr & ATTR_DIRECTORY))) + + switch(global_settings.show_filename_ext) + { + case 0: + /* show file extension: off */ + stripit = true; + break; + case 1: + /* show file extension: on */ + stripit = false; + break; + case 2: + /* show file extension: only unknown types */ + stripit = filetype_supported(attr); + break; + case 3: + default: + /* show file extension: only when viewing all */ + stripit = (*(local_tc->dirfilter) != SHOW_ID3DB) && + (*(local_tc->dirfilter) != SHOW_ALL); + break; + } + + /* global overrule: don't strip if it's a dir */ + if(attr & ATTR_DIRECTORY) + stripit = false; + + if(stripit) { return(strip_extension(name, buffer)); } diff --git a/manual/configure_rockbox/file_view.tex b/manual/configure_rockbox/file_view.tex index 3d5b022181..8bd5b9f5d0 100644 --- a/manual/configure_rockbox/file_view.tex +++ b/manual/configure_rockbox/file_view.tex @@ -44,7 +44,8 @@ displays files. \begin{description} \item[Off:] The file extensions are never shown. \item[On:] The file extensions are always shown. - \item[Only Unknown:] Only the extensions of unknown filetypes are shown. + \item[Only unknown types:] Only the extensions of unknown filetypes are shown. + \item[Only when viewing all types:] Only show file extensions when \setting{Show Files} is set to \setting{All}. \end{description} \item[Follow Playlist:]