let simple_edit ?(with_apply=true)
    ?(apply=(fun () -> ()))
    title ?width ?height
    param_list =
  let dialog = GWindow.dialog
      ~modal: true ~title: title
      ?height ?width
      ()
  in
  let tooltips = GData.tooltips () in
  if with_apply then
    dialog#add_button Configwin_messages.mApply `APPLY;

  dialog#add_button Configwin_messages.mOk `OK;
  dialog#add_button Configwin_messages.mCancel `CANCEL;

  let (box, f_apply) = box param_list tooltips in
  dialog#vbox#pack ~expand: true ~fill: true box#coerce;

  let destroy () =
    tooltips#destroy () ;
    dialog#destroy ();
  in
  let rec iter rep =
    try
      match dialog#run () with
      | `APPLY  -> f_apply (); apply (); iter Return_apply
      | `OK -> f_apply () ; destroy () ; Return_ok
      | _ -> destroy (); rep
    with
      Failure s ->
        GToolbox.message_box "Error" s; iter rep
    | e ->
        GToolbox.message_box "Error" (Printexc.to_string e); iter rep
  in
  iter Return_cancel