in
(* quit *)
self#setQuitCallback (fun () ->
- if
- MatitaGtkMisc.ask_confirmation
- ~parent:main#toplevel
- ~title:"Unsaved work!"
- ~message:("Your work is <b>unsaved</b>!\n\n"^
- "<i>Do you want to save the script before exiting?</i>")
- ()
- then
- (saveScript ();prerr_endline "SAVE";GMain.Main.quit ())
- else
- GMain.Main.quit ());
+ if source_view#buffer#modified then
+ begin
+ let rc =
+ MatitaGtkMisc.ask_confirmation
+ ~parent:main#toplevel
+ ~title:"Unsaved work!"
+ ~message:("Your work is <b>unsaved</b>!\n\n"^
+ "<i>Do you want to save the script before exiting?</i>")
+ ()
+ in
+ match rc with
+ | `YES -> saveScript ();GMain.Main.quit ()
+ | `NO -> GMain.Main.quit ()
+ | `CANCEL -> ()
+ end else GMain.Main.quit ());
connect_button self#main#scriptAdvanceButton advance;
connect_button self#main#scriptRetractButton retract;
connect_button self#main#scriptTopButton top;