Re: Unique BonoboControl



On Tue, 2003-11-04 at 12:25, Gustavo J. A. M. Carneiro wrote:
> A Seg, 2003-11-03 ās 20:37, Mikoyan escreveu:
> > Hi list,
> > 
> > Let me first describe the situation before I'll ask the
> > question.
> > 
[...]
> 
>   This is quite easy to accomplish using a global instance variable and
> reference counting.  For example:
> 
> static BonoboObject *object = NULL;
> 
> static void _object_destroyed (BonoboObject *obj)
> {
> 	object = NULL;
> }
> 
> static BonoboObject *
> my_factory_fn (BonoboGenericFactory *this,
>                const char           *object_id,
>                void                 *data)
> {
> 	if (!strcmp (object_id, "OAFIID:My_BonoboControl")) {
> 		if (object == NULL) {
> 			object = my_bonobo_control_new ();
> 			g_signal_connect (G_OBJECT (object), "destroy", _object_destroyed, NULL);
> 		} else
> 			bonobo_object_ref (object);
> 		return object;
> 	} else
> 		g_warning ("Unknown OAFIID 's'", object_id);
> 
> 	return object;
> }

Ok, thanks. But the "object" needs to kwow wether the control
was already running or not. I can't check the reference count,
can I? (Ok, I'll probably can associate a value with a prop
bag or something, but I'm searching something 'clean' => maybe
checking if the factory was already running or not?)

Sorry, if I'm missing something obvious here :-) 

Regards, Steven




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