Commit 0bb8a73a authored by MARCHE Claude's avatar MARCHE Claude

Add a 'cancel' choice in the saving session dialog

parent b77c9cf1
......@@ -62,7 +62,7 @@
+ suggested solution: replace model + filter_model by a custom model
(JC + ?)
** saving session
* add a "cancel" choice in the "ask" window
* DONE add a "cancel" choice in the "ask" window
* add "ctrl-S" to save the session explicitly
(partially done, but no shortcut)
......
......@@ -545,6 +545,7 @@ let info_window ?(callback=(fun () -> ())) mt s =
~message_type:mt
~buttons
~title:"Why3IDE"
~icon:(!Gconfig.why_icon)
~modal:true
~show:true ()
in
......@@ -749,7 +750,7 @@ let save_session () =
eprintf "[Info] saving session@.";
M.save_session ()
let exit_function () =
let exit_function ?(destroy=false) () =
eprintf "[Info] saving IDE config file@.";
save_config ();
(*
......@@ -775,22 +776,18 @@ let exit_function () =
| 0 -> save_session (); GMain.quit ()
| 1 -> GMain.quit ()
| 2 ->
let d = GWindow.message_dialog
~message:"Do you want to save the session?"
~message_type:`QUESTION
~buttons:GWindow.Buttons.yes_no
~title:"Why3 save"
~modal:true
~show:true ()
in
let (_ : GtkSignal.id) =
d#connect#response
~callback:(function x -> d#destroy ();
if x = `YES then save_session ();
GMain.quit ()
)
let answer =
GToolbox.question_box
~title:"Why3 saving session"
~buttons:(["Yes"; "No"] @ (if destroy then [] else ["Cancel"]))
"Do you want to save the session?"
in
()
begin
match answer with
| 1 -> save_session (); GMain.quit ()
| 2 -> GMain.quit ()
| _ -> if destroy then GMain.quit () else ()
end
| _ ->
eprintf "unexpected value for saving_policy@.";
GMain.quit ()
......@@ -1258,7 +1255,8 @@ let (_ : GMenu.image_menu_item) =
()
*)
let (_ : GtkSignal.id) = w#connect#destroy ~callback:exit_function
let (_ : GtkSignal.id) = w#connect#destroy
~callback:(exit_function ~destroy:true)
let (_ : GMenu.image_menu_item) =
file_factory#add_image_item ~key:GdkKeysyms._Q ~label:"_Quit"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment