Re: Boxed Types

Daniel Elstner wrote:

Now, I've several questions:

Why are copy/free for GtkTextIter public, but not for GdkRectangle?

Don't know. Note that you can access the copy/free function for an arbitrary boxed type like so:
   copy_of_rectangle = g_boxed_copy(GDK_TYPE_RECTANGLE, rectangle);
   g_boxed_free(GDK_TYPE_RECTANGLE, copy_of_rectangle);

So if you know the typecode, you can copy and free it. I use this in pygtk for generic handling of boxed types.

Is there a generic way to know whether a type can be copied by simple
assigments, or do we have to look at the docs/headers?  (Some kind of
flag retrievable via the g_type_* API would be useful.)


If a struct can be assigned, is it guaranteed that this won't change in
a future version?

GTK 2.0 is now stable. I would assume that such a change would break compatibility, and hence be a no no. For GTK 3.0 however, it is possible some things may change (no idea what; don't think anyone has much idea of the specifics of 3.0 at this point).

Currently, no GTK+ functions return a dynamically allocated
GtkTextIter.  Is it safe to rely on this?

The return of g_boxed_copy() should be freed with g_boxed_free() (passing the same typecode). That is all you should need to know.


Email: james daa com au

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