From bcbeac04993ffbad4f4432b646614491f2d8a5d5 Mon Sep 17 00:00:00 2001 From: Hugo Herbelin Date: Mon, 19 Nov 2018 15:56:29 +0100 Subject: CoqIDE: Ensuring that gtk is initialized before other inits done in ideutils.ml. This seems fragile: does it depend on the order files are loaded? (It was working for gtk2 when gtk initialization was in coqide_main.ml but it does not work anymore for CoqIDE built on gtk3). Eventually, it might be needed to centralize all initialization side effects in one place. --- ide/ideutils.ml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ide/ideutils.ml') diff --git a/ide/ideutils.ml b/ide/ideutils.ml index 5beaba3604..7a44d21ecf 100644 --- a/ide/ideutils.ml +++ b/ide/ideutils.ml @@ -8,9 +8,10 @@ (* * (see LICENSE file for the text of the license) *) (************************************************************************) - open Preferences +let _ = GtkMain.Main.init () + let warn_image () = let img = GMisc.image () in img#set_stock `DIALOG_WARNING; -- cgit v1.2.3 From 173b5b889c306fe166ed4da5e6986e7810c7d3bc Mon Sep 17 00:00:00 2001 From: Hugo Herbelin Date: Mon, 19 Nov 2018 15:43:09 +0100 Subject: CoqIDE: Moving last use of gtk2-only FileSelection to FileChooserDialog. --- ide/ideutils.ml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'ide/ideutils.ml') 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 () -- cgit v1.2.3 From 7af4cbfda15a8bb3300aeae7e074c7527cc7af10 Mon Sep 17 00:00:00 2001 From: Hugo Herbelin Date: Sun, 23 Dec 2018 19:55:09 +0100 Subject: CoqIDE: Ensuring that load/save windows are not hidden by their parent. --- ide/ideutils.ml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'ide/ideutils.ml') diff --git a/ide/ideutils.ml b/ide/ideutils.ml index d0fbf796a0..8c5b3fcc5b 100644 --- a/ide/ideutils.ml +++ b/ide/ideutils.ml @@ -230,9 +230,9 @@ let current_dir () = match project_path#get with | None -> "" | Some dir -> dir -let select_file_for_open ~title ?(filter=true) ?filename () = +let select_file_for_open ~title ?(filter=true) ?parent ?filename () = let file_chooser = - GWindow.file_chooser_dialog ~action:`OPEN ~modal:true ~title () + GWindow.file_chooser_dialog ~action:`OPEN ~modal:true ~title ?parent () in file_chooser#add_button_stock `CANCEL `CANCEL ; file_chooser#add_select_button_stock `OPEN `OPEN ; @@ -259,10 +259,10 @@ let select_file_for_open ~title ?(filter=true) ?filename () = file_chooser#destroy (); file -let select_file_for_save ~title ?filename () = +let select_file_for_save ~title ?parent ?filename () = let file = ref None in let file_chooser = - GWindow.file_chooser_dialog ~action:`SAVE ~modal:true ~title () + GWindow.file_chooser_dialog ~action:`SAVE ~modal:true ~title ?parent () in file_chooser#add_button_stock `CANCEL `CANCEL ; file_chooser#add_select_button_stock `SAVE `SAVE ; -- cgit v1.2.3