diff options
author | 2011-01-07 14:26:38 +0000 | |
---|---|---|
committer | 2011-01-07 14:26:38 +0000 | |
commit | 2b636a03f937fcb6739f48f10b60323d80a84bca (patch) | |
tree | c3c1311a1ea4d59c85e3560e9b46b5bf7ef8cffc /ide/macjokes.c | |
parent | 5929b5d3ad5ddf3d5a8f0e3bd60117c8271fd3e7 (diff) |
MacOS integration
if `pkg-config --exists ige-mac-integration`, coqide.opt will be
able to open files by double-clik in finder on Darwin.
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@13779 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'ide/macjokes.c')
-rw-r--r-- | ide/macjokes.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/ide/macjokes.c b/ide/macjokes.c new file mode 100644 index 000000000..84d222ae9 --- /dev/null +++ b/ide/macjokes.c @@ -0,0 +1,37 @@ +#include <caml/mlvalues.h> +#include <caml/alloc.h> +#include <caml/memory.h> +#include <caml/callback.h> +#include <caml/fail.h> + +#include <igemacintegration/gtkosxapplication.h> + +GtkOSXApplication *theApp; +value open_file_fun; + +static gboolean deal_with_open(GtkOSXApplication *app, gchar *path, gpointer user_data) +{ + CAMLparam0(); + CAMLlocal2(string_path, res); + string_path = caml_copy_string(path); + res = caml_callback_exn(open_file_fun,string_path); + gboolean truc = !(Is_exception_result(res)); + CAMLreturnT(gboolean, truc); +} + +CAMLprim value caml_gtk_mac_init(value open_file_the_fun) +{ + CAMLparam1(open_file_the_fun); + open_file_fun = open_file_the_fun; + caml_register_generational_global_root(&open_file_fun); + theApp = g_object_new(GTK_TYPE_OSX_APPLICATION, NULL); + g_signal_connect(theApp, "NSApplicationOpenFile", G_CALLBACK(deal_with_open), NULL); + CAMLreturn (Val_unit); +} + +CAMLprim value caml_gtk_mac_ready(value unit) +{ + CAMLparam1(unit); + gtk_osxapplication_ready(theApp); + CAMLreturn(Val_unit); +} |