Re: Preventing Multiple instance of GTK application




On Sat, 2008-04-12 at 17:14 +0200, G Hasse wrote:
On Sat, Apr 12, 2008 at 03:36:47PM +0100, Emmanuele Bassi wrote:

On Sat, 2008-04-12 at 16:46 +0530, Ajax John wrote:
Hi,

I have written a gtk application on my Linux system.
At present I can open or start multiple instances of my application.
how can I modify my code such that at a time only one instance of my
application is running on my system.

there are many ways to achieve single instance applications. one is to
use a X selection; another is to use a pipe/lock file; yet another one
is to use D-Bus.

you can use the unique library, or reuse parts of it:

  http://github.com/ebassi/unique/tree/master

And if you set up a different DISPLAY variable how is a pipe/lock
going to relate to this?

it depends; the "bacon" backend works by simply not using the DISPLAY
when creating the pipe.

 and the D-Bus is this running on every
display you are using?

you'll have a instance for each X session. ssh forwarding of D-Bus is a
missing feature that should be implemented in ssh (there are patches,
afair). it's not something that pertains single instance applications,
though.

Try to use something like,  ssh -X remote.system yourapp, and
other, to verify all kind of lock mechanisms. (You will have
a problem).

I know, and I check whenever it's possible. some things cannot be done,
given the current state of things; but it's always possible to improve.
I guess that for every project patches are, as always, welcome.

but why are you replying to me? shouldn't this go to the list?

ciao,
 Emmanuele.

-- 
Emmanuele Bassi,
W: http://www.emmanuelebassi.net
B: http://log.emmanuelebassi.net




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