GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Fri Aug 22, 2014 7:53 am

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Single instance application
PostPosted: Mon May 30, 2011 4:55 am 
Offline
Familiar Face

Joined: Sat May 14, 2011 9:18 am
Posts: 16
Is it possible to have only single instance of an application? similar to libunique but without libunique?


Top
 Profile  
 
 Post subject: Re: Single instance application
PostPosted: Mon May 30, 2011 5:28 am 
Offline
GTK+ Guru

Joined: Fri Jan 04, 2008 3:17 pm
Posts: 183
Location: France (92340 Bourg La Reine)
This should be possible with GTK3 (but not GTK2), since it has a GtkApplication class above GApplication which claims to replace libunique.

Howver, I did not understood all the details. If you manage to code a single-instance application with GTK, please be kind to explain here in details how you did, by giving a full code example. Code examples for GtkApplication are sadly almost non-existent.

_________________
Basile Starynkevitch (France)
http://starynkevitch.net/Basile/


Top
 Profile  
 
 Post subject: Re: Single instance application
PostPosted: Mon May 30, 2011 6:17 am 
Offline
Familiar Face

Joined: Sat May 14, 2011 9:18 am
Posts: 16
here is the scenario for what i'm trying. the apllication has multiple windows. but only one main window. whenever a second instance of the program is executed, i want the main window or the primary instance to receive the signal instead of opening another instance. a small code example with GtkApplication is sufficient. thanks in advance.


Top
 Profile  
 
 Post subject: Re: Single instance application
PostPosted: Mon May 30, 2011 7:06 pm 
Offline
GTK+ Guru

Joined: Fri Jan 04, 2008 3:17 pm
Posts: 183
Location: France (92340 Bourg La Reine)
I believe that GtkApplication is designed for exactly your scenario.

However, I don't know the details.

I suggest you to look into GTK3 source code to understand what the documentation don't tell you, and I also suggest you to experiment things.

Please be nice to document, at least by a post on this forum, what you did found and understood. If you manage to make a working example, please post its source code here.

_________________
Basile Starynkevitch (France)
http://starynkevitch.net/Basile/


Top
 Profile  
 
 Post subject: Re: Single instance application
PostPosted: Tue May 31, 2011 3:21 am 
Offline
Familiar Face

Joined: Sat May 14, 2011 9:18 am
Posts: 16
i surely will. thanks.


Top
 Profile  
 
 Post subject: Re: Single instance application
PostPosted: Fri Jun 03, 2011 12:37 pm 
Offline
Familiar Face

Joined: Sat May 14, 2011 9:18 am
Posts: 16
http://developer.gnome.org/gtk3/3.0/gtk-migrating-GtkApplication.html

this page helped me solve my problem.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group