Re: using a factory to control instances

Jacob Perkins <[email protected]>
Newsgroups gmane.comp.gnome.components
Organization seahorse
Message-ID <[email protected]>
On Thu, 2003-04-24 at 03:04, Michael Meeks wrote:
> Hi Jacob,
> 
> On Thu, 2003-04-24 at 05:12, Jacob Perkins wrote:
> > I want to use a bonobo factory for creating controls (or any
> > BonoboObject). I already have a setup working that was basically copied
> > from the sample control in libbonoboui. However, I only want one
> > instance of this control. So, given 'moniker', I want to create a new
> > BonoboObject if it doesn't exist yet, or return the already created one.
> > However, if given 'moniker:new', I want to create a new instance of the
> > object. Since there are no guarentees as to which process will request
> > the first instance, how do I do this. To make it simple, how would one
> > modify the sample control to support this?
> > I know this can be done with a static variable or object, but it seems
> > that factories should provide a better way to do this.
> 
> 	So - your factory is likely to be a singleton across processes (
> assuming it is an executable and not a shared object ); So I guess you
> can aggregate things to the factory (the singleton), and the result of
> :new will be what comes out of the factory ;-)
> 
> 	All method invocations on those objects will be processed in the same
> process though - so, it's fairly easy to get it to work.
> 
> 	What are you trying to achieve though ?

I originally wanted a control widget(s) where one instance could be
embedded multiple places, but after some experiments using BonoboWidget,
it seems that will not work (and even if it did, I don't think I really
want that now).
What I do still want is basically a singleton object (context) that can
be shared between processes, and in only a select few instances will a
new instance of the object be required. But I guess using a static
object to control the instances is the way to go here.
The specific reason is for seahorse: if keys are imported from nautilus,
I want them to be automatically listed in the key-manager (if it is
running).
--
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.