Re: Abstract string properties with getter/setter functions



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.

Yeti

--
http://gwyddion.net/



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