Re: PropertyBag callback function



Hi Jeroen,

On 23 Jul 2001, Jeroen Zwartepoorte wrote:
> How do i receive notification that a property in a PropertyBag has
> changed?
> 
> Currently, i don't create the PropertyBag, but i get it:
> 
> bag = bonobo_get_object ("config:/scintilla", "Bonobo/PropertyBag",
> &ev);
> 
> So i'm not able to specify the get & set functions that you normally do
> when you create a new PropertyBag (bonobo_property_bag_new).

	Quite right. You see the 'set' and 'get' functions are server
side, and an implementation detail of the C property bag interface
implementation in Bonobo.

> I can register an event listener with the PropertyBag
> (bonobo_event_source_client_add_listener). That tells me when a
> property value has changed, but there is no clear property id in the
> callback function! The only identifiable thing is the event_name, but
> that is something like "Bonobo/Property:change:line-numbers", so
> trying to find out which property has changed is pretty difficult.
>
> What is the correct/easy way to respond to changes to a PropertyBag?

	You need to de-mangle the event name, the property name is
'line-numbers' in this case, I think you want to use
the bonobo_event_subtype on the event name to get the property name back.

	The property id is an internal implementation detail to make it
possible to do only 1 string match in the property bag and use a fast
switch in the impl. For the same property name the index may be radicaly
different across property bags - thus this is not put on the wire: we key
by textual name on properties.

	HTH,

		Michael.

-- 
 mmeeks gnu org  <><, Pseudo Engineer, itinerant idiot





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