let params_for_ft ft =
  let param_ft = C.combo
      ~new_allowed:false
      ~blank_allowed:false
      ~f:(fun s -> ft.conf_ft <- Glib.Convert.locale_from_utf8 s)
      Cam_messages.file_type
      (file_type_choices ())
      (Glib.Convert.locale_to_utf8 ft.conf_ft)
  in
  let param_hdl r = C.combo
      ~new_allowed:true
      ~blank_allowed:false
      ~f: (fun s -> r := Glib.Convert.locale_from_utf8 s)
      Cam_messages.command
      (Cam_commands.available_command_names ())
      (Glib.Convert.locale_to_utf8 !r)
  in
  let param_hdl_list =
    let apply l = ft.conf_hdls <- l in
    let edit com =
      let r = ref com in
      let param = param_hdl r in
      ignore (C.simple_get Cam_messages.edit
                ~width: 300
                ~height: 100
                [param]
             );
      !r
    in
    let add () =
      let com = ref "" in
      let param = param_hdl com in
      match C.simple_get Cam_messages.add
          ~width: 300
          ~height: 100
          [param]
      with
        C.Return_ok -> [!com]
      | _ -> []
    in
    let display com = [ Glib.Convert.locale_to_utf8 com ] in
    C.list
      ~f: apply
      ~edit
      ~add
      ~titles: [Cam_messages.commands ]
      ""
      display ft.conf_hdls
  in
  [ param_ft ; param_hdl_list ]