From cceb5066976aa3600a9b94b937382d96348887d8 Mon Sep 17 00:00:00 2001 From: Gautier Hattenberger Date: Sun, 19 Dec 2010 12:35:26 +0100 Subject: [PATCH] tree settings working only the scroll is missing --- sw/lib/ocaml/gtk_tools.ml | 3 +++ sw/lib/ocaml/gtk_tools.mli | 1 + sw/supervision/pc_aircraft.ml | 8 +++++--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/sw/lib/ocaml/gtk_tools.ml b/sw/lib/ocaml/gtk_tools.ml index a0e89a790d..f3a0fe0ddf 100644 --- a/sw/lib/ocaml/gtk_tools.ml +++ b/sw/lib/ocaml/gtk_tools.ml @@ -147,3 +147,6 @@ let remove_selected_from_tree = fun (tree : tree) -> let (store, _) = tree_model tree in List.iter (fun r -> ignore (store#remove r#iter)) selected +let clear_tree = fun (tree : tree) -> + let (store, _) = tree_model tree in + store#clear () diff --git a/sw/lib/ocaml/gtk_tools.mli b/sw/lib/ocaml/gtk_tools.mli index 32597e28ca..678be6a30a 100644 --- a/sw/lib/ocaml/gtk_tools.mli +++ b/sw/lib/ocaml/gtk_tools.mli @@ -71,3 +71,4 @@ val tree_values : tree -> string val get_selected_in_tree : tree -> GTree.row_reference list val add_to_tree : tree -> string -> unit val remove_selected_from_tree : tree -> unit +val clear_tree : tree -> unit diff --git a/sw/supervision/pc_aircraft.ml b/sw/supervision/pc_aircraft.ml index 90843f6f50..77c9f8e4ea 100644 --- a/sw/supervision/pc_aircraft.ml +++ b/sw/supervision/pc_aircraft.ml @@ -229,9 +229,11 @@ let ac_combo_handler = fun gui (ac_combo:Gtk_tools.combo) target_combo -> List.iter (fun (a, _subdir, label, _, _, _, _) -> match label with Label l -> l#set_text (value a) - | Tree t -> let names = Str.split regexp_space (value a) in - Printf.printf "%d\n" (List.length names); flush stdout; - List.iter (fun n -> prerr_endline n; Gtk_tools.add_to_tree t n) names + | Tree t -> + ignore (Gtk_tools.clear_tree tree_set); + let names = Str.split regexp_space (value a) in + Printf.printf "%d\n" (List.length names); flush stdout; + List.iter (fun n -> prerr_endline n; Gtk_tools.add_to_tree t n) names ) (ac_files gui model); let ac_id = ExtXml.attrib aircraft "ac_id" and gui_color = ExtXml.attrib_or_default aircraft "gui_color" "white" in