From cd10f285b1056d02338b718b0c675d2e1765036a Mon Sep 17 00:00:00 2001 From: Jacques Garrigue Date: Thu, 20 Apr 2000 02:45:44 +0000 Subject: do not propose to cancel when you cannot do it git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@3112 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02 --- otherlibs/labltk/browser/editor.ml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'otherlibs/labltk/browser/editor.ml') diff --git a/otherlibs/labltk/browser/editor.ml b/otherlibs/labltk/browser/editor.ml index 70f02d33f..a5fbdfe74 100644 --- a/otherlibs/labltk/browser/editor.ml +++ b/otherlibs/labltk/browser/editor.ml @@ -473,20 +473,20 @@ class editor ~top ~menus = object (self) method close_file () = self#close_window (List.hd windows) - method quit () = + method quit ?(cancel=true) () = try List.iter windows ~f: begin fun txt -> if Textvariable.get txt.modified = "modified" then - match Jg_message.ask ~master:top ~title:"Quit" + match Jg_message.ask ~master:top ~title:"Quit" ~cancel ("`" ^ Filename.basename txt.name ^ "' modified. Save it?") with `yes -> self#save_text txt | `no -> () | `cancel -> raise Exit end; bind top ~events:[`Destroy]; - destroy top; break () - with Exit -> break () + destroy top + with Exit -> () method reopen ~file ~pos = if not (Winfo.ismapped top) then Wm.deiconify top; @@ -514,10 +514,10 @@ class editor ~top ~menus = object (self) ~action:(fun _ -> act (); break ()) end; - bind top ~events:[`Destroy] ~breakable:true ~fields:[`Widget] ~action: + bind top ~events:[`Destroy] ~fields:[`Widget] ~action: begin fun ev -> if Widget.name ev.ev_Widget = Widget.name top - then (break (); self#quit ()) + then self#quit ~cancel:false () end; (* File menu *) -- cgit v1.2.3-70-g09d2