Re: define-struct



Andrei Zmievski wrote:

At 09:57 AM 12/13/01 +0800, James Henstridge wrote:

Could you give some examples of the structs you want to use (define-struct ...) for? I have found that most of the structs that are not registered with the gtype system often map nicely to native types in python (such as GdkPoint to a 2-tuple).

One other definition we probably need to add is a (define-pointer ...) one. Sonething like:
 (define-pointer CTreeNode
   (in-module "Gtk")
   (c-name "GtkCTreeNode")
   (gtype-id "GTK_TYPE_CTREE_NODE")
 )

This is to cover types that are derived from G_TYPE_POINTER. These types don't have any copy/free functions, so are not handled quite the same as G_TYPE_BOXED types.


What about GdkPixbuf struct, for example? It's not derived from GtkObject/GObject, but has _ref and _unref functions.

With the new defs format, I am mainly thinking about gtk 2.0. With 2.0, GdkPixbuf is a GObject.

For gdk-pixbuf-0.x releases (the current versions for use with gtk 1.2), it should fall under the boxed type category (the ref/unref functions correspond to the copy/free of a boxed type). Unfortuately, it isn't registered with the typesystem as such :(

This (define-pointer ...) would be for types registered as derivatives of G_TYPE_POINTER.


Before I forget, msw was hacking on support for marking definitions as deprecated (eg. gtk_widget_set_usize() being deprecated in favour of gtk_widget_set_size_request). This is done through a (deprecated "warning message") clause. For python, this uses the python warning framework, other languages might do the same, ignore the information in the defs file, or do a g_warning().

Looks like we need another draft of the defs spec (and look at finalising it -- glib/gtk are in API freeze now).

James.

--
Email: james daa com au
WWW:   http://www.daa.com.au/~james/






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