aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Herbelin2018-11-19 15:43:09 +0100
committerVincent Laporte2019-03-19 08:40:18 +0000
commit173b5b889c306fe166ed4da5e6986e7810c7d3bc (patch)
treeeb04b941f3d6d91566f5ba47137c0417fb3b560d
parent09fb7dbd2ca87fcd64a3d6d99eb5e537aadd0c06 (diff)
CoqIDE: Moving last use of gtk2-only FileSelection to FileChooserDialog.
-rw-r--r--ide/coq.ml15
-rw-r--r--ide/ideutils.ml9
-rw-r--r--ide/ideutils.mli2
3 files changed, 14 insertions, 12 deletions
diff --git a/ide/coq.ml b/ide/coq.ml
index e7eea4ced2..a420a3cbf5 100644
--- a/ide/coq.ml
+++ b/ide/coq.ml
@@ -128,16 +128,15 @@ and asks_for_coqtop args =
let () = pb_mes#destroy () in
filter_coq_opts args
| `DELETE_EVENT | `NO ->
- let () = pb_mes#destroy () in
- let cmd_sel = GWindow.file_selection
+ let file = select_file_for_open
~title:"coqidetop to execute (edit your preference then)"
- ~filename:(coqtop_path ()) ~urgency_hint:true () in
- match cmd_sel#run () with
- | `OK ->
- let () = custom_coqtop := (Some cmd_sel#filename) in
- let () = cmd_sel#destroy () in
+ ~filter:false
+ ~filename:(coqtop_path ()) () in
+ match file with
+ | Some _ ->
+ let () = custom_coqtop := file in
filter_coq_opts args
- | `CANCEL | `DELETE_EVENT | `HELP -> exit 0
+ | None -> exit 0
exception WrongExitStatus of string
diff --git a/ide/ideutils.ml b/ide/ideutils.ml
index 7a44d21ecf..d0fbf796a0 100644
--- a/ide/ideutils.ml
+++ b/ide/ideutils.ml
@@ -230,14 +230,17 @@ let current_dir () = match project_path#get with
| None -> ""
| Some dir -> dir
-let select_file_for_open ~title ?filename () =
+let select_file_for_open ~title ?(filter=true) ?filename () =
let file_chooser =
GWindow.file_chooser_dialog ~action:`OPEN ~modal:true ~title ()
in
file_chooser#add_button_stock `CANCEL `CANCEL ;
file_chooser#add_select_button_stock `OPEN `OPEN ;
- file_chooser#add_filter (filter_coq_files ());
- file_chooser#add_filter (filter_all_files ());
+ if filter then
+ begin
+ file_chooser#add_filter (filter_coq_files ());
+ file_chooser#add_filter (filter_all_files ())
+ end;
file_chooser#set_default_response `OPEN;
let dir = match filename with
| None -> current_dir ()
diff --git a/ide/ideutils.mli b/ide/ideutils.mli
index 531c71cd4b..cc7d865325 100644
--- a/ide/ideutils.mli
+++ b/ide/ideutils.mli
@@ -30,7 +30,7 @@ val find_tag_limits : GText.tag -> GText.iter -> GText.iter * GText.iter
val find_tag_start : GText.tag -> GText.iter -> GText.iter
val find_tag_stop : GText.tag -> GText.iter -> GText.iter
-val select_file_for_open : title:string -> ?filename:string -> unit -> string option
+val select_file_for_open : title:string -> ?filter:bool -> ?filename:string -> unit -> string option
val select_file_for_save :
title:string -> ?filename:string -> unit -> string option
val try_convert : string -> string