Re: clone object



* Jens Luedicke <jens irs-net com>:

I want to clone a Gtk2::ListStore object, because
I need an exact independent copy with all its values.

There's no such built-in method to do this.  The reason is quite
obvious: the model may contain values of a non-fundamental type
(especially when using GTK with a wrapper such as gtk2-perl, which
permits you to include a perl scalar inside a model) so how it could
know in which way those values should be copied between the original
model and the cloned one?  You ought to provide a custom "cloning"
function anyways...

how can I do this?

Iterate throughout the original model, and populate another model with
copies of the former's content (make sure you're actually cloning the
content, and not just doing shallow copies, if this is your case).

Regards,
 Emmanuele.

-- 
Emmanuele Bassi (Zefram)       [ http://digilander.libero.it/ebassi/blog ]
GnuPG Key fingerprint = 4DD0 C90D 4070 F071 5738  08BD 8ECC DB8F A432 0FF4



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