method private _cb__add_constraint = fun () ->
let view = select_w#view2.SW.st_view
and model = select_w#store2 in
let fetch_tables_until = fun iter ->
let limit_path = model#get_path iter
and result = ref [] in
let current = Dbf_misc.unopt model#get_iter_first in
while (model#get_path current) <> limit_path do
result := (fst (model#get_data ~row:current)) :: !result;
if not (model#iter_next current) then
Dbf_misc.ie ()
done;
List.rev !result
in
match view#selection#get_selected_rows with
| [path] ->
if model#get_path (Dbf_misc.unopt model#get_iter_first) <> path
then
let iter = model#get_iter path in
let (table, cmodel) = model#get_data ~row:iter
and tables_before = fetch_tables_until iter in
let constr_gui =
new vtable_constraints_gui
(self#_constraint_gui_answer cmodel)
(tables_before, [table])
in
constr_gui#start ()
else
GToolbox.message_box ~title:"Bad table selected in join"
"Cannot add a constraint for the first table of the join"
| _ ->
GToolbox.message_box ~title:"No table selected in join"
"Please, select a table in join"