[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

About GNOME / GTK - from a GNOME developer who's hacking on it :-) (Re:

From: Martin Baulig
Subject: About GNOME / GTK - from a GNOME developer who's hacking on it :-) (Re: suggestions for Guile wrt GTK and Gnome support
Date: 01 Aug 2001 05:42:32 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7


"Neil W. Van Dyke" <address@hidden> writes:

[intentionally ignoring all the "political" parts of this mail, I haven't
 slept very much the last few days so I'm too tired to write a good reply].

> The first thing I'd like to suggest is to put a canonical tree of GTK
> 1.2 support for Guile into Guile's CVS repository, make it work well,
> and keep it up to date with Guile releases and CVS versions.  GTK is a
> good and popular GUI toolkit, 1.2 is stable, and 1.2 is not dependent on
> the current Gnome build environment (which is larger, much more complex,
> and constantly changing).

Starting with GTK 1.2 would be a very bad idea and a perfect waste of time,
and there's already the gnome-guile / guile-gtk module in GNOME CVS.

Since today is the API freeze for GNOME 2 (that's also the reason why I
haven't slept much, btw.) you can start with its current API without the
risk that you need to change much. I'd also encourage everyone who wants
to do this to start as soon as possible with the GNOME 2 bindings - if you
discover any problems with its API, there's still a slight chance that we
can do something about it.

Then, before you wrap GTK+ you need to do glib, especially the gruntime /
gobject part of it and you need to do it the right way:

* starting with GNOME 2, all the core GNOME libraries use a new object
  system - GObject - which is now independent of GTK+ and X.

  You can browse the code here:

  This object interface has special support for scripting languages,
  contains types for enums, etc. - so it's really easy to wrap this in
  a scripting language.

  I have a preliminary guile port of this at:
  but it's currently broken and a bit out of date (btw. what's the current
  status of g-wrap and guile 1.5.x, it doesn't seem to work anymore ?).

* once GObject is fully wrapped in guile - you have already done a very
  large part of all the core GNOME libraries.

* to wrap all of GNOME, all you need to do is to create a simple array
  like this:

        typedef struct {
                char *name;
                gpointer func_addr;
                GType retval;
                GType *args;
        } Func;

        extern void hello_world (long);

        static GType _hello_world_args[] = {

        static Func module_foo_functions[] = {
        { "hello_world", hello_world, G_TYPE_VOID, _hello_world_args },
        { NULL, G_TYPE_NONE, NULL } };

  create such an array entry for all of GNOME's functions and you're done -
  the rest can be done in scheme.

  Actually, I'm already thinking about adding something like this directly
  to the GNOME libraries since it'd be very useful for all scripting languages.
  However, this is not really an API freeze issue, so it'll take some time.

* the last step is to wrap CORBA - and you have everything.

  Again, this needs to be done correctly - you can either write a custom
  wrapper function for every CORBA function (and quickly realize that this
  is getting a LOT of work and very big) - or go the GNOME 2 way and do
  everything dynamically.

  That's what I hacked on the last two weeks and I got it almost working.

  Btw. all that needs to be done is wrapping all CORBA types (structs,
  sequences etc.), that's why it's so super-cool :-)

  We're installing a special dlopen()able module in the core GNOME libraries
  which contains a special symbol:

      typedef struct {
          CORBA_unsigned_long           version;
          ORBit_IInterface            **interfaces;
          CORBA_sequence_CORBA_TypeCode types;
      } ORBit_IModule;

  ORBit::IInterface is a CORBA struct which defines a CORBA interface with
  all it's methods, their arguments, return values, exceptions etc - and
  the CORBA_sequence_CORBA_TypeCode are all the types in the module.

  So I'm using a small C function which iterates over this struct and
  creates GOOPS classes for all the CORBA interfaces and the corresponding
  methods etc.

  ORBit2 (GNOME 2's ORB) has special support for scripting languages - for
  instance there's a function called ORBit_small_invoke() which can invoke
  and arbitrary CORBA method.


And now it's 5:40 am, I should go to bed, more about this later ....

Martin Baulig
address@hidden (private)
address@hidden (work)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]