Re: Glib::Object::Subclass and properties

On 11/23/2011 at 11:36 PM, Kevin Ryde <user42 zip com au> wrote:
"Martin Schlemmer" <Martin Schlemmer nwu ac za> writes:

On 2011/11/20 at 01:34 AM, Torsten Schoenfeld <kaffeetisch gmx de> wrote:

Or you could just always go through get()/set() instead of direct hash 

I do not mind either way, just wanted to verify that it was due to
some reason, and not maybe oversight.

If you want to use the hash access you can put the default value in the
hash in your INIT_INSTANCE.  It's sometimes a bit tedious to write a
default in the paramspec and again in the init, so if it's only used a
couple times then calling ->get() to let it get the default saves brain

On a bit different topic - I guess that if you make something
readonly, the correct way is to use hash access? The reason I am
asking, is because I am not sure if you do that, whether you should
signal a notify on the property?

If a property value changes you should notify.  A ->set() does that
automatically, but if you just store to the hash, or do something
affecting a computed or delegated property etc, then explicit
->notify('propname').  For a readonly property ->set() can't be used,
only the latter.

Belated reply, but much appreciated!



Vrywaringsklousule / Disclaimer: 

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