diff options
| author | pboutill | 2011-04-08 16:25:35 +0000 |
|---|---|---|
| committer | pboutill | 2011-04-08 16:25:35 +0000 |
| commit | 50b42ccf1a0d6db4baf2da893723f8244f00d1fb (patch) | |
| tree | 63beb2026d65bc52b134b2d3eb48f4528aee2f7a | |
| parent | 640f1fd1911a254b49c7c310f1d4af702bfb0890 (diff) | |
Macos integration step2 : shutdown
You can quit coqide from the dock and reboot/shutdown will ask you if
you want to save your unsavec files.
Asks for a re"configure".
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@13974 85f007b7-540e-0410-9357-904b9bb8a0f7
| -rwxr-xr-x | configure | 2 | ||||
| -rw-r--r-- | ide/coqide_main.ml4 | 4 | ||||
| -rw-r--r-- | ide/ide_mac_stubs.c (renamed from ide/macjokes.c) | 18 |
3 files changed, 18 insertions, 6 deletions
@@ -642,7 +642,7 @@ else then cflags=$cflags" `pkg-config --cflags ige-mac-integration`" MACIGEFLAGS='-ccopt "`pkg-config --libs ige-mac-integration`"' - MACIGEFILE=ide/macjokes.o + MACIGEFILE=ide/ide_mac_stubs.o MACIGEP4=-DMacInt else MACIGEFLAGS="" diff --git a/ide/coqide_main.ml4 b/ide/coqide_main.ml4 index 9b567ce5f0..c63db00316 100644 --- a/ide/coqide_main.ml4 +++ b/ide/coqide_main.ml4 @@ -1,12 +1,12 @@ IFDEF MacInt THEN -external gtk_mac_init : (string -> unit) -> unit +external gtk_mac_init : (string -> unit) -> (unit -> bool) -> unit = "caml_gtk_mac_init" external gtk_mac_ready : unit -> unit = "caml_gtk_mac_ready" END -let initmac () = IFDEF MacInt THEN gtk_mac_init Coqide.do_load ELSE () END +let initmac () = IFDEF MacInt THEN gtk_mac_init Coqide.do_load Coqide.forbid_quit_to_save ELSE () END let macready () = IFDEF MacInt THEN gtk_mac_ready () ELSE () END diff --git a/ide/macjokes.c b/ide/ide_mac_stubs.c index 84d222ae9c..87cdbf08a6 100644 --- a/ide/macjokes.c +++ b/ide/ide_mac_stubs.c @@ -7,7 +7,7 @@ #include <igemacintegration/gtkosxapplication.h> GtkOSXApplication *theApp; -value open_file_fun; +value open_file_fun, forbid_quit_fun; static gboolean deal_with_open(GtkOSXApplication *app, gchar *path, gpointer user_data) { @@ -19,13 +19,25 @@ static gboolean deal_with_open(GtkOSXApplication *app, gchar *path, gpointer use CAMLreturnT(gboolean, truc); } -CAMLprim value caml_gtk_mac_init(value open_file_the_fun) +static gboolean deal_with_quit(GtkOSXApplication *app, gpointer user_data) { - CAMLparam1(open_file_the_fun); + CAMLparam0(); + CAMLlocal1(res); + res = caml_callback_exn(forbid_quit_fun,Val_unit); + gboolean truc = (Bool_val(res))||((Is_exception_result(res))); + CAMLreturnT(gboolean, truc); +} + +CAMLprim value caml_gtk_mac_init(value open_file_the_fun, value forbid_quit_the_fun) +{ + CAMLparam2(open_file_the_fun,forbid_quit_the_fun); open_file_fun = open_file_the_fun; caml_register_generational_global_root(&open_file_fun); + forbid_quit_fun = forbid_quit_the_fun; + caml_register_generational_global_root(&forbid_quit_fun); theApp = g_object_new(GTK_TYPE_OSX_APPLICATION, NULL); g_signal_connect(theApp, "NSApplicationOpenFile", G_CALLBACK(deal_with_open), NULL); + g_signal_connect(theApp, "NSApplicationBlockTermination", G_CALLBACK(deal_with_quit), NULL); CAMLreturn (Val_unit); } |
