let add_rte_menu
    (popup_factory:GMenu.menu GMenu.factory)
    (main_ui:Design.main_window_extension_points) localizable =
  begin
    match localizable with
      | Pretty_source.PVDecl (Some kf,{vglob=true}) ->
          if not (is_rte_generated kf) then
            ignore (popup_factory#add_item "Insert WP-safety guards"
                      ~callback:(fun () -> !Db.RteGen.do_all_rte kf ; main_ui#redisplay ())) ;
          if not (is_rte_precond kf) then
            ignore (popup_factory#add_item "Insert all callees contract"
                      ~callback:(fun () -> !Db.RteGen.do_precond kf ; main_ui#redisplay ())) ;
      | Pretty_source.PStmt(kf,({ skind=Instr(Call _) })) ->
          if not (is_rte_precond kf) then
            ignore (popup_factory#add_item "Insert callees contract (all calls)"
                      ~callback:(fun () -> !Db.RteGen.do_precond kf ; main_ui#redisplay ())) ;
      | _ -> ()
  end