bug fixed while adding new aircraft

This commit is contained in:
Pascal Brisset
2007-10-13 08:20:15 +00:00
parent 2e8b89c6fd
commit ca45ac5a5f
+4 -5
View File
@@ -144,8 +144,7 @@ let first_word = fun s ->
(* Link A/C to airframe & flight_plan labels *) (* Link A/C to airframe & flight_plan labels *)
let ac_combo_handler = fun gui (ac_combo:Utils.combo) target_combo -> let ac_combo_handler = fun gui (ac_combo:Utils.combo) target_combo ->
combo_connect ac_combo let update_params = fun ac_name ->
(fun ac_name ->
try try
let aircraft = Hashtbl.find Utils.aircrafts ac_name in let aircraft = Hashtbl.find Utils.aircrafts ac_name in
let sample = aircraft_sample ac_name "42" in let sample = aircraft_sample ac_name "42" in
@@ -169,7 +168,8 @@ let ac_combo_handler = fun gui (ac_combo:Utils.combo) target_combo ->
gui#button_clean#misc#set_sensitive false; gui#button_clean#misc#set_sensitive false;
gui#button_build#misc#set_sensitive false; gui#button_build#misc#set_sensitive false;
(Utils.combo_widget target_combo)#misc#set_sensitive false (Utils.combo_widget target_combo)#misc#set_sensitive false
); in
combo_connect ac_combo update_params;
(* New A/C button *) (* New A/C button *)
let callback = fun _ -> let callback = fun _ ->
@@ -179,7 +179,7 @@ let ac_combo_handler = fun gui (ac_combo:Utils.combo) target_combo ->
Utils.add_to_combo ac_combo s; Utils.add_to_combo ac_combo s;
let a = aircraft_sample s (string_of_int (new_ac_id ())) in let a = aircraft_sample s (string_of_int (new_ac_id ())) in
Hashtbl.add Utils.aircrafts s a; Hashtbl.add Utils.aircrafts s a;
Utils.aircrafts_table_has_changed := true update_params s
in in
ignore (gui#menu_item_new_ac#connect#activate ~callback); ignore (gui#menu_item_new_ac#connect#activate ~callback);
@@ -190,7 +190,6 @@ let ac_combo_handler = fun gui (ac_combo:Utils.combo) target_combo ->
match GToolbox.question_box ~title:"Delete A/C" ~buttons:["Cancel"; "Delete"] ~default:2 (sprintf "Delete %s ? (no undo after Save)" ac_name) with match GToolbox.question_box ~title:"Delete A/C" ~buttons:["Cancel"; "Delete"] ~default:2 (sprintf "Delete %s ? (no undo after Save)" ac_name) with
2 -> begin 2 -> begin
begin try Hashtbl.remove Utils.aircrafts ac_name with _ -> () end; begin try Hashtbl.remove Utils.aircrafts ac_name with _ -> () end;
Utils.aircrafts_table_has_changed := true;
let combo_box = Utils.combo_widget ac_combo in let combo_box = Utils.combo_widget ac_combo in
match combo_box#active_iter with match combo_box#active_iter with
| None -> () | None -> ()