maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   Application Instance (https://talk.maemo.org/showthread.php?t=58295)

waelfarouk0 2010-07-12 11:54

Application Instance
 
Dear All,
I want to limit my application to one instance
so if the user try to launch the application and it is already running in process it brings the process UI to front


Regards
Wael

harriva 2010-07-12 13:30

Re: Application Instance
 
You can register a D-Bus name for your application and terminate it if that name is already taken.

I'm not sure if the background running instance will pop to front or if you have to add few lines to handle sending and receiving dbus messages to tell that other instance to pop up. Or maybe there's some other nifty way to do app up popping.

uvatbc 2010-07-12 15:14

Re: Application Instance
 
My application has a single-app instance logic in it. The source is browsable from the link in my sig.
I have made it the way it is so that it works without dbus dependencies, because I need it to work in Windows as well.

Switch_ 2010-07-12 15:24

Re: Application Instance
 
Quote:

Originally Posted by uvatbc (Post 749279)
My application has a single-app instance logic in it. The source is browsable from the link in my sig.
I have made it the way it is so that it works without dbus dependencies, because I need it to work in Windows as well.

Thanks but you have no sig..... Link...?

fcrochik 2010-07-12 15:26

Re: Application Instance
 
In Qt you would need to do something like this to make sure the window is visible/active.

Code:

    pMainWindow->show();
    pMainWindow->activateWindow();
    pMainWindow->raise();


fcrochik 2010-07-12 15:29

Re: Application Instance
 
Quote:

Originally Posted by Switch_ (Post 749292)
Thanks but you have no sig..... Link...?

This may be helpful:
http://qt.nokia.com/products/appdev/add-on-products/catalog/4/Utilities/qtsingleapplication/


p.s. I haven't tested myself... I use DBus on my application to check for other instances.

dannym 2010-07-12 15:55

Re: Application Instance
 
In hildon, you register a dbus service for your application and list its name in the desktop file. The file manager/panel will use dbus activation to notify your program of the file names etc, so your application will only be running once.

http://wiki.maemo.org/Documentation/...mo_application

waelfarouk0 2010-07-12 18:03

Re: Application Instance
 
Quote:

Originally Posted by dannym (Post 749334)
In hildon, you register a dbus service for your application and list its name in the desktop file. The file manager/panel will use dbus activation to notify your program of the file names etc, so your application will only be running once.

http://wiki.maemo.org/Documentation/...mo_application

Thanks, this works
but if application run on startup it is running and when i click it from desktop it runs again in different process i don't know why

waelfarouk0 2010-07-12 19:28

Re: Application Instance
 
May be the problem in my startup script
i use run-standalone to launch application at startup

uvatbc 2010-07-13 06:59

Re: Application Instance
 
Quote:

Originally Posted by Switch_ (Post 749292)
Thanks but you have no sig..... Link...?

argh where did it go?
http://code.google.com/p/qgvdial

PS: I think my sig isn't shown if I post in minimalist dark theme.


All times are GMT. The time now is 01:54.

vBulletin® Version 3.8.8