GtkPlugin moved to Linux
Then wxSqueak bursted onto the scene and my feeble attempts with Gtk paled in comparison. Rob has IMHO done an outstanding job. When I picked Gtk I actually contemplated wxWidgets (formerly known as wxWindows) but felt that C++ was a bit too complex to interface to from Squeak. Gtk seemed easier since it is C-based.
Reecently at least one person has asked if he could revive the GtkPlugin code and in order to help him with that I decided to move it to Linux - it was actually initially made on Win32 (which has a Gtk port). Easily done right? Hehe. Well, it took me 4-5 hours and in the end I produced about 7 lines of autoconf magic that got it all working. Phew.
If you read and followed my other little article on building your own Squeak VM then the following bits should fall into place. Let’s add the GtkPlugin to the mix:
- Download and unpack the GtkPlugin sources in the Squeak-3.9-7 dir:
wget http://squeak.krampe.se/GtkPlugin-20060518.tgz tar xzf GtkPlugin-20060518.tgz - This creates these files:
. |-- Gtk-gk.1.mcz `-- platforms |-- Cross | `-- plugins | `-- GtkPlugin | `-- GtkPlugin.h `-- unix |-- config | `-- make.cfg.in `-- plugins `-- GtkPlugin |-- Makefile.inc |-- acinclude.m4 `-- sqUnixGtkPrims.c - Start the Squeak image we used in the previous article (unix-3.9-7.image),
open the Monticello browser and add this http repository by pressing the
+Repository button:
MCHttpRepository location: 'http://squeak.krampe.se' user: '' password: '' - Open that repository, select the Gtk package and load the latest Monticello version available. Or just install the possibly old Gtk.xxx.mcz file included in the tar file above.
- Using VMMaker (you might need to reopen it so that it finds GtkPlugin), select "make all internal" in the left hand list (some will be left), then drag GtkPlugin from internal to the external list. Then generate all by pressing the "Entire" button. When repeating this you can just select GtkPlugin and regenerate only that plugin using the right button menu.
- Regenerate the configure script, rerun it and finally make in the bld
directory (or just "make plugins" if you repeat this later):
cd platforms/unix/config make cd ../bld ../config/configure make - If all went well you will now have the file bld/GtkPlugin/GtkPlugin.lo and more. Let’s try it; from the image, open a browser on class Gtk, select class side and execute "self test2win2button". This should load the new plugin, start the event processing, build two windows using libglade and XML descriptions, hook up some button callbacks and open up the two Gtk windows to play with.
- You can now verify that you have GtkPlugin loaded by printing (alt-p):
SmalltalkImage current listLoadedModules - And if you want to rebuild the plugin, first kill the event process and
unload the plugin using:
Gtk mainQuit. SmalltalkImage current unloadModule: 'GtkPlugin' - Then you can repeat step 5-7 above and the new plugin should load automatically when executing the Gtk example code.
Over and out for now.