Re: [gtk-list] guile-gtk and glib questions



"Peter C. Norton" <spacey@inch.com> writes:

> I'm trying to go through most of the gtk+ tutorial using guile-gtk, and
> there are some issues which are puzzling me:
> 
> 1) I presume that a lot of the glib functions, like functions to
> manipulate lists, lists of lists, double-linked lists, etc. are directly
> translated to regular lists.  Is this right?

Guile, which is Scheme, has its own implementation of lists, of
course.  When you program in Scheme, you do not normally use glib
functions but rather you use utility functions especially written for
Scheme, for example from SLIB.

The parts of guile-gtk that deal with lists are not really done.  So
Gtk+ functions that take GLists as arguments are not available in
Scheme yet.

When this support is ready, you can use Scheme lists and vectors for
these arguments and the glue code will translate them into GLists.
Likewise for counted and zero terminated arrays on the C side.

You might want to start experimenting with the stuff that is already
there, by adding list-taking-functions to gtk.defs.  You can express
the type for an GList argument with (slist <type>), where <type> is a
normal Gtk+ type, like GtkWidget.

> 2) What syntax should be used to access a memeber of a structure, i.e. 
> owner = GTK_TREE(tree)->tree_owner; 
> becomes ???

    (set! owner (gtk-tree-tree-owner tree))

All struct members are accessed thru functions.  But only those
accessor functions actually exist that are declared in the *.defs
files.  Look for the (fields ...) option of a define-object statement.

> 3) What are the equivelant of the gtk_object_* methods?

The _ref/_unref/_sink stuff is not exported to Scheme because resource
management is automatic in Scheme.  You don't need to worry about it.

The _new/_set/_get stuff is wrapped in a straightforward way, look
into the NEWS file from guile-gtk for gtk-object-new, etc.

Anything else?



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