Re: cloning an object ...



Antonio Gomes wrote:
Hi ,

I would like to know how can I clone an Object (widget). I mean,
creating an widget exactly identical to the first one (but allocated
in different places in memory).

Hehe,
    its quite tricky; and not supported by the GObject mechanism.

We do it in glade-3, its a question of recursing through the object
heirarchy (so that children are also recursivly copied) and applying
the properties/child-properties found on the original objects, but
some properties are not introspectable so you need special case code
for that (glade-3 uses an xml catalog to handle all that stuff).

Depending on what you are trying to acomplish, you probably want to
forget about cloning objects and take some other approach, but
you are welcome to take a look at the `glade_widget_dup()' function
in glade-widget.c (cvs co glade3).

Cheers,
                            -Tristan




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