Re: Vala changes



Adam Schreiber wrote:
> Could you help me decipher your latest changes?  I'm trying to
> implement saving and restoring the window sizes.  I have the saving
> implemented well in seahorse-widget.c:seahorse_widget_destroy(), but
> when it comes to loading seahorse_widget_new () doesn't appear to be
> called much anymore and neither is seahorse-widget.c:object_init.
> Could you direct me where to add the code for restoring the sizes
> properly?

Yes, generally in GObject code we shouldn't be putting too much
implementation in our *_new() methods. I've made that mistake in the
past and it really botches things up. At least I'm trying to move away
from that. The problem is that it prevents us from deriving a sub class.

object_init() in seahorse-widget.c is however being called for me. When
I put a print statement in there, it shows up. Does your code not have
the right effect there? The object init function runs before any of the
construction properties are set.

You can also define a 'constructor' vfunc. See seahorse-unknown-key.c
for an example of that. That way you can have code that runs after the
construction properties are set, and the object is pretty much fully
created (with the exception of derived class constructors). A
constructor vfunc is the equivalent of a 'construct { }' block in vala.

Cheers,
Stef Walter




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