summaryrefslogtreecommitdiff
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-26c612f6c0e9e1f5ff4e25dc4dd6a2825bf878ba.tar.gz
rockbox-26c612f6c0e9e1f5ff4e25dc4dd6a2825bf878ba.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)
275 } 275 }
276 276
277 /* spell name AFTER voicing filetype */ 277 /* spell name AFTER voicing filetype */
278 if (spell_name) 278 if (spell_name) {
279 /* Don't spell the extension if it's not displayed */
280 if (!is_dir) {
281 bool stripit;
282 switch(global_settings.show_filename_ext) {
283 case 0:
284 /* show file extension: off */
285 stripit = true;
286 break;
287 case 1:
288 /* show file extension: on */
289 stripit = false;
290 break;
291 case 2:
292 /* show file extension: only unknown types */
293 stripit = filetype_supported(attr);
294 break;
295 case 3:
296 default:
297 /* show file extension: only when viewing all */
298 stripit = (*(local_tc->dirfilter) != SHOW_ID3DB) &&
299 (*(local_tc->dirfilter) != SHOW_ALL);
300 break;
301 }
302
303 if (stripit) {
304 char *ext = strrchr(name, '.');
305 if (ext)
306 *ext = 0;
307 }
308 }
309
279 talk_spell(name, true); 310 talk_spell(name, true);
311 }
280 312
281 return 0; 313 return 0;
282} 314}
@@ -455,11 +487,11 @@ static int update_dir(void)
455 } 487 }
456 icon = filetype_get_icon(ATTR_DIRECTORY); 488 icon = filetype_get_icon(ATTR_DIRECTORY);
457 } 489 }
458 } 490 }
459 } 491 }
460 } 492 }
461 493
462 /* set title and icon, if nothing is set, clear the title 494 /* set title and icon, if nothing is set, clear the title
463 * with NULL and icon as NOICON as the list is reused */ 495 * with NULL and icon as NOICON as the list is reused */
464 gui_synclist_set_title(list, title, icon); 496 gui_synclist_set_title(list, title, icon);
465 497