let edit_ft_handlers () =
let l = List.map
(fun (ft, coms) -> { conf_ft = ft ; conf_hdls = coms })
ft_handlers#get
in
let apply l =
ft_handlers#set
(List.map (fun c -> (c.conf_ft, c.conf_hdls)) l);
save_ft ()
in
let edit c =
let params = params_for_ft c in
ignore (C.simple_get Cam_messages.edit
~width: 300
~height: 300
params
);
c
in
let add () =
let c = { conf_ft = "" ; conf_hdls = [] } in
let params = params_for_ft c in
match C.simple_get Cam_messages.add
~width: 300
~height: 300
params
with
C.Return_ok -> [c]
| _ -> []
in
let display c =
[ Glib.Convert.locale_to_utf8 c.conf_ft ;
Glib.Convert.locale_to_utf8
(match c.conf_hdls with h :: _ -> h | _ -> "") ;
]
in
let param = C.list
~f: apply
~edit
~add
~titles: [Cam_messages.file_type ; Cam_messages.default_command ]
""
display l
in
ignore
(C.simple_get Cam_messages.file_types_handlers
~width: 400
~height: 500
[param]
)