Summary of recent changes in cl-gtk2

I've been able to make some time to work on cl-gtk2 and as a result, I've published a few changes. Below is a short summary of them.

Load-time checking for minimum versions of libraries

During loading, cl-gtk2 now checks versions of the libraries and generates a load-time error if the version is too old. This should help to improve error diagnostics in such cases.

Support for several versions of Gtk+

Added rudimentary support for multiple Gtk+ versions. During loading cl-gtk2 adds into the *features* the symbols that correspond to the versions of glib and Gtk+, and the rest code may use them for conditional compilation of classes, functions, and methods. So if you try to load cl-gtk2 with, say, a Gtk+-2.18 installed, you will be able to access classes from Gtk+-2.18. But if later you upgrade to the later Gtk+ version you will have to recompile the cl-gtk2.

Improved demo program

I've slightly improved the demonstration program gtk-demo:demo included in the cl-gtk2. Now it looks like a text page with links to various examples:

screenshot

Working with the application's main loop

Now the functions ensure-gtk-main, leave-gtk-main, join-gtk-main, and the macro with-main-loop work similarly in both the single-threaded and multithreaded Lisp implementations.

They should be used in the following manner.

The main function would contain the code similar to the following:

(defun run ()
  (within-main-loop
    (your-application-code) ;; at some point, the application will call leave-gtk-main
  ))
(defun main ()
  (run)
  (join-gtk-main)
  (quit))

Then the main function will return when the application invokes the leave-gtk-main function and the application will exit. The main function like this can be used as a top-level function when saving the image or when running a script, and the run function may be used to invoke the application from the REPL during development - it will work in the background and you may incrementally add the code to the application.

Thread-safe finalization of GBoxed instances

I've made the finalization of GBoxed instances thread-safe and fixed a couple of bugs related to that.