Re: Unique BonoboControl

A Seg, 2003-11-03 s 20:37, Mikoyan escreveu:
> Hi list,
> Let me first describe the situation before I'll ask the
> question.
> I've an simple BonoboControl of which only one may be
> active at the same time. E.g. I've such a control and an object.
> The object sends corba calls to the control. When this
> object is created, if first checks if such control is
> running. If not, it creates the control in a bonobowindow,
> and starts sending the messages to the control. Otherwise 
> it will just sends the messages to the already running
> control... (which may be embedded/activated by any other
> app).

  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;

> I've looked at gedit code and at the thread of this mailing
> list "weird diagnostics from trivial Bonobo server", but I'm
> still not sure what to do.
> So the question is simple: what should I do? And a step
> per step explanation would be appreciated, however, any
> answer would be very appreciated :-) (I'm currently playing
> with bonobo_activation_* stuff, but i'm not very sure what
> i'm doing :))
> (Btw, what is the UniqueApplication thing about?)

  See GEP 12 here:

> Thanks in adavance, Steven
> _______________________________________________
> gnome-components-list mailing list
> gnome-components-list gnome org
Gustavo Joo Alves Marques Carneiro
<gjc inescporto pt> <gustavo users sourceforge net>

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