summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2024-04-26 10:01:30 -0400
committerSolomon Peachy <pizza@shaftnet.org>2024-04-26 10:01:30 -0400
commit26c612f6c0e9e1f5ff4e25dc4dd6a2825bf878ba (patch)
treea033a250b3f1e9c7dca123c8c3eff021bf6995b7
parentaa7357861a8ba9762ba1c5ac5fbcb2598abe3cd5 (diff)
downloadrockbox-26c612f6c0.tar.gz
rockbox-26c612f6c0.zip
FS#13348: Don't voice/spell out the file extension if it's not displayed
(This only applies if there is no talk clip for the file) Change-Id: I0f071313f480052ecf4b912919155a8f0c2430d1
-rw-r--r--apps/tree.c38
1 files changed, 35 insertions, 3 deletions
diff --git a/apps/tree.c b/apps/tree.c
index ea2ef23e71..2e82b165af 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -275,8 +275,40 @@ static int tree_voice_cb(int selected_item, void * data)
}
/* spell name AFTER voicing filetype */
- if (spell_name)
+ if (spell_name) {
+ /* Don't spell the extension if it's not displayed */
+ if (!is_dir) {
+ bool stripit;
+ 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;
+ }
+
+ if (stripit) {
+ char *ext = strrchr(name, '.');
+ if (ext)
+ *ext = 0;
+ }
+ }
+
talk_spell(name, true);
+ }
return 0;
}
@@ -455,11 +487,11 @@ static int update_dir(void)
}
icon = filetype_get_icon(ATTR_DIRECTORY);
}
- }
+ }
}
}
- /* set title and icon, if nothing is set, clear the title
+ /* set title and icon, if nothing is set, clear the title
* with NULL and icon as NOICON as the list is reused */
gui_synclist_set_title(list, title, icon);