Skip to content
Snippets Groups Projects
Commit 029ac347 authored by Loïc Correnson's avatar Loïc Correnson
Browse files

Merge branch 'feature/andre/gui-reset' into 'master'

[Gui] add 'Reset to factory settings' to Preferences panel

Closes #746

See merge request frama-c/frama-c!2448
parents 47977ae6 8165afe6
No related branches found
No related tags found
No related merge requests found
...@@ -171,6 +171,30 @@ let preferences (host_window: Design.main_window_extension_points) = ...@@ -171,6 +171,30 @@ let preferences (host_window: Design.main_window_extension_points) =
(* Save and cancel buttons. *) (* Save and cancel buttons. *)
let hbox_buttons = dialog#action_area in let hbox_buttons = dialog#action_area in
let packing = hbox_buttons#pack ~expand:true ~padding:3 in let packing = hbox_buttons#pack ~expand:true ~padding:3 in
let reset_box = GPack.vbox ~spacing:5 ~border_width:10 () in
main_box#pack reset_box#coerce;
let reset_packing = reset_box#pack in
let reset_button = GButton.button
~label:"Reset GUI to factory defaults" ~packing:reset_packing ()
in
ignore (reset_button#event#connect#button_release
~callback:(fun _ ->
let answer =
GToolbox.question_box
~title:"Reset GUI to factory defaults?"
~buttons:["Reset GUI" ; "Cancel"] ~default:2
"This will restore all GUI-related settings \
to factory defaults,\n\
including panel sizes and preferences."
in
if answer = 1 then begin
Gtk_helper.Configuration.reset ();
GToolbox.message_box
~title:"GUI reset"
"GUI reset will take place after restarting Frama-C.";
end; false));
let wb_ok = GButton.button ~label:"Save" ~packing () in let wb_ok = GButton.button ~label:"Save" ~packing () in
let wb_cancel = GButton.button ~label:"Cancel" ~packing () in let wb_cancel = GButton.button ~label:"Cancel" ~packing () in
wb_ok#grab_default (); wb_ok#grab_default ();
......
...@@ -51,6 +51,8 @@ module Configuration = struct ...@@ -51,6 +51,8 @@ module Configuration = struct
with Gui_parameters.Config.No_dir -> "" with Gui_parameters.Config.No_dir -> ""
let load () = loadConfiguration (configuration_file ()) let load () = loadConfiguration (configuration_file ())
let save () = saveConfiguration (configuration_file ()) let save () = saveConfiguration (configuration_file ())
let reset () = Extlib.safe_remove (configuration_file ());
loadConfiguration (configuration_file ())
let () = Cmdline.at_normal_exit save let () = Cmdline.at_normal_exit save
let set = setConfiguration let set = setConfiguration
......
...@@ -74,6 +74,7 @@ module Configuration: sig ...@@ -74,6 +74,7 @@ module Configuration: sig
val load : unit -> unit val load : unit -> unit
val save : unit -> unit val save : unit -> unit
val reset: unit -> unit
val set : string -> configData -> unit val set : string -> configData -> unit
(** Set a configuration element, with a key. Overwrites the previous values *) (** Set a configuration element, with a key. Overwrites the previous values *)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment