Re: Abstract string properties with getter/setter functions



On Wed, 2007-09-19 at 19:20 +0200, David Nečas (Yeti) wrote:
> On Wed, Sep 19, 2007 at 06:48:25PM +0200, Raffaele Sandrini wrote:
> > > > Since we do not see a way around this (yet) and we could not find an
> > > > example with strings in another project. I'm asking here if there is a
> > > > nice way around this.
> > > 
> > > i'm really not sure i understand your problem here...
> > 
> > We need a way to steal the string from the property i.e. to make sure
> > its not a copy of the original.
> 
> The property does not need to be actually backed by
> a string.  It just has to accept a string in the setter and
> produce a string -- a new string -- in the getter.  For
> instance GtkCellRendererText has properties "background"
> wich is a string (write-only though) and "background-gdk"
> which is a GdkColor. They are views of same thing and
> what is this actual internal representation is none of your
> business.
> 
> To sum it up, you cannot steal something that is owned by
> you from the begining.

Properties "generating" things are a complete different story. We have
to treat them separately. Properties transferring ownership will need to
be specially marked in Vala.

Raffaele




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