let edition_commands_menu_entries ?line f : GToolbox.menu_entry list =
let ftype = file_type_of_file f in
let l =
try Hashtbl.find file_type_handlers ftype
with Not_found -> []
in
let f_com com =
fun () ->
command_on_files com
(f :: (match line with None -> [] | Some n -> [string_of_int n]))
in
match l with
[] ->
Cam_dbg.print ~level: 3 (Printf.sprintf "no handlers found for file type %s" ftype);
let com = default_open_file_command#get in
[
`I (Cam_misc.escape_menu_label com, f_com com)
]
| [com] ->
[`I (Cam_misc.escape_menu_label com, f_com com)]
| com::q ->
let entries = List.map
(fun com -> `I (Cam_misc.escape_menu_label com, f_com com))
q
in
[ `I (Cam_misc.escape_menu_label com, f_com com) ;
`M (Cam_messages.use_, entries) ;
]