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