Prevent an activity from launching more than once?

Talk about how to use and get the most out of Activities for the XO.

Prevent an activity from launching more than once?

Postby stevenkan » Wed Mar 04, 2009 8:02 pm

My son is 5, and he doesn't quite seem to grok switching amongst open applications yet. He _always_ goes back to the Home screen and then launches his desired activity, and he never quits them. This causes memory problems, and some apps (like the maze game) just refuse to run if launched a second time.

Is there a way to
1) Prevent an activity from launching a second time, and
2) Automagically switch to the already-running instance if such an attempt is made?

Thanks!
stevenkan
 
Posts: 15
Joined: Fri Nov 14, 2008 2:56 am

Re: Prevent an activity from launching more than once?

Postby ektoric » Thu Mar 05, 2009 1:30 pm

Unfortunately, no. The applications themselves have to be "self aware" in this scenario. There's no practical way for Sugar to do the work. Each application would have to do something to wave its hand and say "hey! I'm here!", and each successive start would have to do the right thing and look for that waving.
ektoric
Support Team
 
Posts: 470
Joined: Wed Jan 02, 2008 3:46 pm
Location: Austin, TX

Re: Prevent an activity from launching more than once?

Postby stevenkan » Thu Mar 05, 2009 2:05 pm

Interesting. Do you know do other OSes manage this? For example XP will permit multiple instances of Excel (but complain about certain files being locked), but OS X will not.

Does anyone else consider this to be a legitimate problem? Or is it just me :D
stevenkan
 
Posts: 15
Joined: Fri Nov 14, 2008 2:56 am

Re: Prevent an activity from launching more than once?

Postby ektoric » Thu Mar 05, 2009 2:41 pm

Other OSes don't manage this. Exactly per your example, it's the application that has to have the smarts. When you launch your second excel, it has to determine whether to start a new window or reselect the currently open excel.

Well, excel is actually a poor example because it's so beefy that it does actually have a very large communication backend, and that is why if you go to program manager and kill "excel", all your excel windows go away. But perhaps that is a good example. Again, it's excel that has to have the smarts built into it, and not the OS.
ektoric
Support Team
 
Posts: 470
Joined: Wed Jan 02, 2008 3:46 pm
Location: Austin, TX

Re: Prevent an activity from launching more than once?

Postby stevenkan » Thu Mar 05, 2009 2:47 pm

I learn something new every day :D

So if the application has to handle this, does Sugar allow inter-application communication? Or is each app completely sandboxed?

I suppose an app could write a flag or file to the Journal or some other thing, but that gets messy, especially if apps crash.
stevenkan
 
Posts: 15
Joined: Fri Nov 14, 2008 2:56 am

Re: Prevent an activity from launching more than once?

Postby ektoric » Tue Mar 10, 2009 3:53 am

I learn something every day too! Not too long ago, on these very boards, I learned about the OLPC Bitfrost approach to application security. There are different methods of interprocess communication, but bitfrost will certainly put a hamper on things.
ektoric
Support Team
 
Posts: 470
Joined: Wed Jan 02, 2008 3:46 pm
Location: Austin, TX

Re: Prevent an activity from launching more than once?

Postby manymny » Tue Aug 18, 2009 4:21 am

each activity has a process identifiable by its filename, that name is easy to obtain- it's easy to see if a named process is already running.

it would be trivial (?) to create a wrapper process that only called an activity if it wasn't running already. sugarizing that wrapper (giving it an icon like the activity it wraps) is a little beyond me, the key perhaps is to do it in python, whereas i would only know where to begin using the bash shell.
teachers that continue teaching should be expected to continue learning; it's an absurdity to have 19th century expectations of 21st century educators. granted they shouldn't have their time wasted (more than students,) or be paid insulting salary.
manymny
 
Posts: 26
Joined: Mon Aug 17, 2009 11:26 am


Return to Activities / Software

Who is online

Users browsing this forum: No registered users and 1 guest